[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210723071159.GF179035@leoy-ThinkPad-X240s>
Date: Fri, 23 Jul 2021 15:11:59 +0800
From: Leo Yan <leo.yan@...aro.org>
To: Arnaldo Carvalho de Melo <acme@...nel.org>
Cc: "Hunter, Adrian" <adrian.hunter@...el.com>,
Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...hat.com>,
Mark Rutland <mark.rutland@....com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Jiri Olsa <jolsa@...hat.com>,
Namhyung Kim <namhyung@...nel.org>,
Thomas Gleixner <tglx@...utronix.de>,
Borislav Petkov <bp@...en8.de>,
"x86@...nel.org" <x86@...nel.org>,
"H. Peter Anvin" <hpa@...or.com>,
Mathieu Poirier <mathieu.poirier@...aro.org>,
Suzuki K Poulose <suzuki.poulose@....com>,
Mike Leach <mike.leach@...aro.org>,
"linux-perf-users@...r.kernel.org" <linux-perf-users@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"coresight@...ts.linaro.org" <coresight@...ts.linaro.org>,
"linux-arm-kernel@...ts.infradead.org"
<linux-arm-kernel@...ts.infradead.org>
Subject: Re: [PATCH v4 10/11] perf env: Set flag for kernel is 64-bit mode
Hi Arnaldo,
On Wed, Jul 14, 2021 at 11:00:44AM -0300, Arnaldo Carvalho de Melo wrote:
[...]
> > So, I wasn't suggesting to add this info to the perf.data file header,
> > just to the in-memory 'struct perf_env'.
> >
> > And also we should avoid unconditionally initializing things that we may
> > never need, please structure it as:
>
> Oops, forgot these:
>
> > static void perf_env__init_kernel_mode(struct perf_env *env)
> > {
> > const char *arch = perf_env__raw_arch(env);
> >
> > if (!strncmp(arch, "x86_64", 6) || !strncmp(arch, "aarch64", 7) ||
> > !strncmp(arch, "arm64", 5) || !strncmp(arch, "mips64", 6) ||
> > !strncmp(arch, "parisc64", 8) || !strncmp(arch, "riscv64", 7) ||
> > !strncmp(arch, "s390x", 5) || !strncmp(arch, "sparc64", 7))
> > kernel_is_64_bit = 1;
> env->kernel_is_64_bit = 1;
> > else
> > kernel_is_64_bit = 0;
> env->kernel_is_64_bit = 0;
> > }
> >
> >
> > void perf_env__init(struct perf_env *env)
> > {
> > ...
> > env->kernel_is_64_bit = -1;
> > ...
> > }
> >
> > bool perf_env__kernel_is_64_bit(struct perf_env *env)
> > {
> > if (env->kernel_is_64_bit == -1)
> > perf_env__init_kernel_mode(env);
> >
> > return env->kernel_is_64_bit;
> > }
Thanks a lot for the suggestion; this is much clear for me, will spin
new patch set by following it.
Sorry for slow response due to my bandwidth was occupied by a task in
hand.
Thanks,
Leo
Powered by blists - more mailing lists