Re: [PATCH V1 06/19] perf tools: Fix kernel_start for PTI on x86

From: Arnaldo Carvalho de Melo
Date: Wed May 16 2018 - 09:23:09 EST


Em Wed, May 16, 2018 at 04:45:41PM +0300, Adrian Hunter escreveu:
> On 16/05/18 16:00, Arnaldo Carvalho de Melo wrote:
> > 2303 bool machine__is(struct machine *machine, const char *arch)
> > 2304 {
> > 2305 return machine && machine->env && !strcmp(machine->env->arch, arch);
> > 2306 }
> > 2307
> > 2308 int machine__get_kernel_start(struct machine *machine)
> > 2309 {
> > (gdb) p machine
> > $1 = (struct machine *) 0xc55548
> > (gdb) p machine->env
> > $2 = (struct perf_env *) 0xc06400 <perf_env>
> > (gdb) p machine-env->arch
> > No symbol "env" in current context.
> > (gdb) p machine->env->arch
> > $3 = 0x0
> > (gdb)

> If there is no perf_data then perf_session__new() uses perf_env but it seems
> perf_env.arch is not initialized. Would it be OK to initialize
> perf_env.arch and perf_env.nr_cpus_avail?

I guess so, to make that always available, i.e. no perf.data? Those
should reflect the running machine environment.

So a preparatory patch that makes that the case would be good, I think.

- Arnaldo