All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] perf annotate: Work with vmlinux outside symfs
@ 2022-11-25 11:42 Vincent Whitchurch
  2023-06-16 10:21 ` Vincent Whitchurch
  0 siblings, 1 reply; 3+ messages in thread
From: Vincent Whitchurch @ 2022-11-25 11:42 UTC (permalink / raw)
  To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo
  Cc: kernel, Vincent Whitchurch, Mark Rutland, Alexander Shishkin,
	Jiri Olsa, Namhyung Kim, linux-perf-users, linux-kernel

It is currently possible to use --symfs along with a vmlinux which lies
outside of the symfs by passing an absolute path to --vmlinux, thanks to
the check in dso__load_vmlinux() which handles this explicitly.

However, the annotate code lacks this check and thus perf annotate does
not work ("Internal error: Invalid -1 error code") for kernel functions
with this combination.  Add the missing handling.

Signed-off-by: Vincent Whitchurch <vincent.whitchurch@axis.com>
---
 tools/perf/util/annotate.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c
index db475e44f42f..52bdec764545 100644
--- a/tools/perf/util/annotate.c
+++ b/tools/perf/util/annotate.c
@@ -1695,7 +1695,11 @@ static int dso__disassemble_filename(struct dso *dso, char *filename, size_t fil
 		 * cache, or is just a kallsyms file, well, lets hope that this
 		 * DSO is the same as when 'perf record' ran.
 		 */
-		__symbol__join_symfs(filename, filename_size, dso->long_name);
+		if (dso->kernel && dso->long_name[0] == '/')
+			snprintf(filename, filename_size,
+				 "%s", dso->long_name);
+		else
+			__symbol__join_symfs(filename, filename_size, dso->long_name);
 
 		mutex_lock(&dso->lock);
 		if (access(filename, R_OK) && errno == ENOENT && dso->nsinfo) {
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] perf annotate: Work with vmlinux outside symfs
  2022-11-25 11:42 [PATCH] perf annotate: Work with vmlinux outside symfs Vincent Whitchurch
@ 2023-06-16 10:21 ` Vincent Whitchurch
  2023-06-16 13:05   ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 3+ messages in thread
From: Vincent Whitchurch @ 2023-06-16 10:21 UTC (permalink / raw)
  To: peterz@infradead.org, mingo@redhat.com, acme@kernel.org
  Cc: jolsa@kernel.org, namhyung@kernel.org,
	linux-perf-users@vger.kernel.org, mark.rutland@arm.com, kernel,
	alexander.shishkin@linux.intel.com, linux-kernel@vger.kernel.org

On Fri, 2022-11-25 at 12:42 +0100, Vincent Whitchurch wrote:
> It is currently possible to use --symfs along with a vmlinux which lies
> outside of the symfs by passing an absolute path to --vmlinux, thanks to
> the check in dso__load_vmlinux() which handles this explicitly.
> 
> However, the annotate code lacks this check and thus perf annotate does
> not work ("Internal error: Invalid -1 error code") for kernel functions
> with this combination.  Add the missing handling.
> 
> Signed-off-by: Vincent Whitchurch <vincent.whitchurch@axis.com>

This patch was not merged and I did not receive any comments on it
either.  Should I resend it?  It still applies cleanly to current
mainline.  Thanks.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] perf annotate: Work with vmlinux outside symfs
  2023-06-16 10:21 ` Vincent Whitchurch
@ 2023-06-16 13:05   ` Arnaldo Carvalho de Melo
  0 siblings, 0 replies; 3+ messages in thread
From: Arnaldo Carvalho de Melo @ 2023-06-16 13:05 UTC (permalink / raw)
  To: Vincent Whitchurch
  Cc: peterz@infradead.org, mingo@redhat.com, jolsa@kernel.org,
	namhyung@kernel.org, linux-perf-users@vger.kernel.org,
	mark.rutland@arm.com, kernel, alexander.shishkin@linux.intel.com,
	linux-kernel@vger.kernel.org

Em Fri, Jun 16, 2023 at 10:21:52AM +0000, Vincent Whitchurch escreveu:
> On Fri, 2022-11-25 at 12:42 +0100, Vincent Whitchurch wrote:
> > It is currently possible to use --symfs along with a vmlinux which lies
> > outside of the symfs by passing an absolute path to --vmlinux, thanks to
> > the check in dso__load_vmlinux() which handles this explicitly.
> > 
> > However, the annotate code lacks this check and thus perf annotate does
> > not work ("Internal error: Invalid -1 error code") for kernel functions
> > with this combination.  Add the missing handling.
> > 
> > Signed-off-by: Vincent Whitchurch <vincent.whitchurch@axis.com>
> 
> This patch was not merged and I did not receive any comments on it
> either.  Should I resend it?  It still applies cleanly to current
> mainline.  Thanks.

Thanks for the ping, I checked  dso__load_vmlinux() and it has:

        if (vmlinux[0] == '/')
                snprintf(symfs_vmlinux, sizeof(symfs_vmlinux), "%s", vmlinux);
        else
                symbol__join_symfs(symfs_vmlinux, vmlinux)

Exactly as you pointed out, applied.

- Arnaldo

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-06-16 13:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-25 11:42 [PATCH] perf annotate: Work with vmlinux outside symfs Vincent Whitchurch
2023-06-16 10:21 ` Vincent Whitchurch
2023-06-16 13:05   ` Arnaldo Carvalho de Melo

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.