All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jiri Olsa <jolsa@redhat.com>
To: Vinicius Costa Gomes <vinicius.gomes@intel.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>,
	Arnaldo Carvalho de Melo <acme@kernel.org>,
	Ingo Molnar <mingo@kernel.org>,
	Clark Williams <williams@redhat.com>,
	linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org,
	Arnaldo Carvalho de Melo <acme@redhat.com>,
	David Ahern <dsahern@gmail.com>, Jiri Olsa <jolsa@kernel.org>,
	Namhyung Kim <namhyung@kernel.org>,
	Wang Nan <wangnan0@huawei.com>
Subject: Re: [PATCH 11/11] perf tools: Stop fallbacking to kallsyms for vdso symbols lookup
Date: Sat, 27 Oct 2018 13:05:41 +0200	[thread overview]
Message-ID: <20181027110541.GA25072@krava> (raw)
In-Reply-To: <87a7n070tj.fsf@intel.com>

On Fri, Oct 26, 2018 at 04:19:52PM -0700, Vinicius Costa Gomes wrote:
> Hi,
> 
> Adrian Hunter <adrian.hunter@intel.com> writes:
> 
> > On 18/10/18 1:55 AM, Arnaldo Carvalho de Melo wrote:
> >> From: Arnaldo Carvalho de Melo <acme@redhat.com>
> >> 
> >> David reports that:
> >> 
> >> <quote>
> >> Perf has this hack where it uses the kernel symbol map as a backup when
> >> a symbol can't be found in the user's symbol table(s).
> >
> > I don't think this is a complete fix because it exposes new problems.
> 
> This commit broke function name resolution for 'perf record -g' for me.
> 
> What I mean is, with this commit applied:
> 
> $ ./tools/perf/perf record -g -- sleep 1
> 
> $ ./tools/perf/perf report
> 
> 'perf report' doesn't seem to be able to show the function names of the
> trace.
> 
> If I revert this commit, function names are resolved fine.

that commit just showed up some places where we have the
ip resolve wrong.. would attached patch fix it for you?

jirka


---
diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c
index 111ae858cbcb..72a5b803c797 100644
--- a/tools/perf/util/machine.c
+++ b/tools/perf/util/machine.c
@@ -1824,7 +1824,7 @@ static void ip__resolve_ams(struct thread *thread,
 	 * Thus, we have to try consecutively until we find a match
 	 * or else, the symbol is unknown
 	 */
-	thread__find_cpumode_addr_location(thread, ip, &al);
+	thread__find_cpumode_addr_location(thread, ip, &al, NULL);
 
 	ams->addr = ip;
 	ams->al_addr = al.addr;
@@ -1909,8 +1909,8 @@ static int add_callchain_ip(struct thread *thread,
 
 	al.filtered = 0;
 	al.sym = NULL;
-	if (!cpumode) {
-		thread__find_cpumode_addr_location(thread, ip, &al);
+	if (!cpumode || *cpumode == PERF_RECORD_MISC_CPUMODE_UNKNOWN) {
+		thread__find_cpumode_addr_location(thread, ip, &al, cpumode);
 	} else {
 		if (ip >= PERF_CONTEXT_MAX) {
 			switch (ip) {
@@ -2151,7 +2151,7 @@ static int thread__resolve_callchain_sample(struct thread *thread,
 	struct branch_stack *branch = sample->branch_stack;
 	struct ip_callchain *chain = sample->callchain;
 	int chain_nr = 0;
-	u8 cpumode = PERF_RECORD_MISC_USER;
+	u8 cpumode = PERF_RECORD_MISC_CPUMODE_UNKNOWN;
 	int i, j, err, nr_entries;
 	int skip_idx = -1;
 	int first_call = 0;
diff --git a/tools/perf/util/thread.c b/tools/perf/util/thread.c
index 2048d393ece6..1cd83ecde501 100644
--- a/tools/perf/util/thread.c
+++ b/tools/perf/util/thread.c
@@ -366,7 +366,7 @@ int thread__fork(struct thread *thread, struct thread *parent, u64 timestamp)
 }
 
 void thread__find_cpumode_addr_location(struct thread *thread, u64 addr,
-					struct addr_location *al)
+					struct addr_location *al, u8 *cpumode)
 {
 	size_t i;
 	const u8 cpumodes[] = {
@@ -378,8 +378,11 @@ void thread__find_cpumode_addr_location(struct thread *thread, u64 addr,
 
 	for (i = 0; i < ARRAY_SIZE(cpumodes); i++) {
 		thread__find_symbol(thread, cpumodes[i], addr, al);
-		if (al->map)
+		if (al->map) {
+			if (cpumode)
+				*cpumode = cpumodes[i];
 			break;
+		}
 	}
 }
 
diff --git a/tools/perf/util/thread.h b/tools/perf/util/thread.h
index 07606aa6998d..9aad9a71c943 100644
--- a/tools/perf/util/thread.h
+++ b/tools/perf/util/thread.h
@@ -99,7 +99,7 @@ struct symbol *thread__find_symbol(struct thread *thread, u8 cpumode,
 				   u64 addr, struct addr_location *al);
 
 void thread__find_cpumode_addr_location(struct thread *thread, u64 addr,
-					struct addr_location *al);
+					struct addr_location *al, u8 *cpumode);
 
 static inline void *thread__priv(struct thread *thread)
 {

  reply	other threads:[~2018-10-27 11:05 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-17 22:54 [GIT PULL 00/11] perf/urgent fixes Arnaldo Carvalho de Melo
2018-10-17 22:54 ` Arnaldo Carvalho de Melo
2018-10-17 22:54 ` Arnaldo Carvalho de Melo
2018-10-17 22:54 ` [PATCH 01/11] tools arch uapi: Sync the x86 kvm.h copy Arnaldo Carvalho de Melo
2018-10-17 22:54 ` [PATCH 02/11] tools headers uapi: Sync " Arnaldo Carvalho de Melo
2018-10-17 22:54 ` [PATCH 03/11] Revert "perf tools: Fix PMU term format max value calculation" Arnaldo Carvalho de Melo
2018-10-17 22:54 ` [PATCH 04/11] perf vendor events intel: Fix wrong filter_band* values for uncore events Arnaldo Carvalho de Melo
2018-10-17 22:54 ` [PATCH 05/11] perf evsel: Store ids for events with their own cpus perf_event__synthesize_event_update_cpus Arnaldo Carvalho de Melo
2018-10-17 22:54   ` Arnaldo Carvalho de Melo
2018-10-17 22:54 ` [PATCH 06/11] perf tools: Fix use of alternatives to find JDIR Arnaldo Carvalho de Melo
2018-10-17 22:54 ` [PATCH 07/11] perf tools: Fix tracing_path_mount proper path Arnaldo Carvalho de Melo
2018-10-17 22:54 ` [PATCH 08/11] perf cpu_map: Align cpu map synthesized events properly Arnaldo Carvalho de Melo
2018-10-17 22:54 ` [PATCH 09/11] perf report: Don't crash on invalid inline debug information Arnaldo Carvalho de Melo
2018-10-17 22:55 ` [PATCH 10/11] perf tools: Pass build flags to traceevent build Arnaldo Carvalho de Melo
2018-10-17 22:55 ` [PATCH 11/11] perf tools: Stop fallbacking to kallsyms for vdso symbols lookup Arnaldo Carvalho de Melo
2018-10-18  6:20   ` Adrian Hunter
2018-10-26 23:19     ` Vinicius Costa Gomes
2018-10-27 11:05       ` Jiri Olsa [this message]
2018-10-27 20:09         ` Vinicius Costa Gomes
2018-10-28 21:10           ` Jiri Olsa
2018-10-18  5:44 ` [GIT PULL 00/11] perf/urgent fixes Ingo Molnar
2018-10-18  5:44   ` Ingo Molnar
2018-10-18  5:44   ` Ingo Molnar

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=20181027110541.GA25072@krava \
    --to=jolsa@redhat.com \
    --cc=acme@kernel.org \
    --cc=acme@redhat.com \
    --cc=adrian.hunter@intel.com \
    --cc=dsahern@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=namhyung@kernel.org \
    --cc=vinicius.gomes@intel.com \
    --cc=wangnan0@huawei.com \
    --cc=williams@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.