Re: [PATCH v1 11/13] perf tools: improve IBS error handling

From: Kim Phillips
Date: Mon Oct 04 2021 - 17:57:18 EST


On 9/13/21 2:34 PM, Arnaldo Carvalho de Melo wrote:
Em Thu, Sep 09, 2021 at 12:56:58AM -0700, Stephane Eranian escreveu:
From: Kim Phillips <kim.phillips@xxxxxxx>
+static void detect_amd(void)
+{
+ FILE *inf = fopen("/proc/cpuinfo", "r");
+ char *res;
+
+ if (!inf)
+ return;
+
+ res = fgrep(inf, "vendor_id");
+
+ if (res) {
+ char *s = strchr(res, ':');
+
+ is_amd = s && !strcmp(s, ": AuthenticAMD\n");
+ free(res);
+ }
+ fclose(inf);
+}
+

We have perf_env for such details, for instance in
tools/perf/util/sample-raw.c we have:o

const char *arch_pf = perf_env__arch(evlist->env);
const char *cpuid = perf_env__cpuid(evlist->env);

else if (arch_pf && !strcmp("x86", arch_pf) &&
cpuid && strstarts(cpuid, "AuthenticAMD") &&
evlist__has_amd_ibs(evlist)) {

OK, I've rebased this 11/13 patch onto the new perf_env__{arch,cpuid} code, and posted it here:

https://lore.kernel.org/lkml/20211004214114.188477-1-kim.phillips@xxxxxxx/T/#mc4c9c582e3816ab31af6d0187e6803de1a98ac84

The following 12/13 patch in this series changes, too, but since it depends on prior patches in the series, I'll reply-all to 12/13 with its new version.

Arnaldo, would it be ok to apply the two new patches that replace this 11/13? They don't depend on any others in this series, and it would save Stephane from having to carry them.

Thanks,

Kim