linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Hekuang <hekuang@huawei.com>
To: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: <peterz@infradead.org>, <mingo@redhat.com>,
	<alexander.shishkin@linux.intel.com>, <jolsa@redhat.com>,
	<wangnan0@huawei.com>, <jpoimboe@redhat.com>,
	<ak@linux.intel.com>, <eranian@google.com>, <namhyung@kernel.org>,
	<adrian.hunter@intel.com>, <sukadev@linux.vnet.ibm.com>,
	<masami.hiramatsu.pt@hitachi.com>, <tumanova@linux.vnet.ibm.com>,
	<kan.liang@intel.com>, <penberg@kernel.org>, <dsahern@gmail.com>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2 2/9] perf script: Add options for custom vdso path
Date: Wed, 11 May 2016 09:33:31 +0800	[thread overview]
Message-ID: <57328BEB.60608@huawei.com> (raw)
In-Reply-To: <20160510134426.GF13209@kernel.org>



在 2016/5/10 21:44, Arnaldo Carvalho de Melo 写道:
> Em Tue, May 10, 2016 at 07:40:30AM +0000, He Kuang escreveu:
>> When unwinding callchains on a different machine, vdso info should be
>> provided so the unwind process won't be interrupted if address falls
>> into vdso region.
>>
>> Currently, perf does try to read vdso binary in '.debug' folder, but
>> the filename of the vdso file is generated randomly based on
>> VDSO__TEMP_FILE_NAME template, such a filename is not reliable and
>> users need a way to provide the path of their own vdso binary file.
> But this becomes one more burden to the user :-\ Why not calculate a
> build-id from the VDSO file contents, copy it to
> ~/.debug/.build-id/ab/cdef01020304 and insert that into the perf.data
> file so that at analysis time we do all this automatically?
>
> We can of course have a way to manually provide it, but having it as the
> main way for users doesn't seem a good interface. Am I missing
> something?
>
> - Arnaldo

OK, I'll try as you suggested!
>   
>> Signed-off-by: He Kuang <hekuang@huawei.com>
>> ---
>>   tools/perf/builtin-script.c | 2 ++
>>   tools/perf/util/dso.c       | 7 +++++++
>>   tools/perf/util/dso.h       | 1 +
>>   tools/perf/util/symbol.c    | 1 +
>>   tools/perf/util/symbol.h    | 1 +
>>   5 files changed, 12 insertions(+)
>>
>> diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
>> index 8f6ab2a..c88b547 100644
>> --- a/tools/perf/builtin-script.c
>> +++ b/tools/perf/builtin-script.c
>> @@ -2001,6 +2001,8 @@ int cmd_script(int argc, const char **argv, const char *prefix __maybe_unused)
>>   		   "file", "vmlinux pathname"),
>>   	OPT_STRING(0, "kallsyms", &symbol_conf.kallsyms_name,
>>   		   "file", "kallsyms pathname"),
>> +	OPT_STRING(0, "vdso", &symbol_conf.vdso_name,
>> +		   "file", "vdso pathname"),
>>   	OPT_BOOLEAN('G', "hide-call-graph", &no_callchain,
>>   		    "When printing symbols do not display call chain"),
>>   	OPT_STRING(0, "symfs", &symbol_conf.symfs, "directory",
>> diff --git a/tools/perf/util/dso.c b/tools/perf/util/dso.c
>> index 8e639543..6ed1cce 100644
>> --- a/tools/perf/util/dso.c
>> +++ b/tools/perf/util/dso.c
>> @@ -13,6 +13,7 @@ char dso__symtab_origin(const struct dso *dso)
>>   	static const char origin[] = {
>>   		[DSO_BINARY_TYPE__KALLSYMS]			= 'k',
>>   		[DSO_BINARY_TYPE__VMLINUX]			= 'v',
>> +		[DSO_BINARY_TYPE__VDSO]				= 'D',
>>   		[DSO_BINARY_TYPE__JAVA_JIT]			= 'j',
>>   		[DSO_BINARY_TYPE__DEBUGLINK]			= 'l',
>>   		[DSO_BINARY_TYPE__BUILD_ID_CACHE]		= 'B',
>> @@ -113,6 +114,11 @@ int dso__read_binary_type_filename(const struct dso *dso,
>>   			 build_id_hex, build_id_hex + 2);
>>   		break;
>>   
>> +	case DSO_BINARY_TYPE__VDSO:
>> +	{
>> +		snprintf(filename, size, "%s", symbol_conf.vdso_name);
>> +		break;
>> +	}
>>   	case DSO_BINARY_TYPE__VMLINUX:
>>   	case DSO_BINARY_TYPE__GUEST_VMLINUX:
>>   	case DSO_BINARY_TYPE__SYSTEM_PATH_DSO:
>> @@ -487,6 +493,7 @@ static void try_to_open_dso(struct dso *dso, struct machine *machine)
>>   	enum dso_binary_type binary_type_data[] = {
>>   		DSO_BINARY_TYPE__BUILD_ID_CACHE,
>>   		DSO_BINARY_TYPE__SYSTEM_PATH_DSO,
>> +		DSO_BINARY_TYPE__VDSO,
>>   		DSO_BINARY_TYPE__NOT_FOUND,
>>   	};
>>   	int i = 0;
>> diff --git a/tools/perf/util/dso.h b/tools/perf/util/dso.h
>> index 0953280..05fac98 100644
>> --- a/tools/perf/util/dso.h
>> +++ b/tools/perf/util/dso.h
>> @@ -30,6 +30,7 @@ enum dso_binary_type {
>>   	DSO_BINARY_TYPE__KCORE,
>>   	DSO_BINARY_TYPE__GUEST_KCORE,
>>   	DSO_BINARY_TYPE__OPENEMBEDDED_DEBUGINFO,
>> +	DSO_BINARY_TYPE__VDSO,
>>   	DSO_BINARY_TYPE__NOT_FOUND,
>>   };
>>   
>> diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
>> index e7588dc..4630751 100644
>> --- a/tools/perf/util/symbol.c
>> +++ b/tools/perf/util/symbol.c
>> @@ -1363,6 +1363,7 @@ static bool dso__is_compatible_symtab_type(struct dso *dso, bool kmod,
>>   	case DSO_BINARY_TYPE__UBUNTU_DEBUGINFO:
>>   	case DSO_BINARY_TYPE__BUILDID_DEBUGINFO:
>>   	case DSO_BINARY_TYPE__OPENEMBEDDED_DEBUGINFO:
>> +	case DSO_BINARY_TYPE__VDSO:
>>   		return !kmod && dso->kernel == DSO_TYPE_USER;
>>   
>>   	case DSO_BINARY_TYPE__KALLSYMS:
>> diff --git a/tools/perf/util/symbol.h b/tools/perf/util/symbol.h
>> index c8b7544..4e6910e 100644
>> --- a/tools/perf/util/symbol.h
>> +++ b/tools/perf/util/symbol.h
>> @@ -114,6 +114,7 @@ struct symbol_conf {
>>   			report_hierarchy;
>>   	const char	*vmlinux_name,
>>   			*kallsyms_name,
>> +			*vdso_name,
>>   			*source_prefix,
>>   			*field_sep;
>>   	const char	*default_guest_vmlinux_name,
>> -- 
>> 1.8.5.2

  reply	other threads:[~2016-05-11  1:35 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-10  7:40 [PATCH v2 0/9] Add support for remote unwind He Kuang
2016-05-10  7:40 ` [PATCH v2 1/9] perf tools: Omit DWARF judgement when recording dwarf callchain He Kuang
2016-05-10 13:45   ` Arnaldo Carvalho de Melo
2016-05-10  7:40 ` [PATCH v2 2/9] perf script: Add options for custom vdso path He Kuang
2016-05-10 13:44   ` Arnaldo Carvalho de Melo
2016-05-11  1:33     ` Hekuang [this message]
2016-05-10  7:40 ` [PATCH v2 3/9] perf build: Add build-test for libunwind cross-platforms support He Kuang
2016-05-11 11:52   ` Jiri Olsa
2016-05-11 13:24     ` Arnaldo Carvalho de Melo
2016-05-12 10:23   ` [tip:perf/core] " tip-bot for He Kuang
2016-05-10  7:40 ` [PATCH v2 4/9] perf build: Add build-test for debug-frame on arm/arm64 He Kuang
2016-05-11 11:58   ` Jiri Olsa
2016-05-11 13:24     ` Arnaldo Carvalho de Melo
2016-05-12 10:24   ` [tip:perf/core] " tip-bot for He Kuang
2016-05-10  7:40 ` [PATCH v2 5/9] perf tools: Add methods to test dso is 64-bit or 32-bit He Kuang
2016-05-10  8:08   ` Adrian Hunter
2016-05-10  9:49     ` Hekuang
2016-05-10 10:34       ` Adrian Hunter
2016-05-10 11:38         ` Hekuang
2016-05-10 11:59           ` Adrian Hunter
2016-05-10 12:29             ` Hekuang
2016-05-10  7:40 ` [PATCH v2 6/9] perf tools: Promote proper messages for cross-platform unwind He Kuang
2016-05-10  7:40 ` [PATCH v2 7/9] perf callchain: Add support " He Kuang
2016-05-10  7:40 ` [PATCH v2 8/9] perf callchain: Support x86 target platform He Kuang
2016-05-10  7:40 ` [PATCH v2 9/9] perf callchain: Support aarch64 cross-platform He Kuang

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=57328BEB.60608@huawei.com \
    --to=hekuang@huawei.com \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=ak@linux.intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=dsahern@gmail.com \
    --cc=eranian@google.com \
    --cc=jolsa@redhat.com \
    --cc=jpoimboe@redhat.com \
    --cc=kan.liang@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=masami.hiramatsu.pt@hitachi.com \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=penberg@kernel.org \
    --cc=peterz@infradead.org \
    --cc=sukadev@linux.vnet.ibm.com \
    --cc=tumanova@linux.vnet.ibm.com \
    --cc=wangnan0@huawei.com \
    /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;
as well as URLs for NNTP newsgroup(s).