mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Adrian Hunter <adrian.hunter@intel.com>
To: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Andy Lutomirski <luto@kernel.org>,
	"H. Peter Anvin" <hpa@zytor.com>, Andi Kleen <ak@linux.intel.com>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	Joerg Roedel <joro@8bytes.org>, Jiri Olsa <jolsa@redhat.com>,
	linux-kernel@vger.kernel.org, x86@kernel.org
Subject: Re: [PATCH V1 06/19] perf tools: Fix kernel_start for PTI on x86
Date: Wed, 16 May 2018 16:45:41 +0300	[thread overview]
Message-ID: <56a4889f-6ea9-d7c6-3f1e-ea9738d314d0@intel.com> (raw)
In-Reply-To: <20180516130029.GA18538@kernel.org>

On 16/05/18 16:00, Arnaldo Carvalho de Melo wrote:
> Em Tue, May 15, 2018 at 03:43:20PM +0300, Adrian Hunter escreveu:
>> On x86_64, PTI entry trampolines are less than the start of kernel text,
>> but still above 2^63. So leave kernel_start = 1ULL << 63 for x86_64.
>>
>> Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
>> ---
>>  tools/perf/util/machine.c | 16 +++++++++++++++-
>>  tools/perf/util/machine.h |  2 ++
>>  2 files changed, 17 insertions(+), 1 deletion(-)
>>
>> diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c
>> index 72a351613d85..2f39a4d014de 100644
>> --- a/tools/perf/util/machine.c
>> +++ b/tools/perf/util/machine.c
>> @@ -2296,6 +2296,15 @@ int machine__set_current_tid(struct machine *machine, int cpu, pid_t pid,
>>  	return 0;
>>  }
>>  
>> +/*
>> + * Compares the raw arch string. N.B. see instead perf_env__arch() if a
>> + * normalized arch is needed.
>> + */
>> +bool machine__is(struct machine *machine, const char *arch)
>> +{
>> +	return machine && machine->env && !strcmp(machine->env->arch, arch);
>> +}
>> +
> 
> Broke 'perf top':
> 
> gdb perf
> bt
> bt
> #0  __strcmp_sse2_unaligned () at ../sysdeps/x86_64/multiarch/strcmp-sse2-unaligned.S:31
> #1  0x0000000000528b1e in machine__is (machine=0xc55548, arch=0x7d9058 "x86_64") at util/machine.c:2305
> #2  0x0000000000528bbb in machine__get_kernel_start (machine=0xc55548) at util/machine.c:2329
> #3  0x00000000004df894 in machine__kernel_start (machine=0xc55548) at util/machine.h:90
> #4  0x00000000004df8e0 in machine__kernel_ip (machine=0xc55548, ip=140352692842292) at util/machine.h:96
> #5  0x00000000004e3a9c in thread__find_map (thread=0x21f9de0, cpumode=2 '\002', addr=140352692842292, al=0x7fffffff8160)
>     at util/event.c:1550
> #6  0x00000000004e3c51 in machine__resolve (machine=0xc55548, al=0x7fffffff8160, sample=0x7fffffff8360) at util/event.c:1591
> #7  0x000000000045a274 in perf_event__process_sample (tool=0x7fffffffa720, event=0x7fffea662878, evsel=0xc120e0, 
>     sample=0x7fffffff8360, machine=0xc55548) at builtin-top.c:734
> #8  0x000000000045a91c in perf_top__mmap_read_idx (top=0x7fffffffa720, idx=3) at builtin-top.c:872
> #9  0x000000000045aa6b in perf_top__mmap_read (top=0x7fffffffa720) at builtin-top.c:898
> #10 0x000000000045b460 in __cmd_top (top=0x7fffffffa720) at builtin-top.c:1167
> #11 0x000000000045c973 in cmd_top (argc=0, argv=0x7fffffffe0e0) at builtin-top.c:1509
> #12 0x00000000004ce403 in run_builtin (p=0xac5670 <commands+336>, argc=1, argv=0x7fffffffe0e0) at perf.c:303
> #13 0x00000000004ce670 in handle_internal_command (argc=1, argv=0x7fffffffe0e0) at perf.c:355
> #14 0x00000000004ce7c2 in run_argv (argcp=0x7fffffffdf3c, argv=0x7fffffffdf30) at perf.c:399
> #15 0x00000000004ceb90 in main (argc=1, argv=0x7fffffffe0e0) at perf.c:543
> (gdb) fr 1
> #1  0x0000000000528b1e in machine__is (machine=0xc55548, arch=0x7d9058 "x86_64") at util/machine.c:2305
> 2305		return machine && machine->env && !strcmp(machine->env->arch, arch);
> (gdb) list
> 2300	 * Compares the raw arch string. N.B. see instead perf_env__arch() if a
> 2301	 * normalized arch is needed.
> 2302	 */
> 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?

  reply	other threads:[~2018-05-16 13:46 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-15 12:43 [PATCH V1 00/19] perf tools and x86 PTI entry trampolines Adrian Hunter
2018-05-15 12:43 ` [PATCH V1 01/19] kallsyms: Simplify update_iter_mod() Adrian Hunter
2018-05-15 12:43 ` [PATCH V1 02/19] kallsyms, x86: Export addresses of syscall trampolines Adrian Hunter
2018-05-15 12:43 ` [PATCH V1 03/19] x86: Add entry trampolines to kcore Adrian Hunter
2018-05-15 12:43 ` [PATCH V1 04/19] x86: kcore: Give entry trampolines all the same offset in kcore Adrian Hunter
2018-05-15 12:43 ` [PATCH V1 05/19] perf tools: Use the _stest symbol to identify the kernel map when loading kcore Adrian Hunter
2018-05-15 12:43 ` [PATCH V1 06/19] perf tools: Fix kernel_start for PTI on x86 Adrian Hunter
2018-05-16 13:00   ` Arnaldo Carvalho de Melo
2018-05-16 13:45     ` Adrian Hunter [this message]
2018-05-16 13:55       ` Arnaldo Carvalho de Melo
2018-05-16 18:16         ` Adrian Hunter
2018-05-16 18:38           ` Arnaldo Carvalho de Melo
2018-05-15 12:43 ` [PATCH V1 07/19] perf tools: Workaround missing maps for x86 PTI entry trampolines Adrian Hunter
2018-05-15 12:43 ` [PATCH V1 08/19] perf tools: Fix map_groups__split_kallsyms() for entry trampoline symbols Adrian Hunter
2018-05-15 12:43 ` [PATCH V1 09/19] perf tools: Allow for extra kernel maps Adrian Hunter
2018-05-15 12:43 ` [PATCH V1 10/19] perf tools: Create maps for x86 PTI entry trampolines Adrian Hunter
2018-05-16 11:06   ` Jiri Olsa
2018-05-16 11:37     ` Adrian Hunter
2018-05-15 12:43 ` [PATCH V1 11/19] perf tools: Synthesize and process mmap events " Adrian Hunter
2018-05-15 12:43 ` [PATCH V1 12/19] perf buildid-cache: kcore_copy: Keep phdr data in a list Adrian Hunter
2018-05-15 12:43 ` [PATCH V1 13/19] perf buildid-cache: kcore_copy: Keep a count of phdrs Adrian Hunter
2018-05-15 12:43 ` [PATCH V1 14/19] perf buildid-cache: kcore_copy: Calculate offset from phnum Adrian Hunter
2018-05-15 12:43 ` [PATCH V1 15/19] perf buildid-cache: kcore_copy: Layout sections Adrian Hunter
2018-05-15 12:43 ` [PATCH V1 16/19] perf buildid-cache: kcore_copy: Iterate phdrs Adrian Hunter
2018-05-15 12:43 ` [PATCH V1 17/19] perf buildid-cache: kcore_copy: Get rid of kernel_map Adrian Hunter
2018-05-15 12:43 ` [PATCH V1 18/19] perf buildid-cache: kcore_copy: Copy x86 PTI entry trampoline sections Adrian Hunter
2018-05-15 12:43 ` [PATCH V1 19/19] perf buildid-cache: kcore_copy: Amend the offset of sections that remap kernel text Adrian Hunter
2018-05-16 12:50 ` [PATCH V1 00/19] perf tools and x86 PTI entry trampolines Jiri Olsa

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=56a4889f-6ea9-d7c6-3f1e-ea9738d314d0@intel.com \
    --to=adrian.hunter@intel.com \
    --cc=acme@kernel.org \
    --cc=ak@linux.intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=jolsa@redhat.com \
    --cc=joro@8bytes.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome