public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Adrian Hunter <adrian.hunter@intel.com>
To: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Cc: linux-kernel@vger.kernel.org, David Ahern <dsahern@gmail.com>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Jiri Olsa <jolsa@redhat.com>, Mike Galbraith <efault@gmx.de>,
	Namhyung Kim <namhyung@gmail.com>,
	Paul Mackerras <paulus@samba.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Stephane Eranian <eranian@google.com>,
	Ingo Molnar <mingo@kernel.org>
Subject: Re: [PATCH V3 10/10] perf tools: allow annotation using /proc/kcore
Date: Tue, 06 Aug 2013 13:11:53 +0300	[thread overview]
Message-ID: <5200CBE9.9020804@intel.com> (raw)
In-Reply-To: <20130805195927.GA24584@ghostprotocols.net>

On 05/08/13 22:59, Arnaldo Carvalho de Melo wrote:
> Em Fri, Aug 02, 2013 at 01:10:52PM +0300, Adrian Hunter escreveu:
>> Annotation with /proc/kcore is possible so the logic
>> is adjusted to allow it.  The main difference is that
>> /proc/kcore had no symbols so the parsing logic needed
>> a tweak to read jump offsets.
>>
>> The other difference is that objdump cannot always
>> read from kcore.  That seems to be a bug with objdump.
> 
> Was this reported to the objdump guys? Can you ellaborate on the failure
> cases?

Bug is here:

	http://sourceware.org/bugzilla/show_bug.cgi?id=15818

It appears to fail because /proc/kcore has extremely large segments and
objdump seems to be trying to do something with mmap related to those sizes.

Anything in the text segment is ok.  Anything else (e.g. module addresses)
fails.

> 
>> Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
>> ---
>>  tools/perf/builtin-top.c   |  3 ++-
>>  tools/perf/util/annotate.c | 13 +++++++++----
>>  2 files changed, 11 insertions(+), 5 deletions(-)
>>
>> diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
>> index bbf4635..3b19a6b 100644
>> --- a/tools/perf/builtin-top.c
>> +++ b/tools/perf/builtin-top.c
>> @@ -103,7 +103,8 @@ static int perf_top__parse_source(struct perf_top *top, struct hist_entry *he)
>>  	/*
>>  	 * We can't annotate with just /proc/kallsyms
>>  	 */
>> -	if (map->dso->symtab_type == DSO_BINARY_TYPE__KALLSYMS) {
>> +	if (map->dso->symtab_type == DSO_BINARY_TYPE__KALLSYMS &&
>> +	    !dso__is_kcore(map->dso)) {
>>  		pr_err("Can't annotate %s: No vmlinux file was found in the "
>>  		       "path\n", sym->name);
>>  		sleep(1);
>> diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c
>> index d102716..4ab2f11 100644
>> --- a/tools/perf/util/annotate.c
>> +++ b/tools/perf/util/annotate.c
>> @@ -110,10 +110,10 @@ static int jump__parse(struct ins_operands *ops)
>>  {
>>  	const char *s = strchr(ops->raw, '+');
>>  
>> -	ops->target.addr = strtoll(ops->raw, NULL, 16);
>> +	ops->target.addr = strtoull(ops->raw, NULL, 16);
>>  
>>  	if (s++ != NULL)
>> -		ops->target.offset = strtoll(s, NULL, 16);
>> +		ops->target.offset = strtoull(s, NULL, 16);
>>  	else
>>  		ops->target.offset = UINT64_MAX;
>>  
>> @@ -821,6 +821,10 @@ static int symbol__parse_objdump_line(struct symbol *sym, struct map *map,
>>  	if (dl == NULL)
>>  		return -1;
>>  
>> +	if (dl->ops.target.offset == UINT64_MAX)
>> +		dl->ops.target.offset = dl->ops.target.addr -
>> +					map__rip_2objdump(map, sym->start);
>> +
>>  	disasm__add(&notes->src->source, dl);
>>  
>>  	return 0;
>> @@ -864,7 +868,8 @@ fallback:
>>  		free_filename = false;
>>  	}
>>  
>> -	if (dso->symtab_type == DSO_BINARY_TYPE__KALLSYMS) {
>> +	if (dso->symtab_type == DSO_BINARY_TYPE__KALLSYMS &&
>> +	    !dso__is_kcore(dso)) {
>>  		char bf[BUILD_ID_SIZE * 2 + 16] = " with build id ";
>>  		char *build_id_msg = NULL;
>>  
>> @@ -898,7 +903,7 @@ fallback:
>>  	snprintf(command, sizeof(command),
>>  		 "%s %s%s --start-address=0x%016" PRIx64
>>  		 " --stop-address=0x%016" PRIx64
>> -		 " -d %s %s -C %s|grep -v %s|expand",
>> +		 " -d %s %s -C %s 2>/dev/null|grep -v %s|expand",
>>  		 objdump_path ? objdump_path : "objdump",
>>  		 disassembler_style ? "-M " : "",
>>  		 disassembler_style ? disassembler_style : "",
>> -- 
>> 1.7.11.7
> 
> 


      reply	other threads:[~2013-08-06 10:05 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-02 10:10 [PATCH V3 0/10] perf tools: add support for reading object code Adrian Hunter
2013-08-02 10:10 ` [PATCH V3 01/10] perf tools: add test " Adrian Hunter
2013-08-02 10:10 ` [PATCH V3 02/10] perf tools: load kernel maps before using Adrian Hunter
2013-08-02 10:10 ` [PATCH V3 03/10] perf tools: make it possible to read object code from vmlinux Adrian Hunter
2013-08-02 10:10 ` [PATCH V3 04/10] perf tools: adjust the vmlinux symtab matches kallsyms test Adrian Hunter
2013-08-02 10:10 ` [PATCH V3 05/10] perf tools: avoid SyS kernel syscall aliases Adrian Hunter
2013-08-02 10:10 ` [PATCH V3 06/10] perf tools: make it possible to read object code from kernel modules Adrian Hunter
2013-08-02 10:10 ` [PATCH V3 07/10] perf tools: add support for reading from /proc/kcore Adrian Hunter
2013-08-02 10:10 ` [PATCH V3 08/10] perf tools: adjust the vmlinux symtab matches kallsyms test again Adrian Hunter
2013-08-02 10:10 ` [PATCH V3 09/10] perf tools: add kcore to the object code reading test Adrian Hunter
2013-08-02 10:10 ` [PATCH V3 10/10] perf tools: allow annotation using /proc/kcore Adrian Hunter
2013-08-05 19:59   ` Arnaldo Carvalho de Melo
2013-08-06 10:11     ` Adrian Hunter [this message]

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=5200CBE9.9020804@intel.com \
    --to=adrian.hunter@intel.com \
    --cc=acme@ghostprotocols.net \
    --cc=dsahern@gmail.com \
    --cc=efault@gmx.de \
    --cc=eranian@google.com \
    --cc=fweisbec@gmail.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=namhyung@gmail.com \
    --cc=paulus@samba.org \
    --cc=peterz@infradead.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