All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "James Clark" <james.clark@linaro.org>
Cc: linux-perf-users@vger.kernel.org
Subject: Re: [PATCH 07/34] perf build-id: Cache the vDSO in build ID mmap mode
Date: Wed, 18 Nov 2026 17:03:52 +0000	[thread overview]
Message-ID: <sashiko-outbox-221576@kernel.org> (raw)
In-Reply-To: <20261118-james-coresight-jit-v1-7-dad4d90747f6@linaro.org>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] perf build-id: dso__cache_build_id() fails to cache vDSO for
  synthesized mmaps
--

commit affc6379bdb9537b483a873cee2efe3e5b3ce5dd
Author: James Clark <james.clark@linaro.org>

perf build-id: Cache the vDSO in build ID mmap mode

This commit reads the host vDSO build ID from perf's temporary copy of the
vDSO in dso__cache_build_id() when the DSO lacks a build ID, so that the
vDSO can be added to the build ID cache in --buildid-mmap mode.

> diff --git a/tools/perf/util/build-id.c b/tools/perf/util/build-id.c
> index 02233ef0eafff..cc813f421c9b2 100644
> --- a/tools/perf/util/build-id.c
> +++ b/tools/perf/util/build-id.c
> @@ -886,6 +886,18 @@ static int dso__cache_build_id(struct dso *dso, struct machine *machine,
>  	char *allocated_name = NULL;
>  	int ret = 0;
>  
> +	/*
> +	 * The kernel can't add the vDSO's build ID to mmap events because it
> +	 * doesn't have a file, so read it from the copy that perf made. That
> +	 * copy is of the host's vDSO, so it can't be used for guests.
> +	 */
> +	if (is_vdso && machine__is_host(machine) && !dso__has_build_id(dso)) {
> +		struct build_id bid = { .size = 0, };
> +
> +		if (filename__read_build_id(name, &bid) > 0)
> +			dso__set_build_id(dso, &bid);
> +	}
> +
>  	if (!dso__has_build_id(dso) || !dso__hit(dso))
>  		return 0;

[Severity: Medium]
Does filename__read_build_id(name, &bid) still fail when perf record
synthesizes mmap2 events from /proc (for example with -a or -p)?

In --buildid-mmap mode, perf_event__synthesize_mmap_events() calls
perf_record_mmap2__read_build_id() for the "[vdso]" mapping, which inserts
a DSO with short_name and long_name set to "[vdso]" and no build ID:

tools/perf/util/synthetic-events.c:perf_record_mmap2__read_build_id() {
	...
	dso = dsos__findnew_id(&machine->dsos, event->filename, &dso_id);
	...
	rc = filename__read_build_id(event->filename, &bid) > 0 ? 0 : -1;
	...
}

When process_buildids() later processes the mmap2 event, map__new() calls
machine__findnew_vdso(), which finds that existing "[vdso]" DSO in
machine->dsos via machine__find_vdso() and returns early before calling
get_file(&vdso_info->vdso) to create the temporary vDSO file:

tools/perf/util/vdso.c:machine__findnew_vdso() {
	...
	dso = machine__find_vdso(machine, thread);
	if (dso)
		return dso;
	...
	file = get_file(&vdso_info->vdso);
	if (!file)
		return NULL;

	return __machine__addnew_vdso(machine, DSO__NAME_VDSO, file);
}

As a result, name (dso__long_name(dso)) is still "[vdso]" when
dso__cache_build_id() runs, so filename__read_build_id() fails and the
vDSO remains uncached.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261118-james-coresight-jit-v1-0-dad4d90747f6@linaro.org?part=7

  reply	other threads:[~2026-11-18 17:03 UTC|newest]

Thread overview: 70+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-18 16:29 [PATCH 00/34] perf cs-etm: JIT decoding support James Clark
2026-11-18 16:29 ` [PATCH 01/34] perf jit: Support JITDUMP_USE_ARCH_TIMESTAMP on arm64 James Clark
2026-11-18 16:40   ` sashiko-bot
2026-11-18 16:29 ` [PATCH 02/34] perf jit: Add name of clock in error message James Clark
2026-11-18 16:32   ` sashiko-bot
2026-11-18 16:29 ` [PATCH 03/34] perf jit: Add address ranges to DWARF compilation units James Clark
2026-11-18 16:34   ` sashiko-bot
2026-11-18 16:29 ` [PATCH 04/34] perf libdw: Don't look up the module by ELF address James Clark
2026-11-18 16:36   ` sashiko-bot
2026-11-18 16:29 ` [PATCH 05/34] perf cs-etm: Use the exception level to tell kernel from user James Clark
2026-11-18 16:47   ` sashiko-bot
2026-11-18 16:29 ` [PATCH 06/34] perf cs-etm: Don't read past the end of the map James Clark
2026-11-18 17:11   ` sashiko-bot
2026-11-18 16:29 ` [PATCH 07/34] perf build-id: Cache the vDSO in build ID mmap mode James Clark
2026-11-18 17:03   ` sashiko-bot [this message]
2026-11-18 16:29 ` [PATCH 08/34] perf cs-etm: arm-spe: Use arch timestamp in HW tracers James Clark
2026-11-18 16:42   ` sashiko-bot
2026-11-18 16:29 ` [PATCH 09/34] perf cs-etm: arm-spe: Report error if default clock isn't used James Clark
2026-11-18 16:35   ` sashiko-bot
2026-11-18 16:29 ` [PATCH 10/34] perf cs-etm: Remove old pipe mode support James Clark
2026-11-18 16:44   ` sashiko-bot
2026-11-18 16:29 ` [PATCH 11/34] perf cs-etm: Track threads in timeless mode James Clark
2026-11-18 16:35   ` sashiko-bot
2026-11-18 16:29 ` [PATCH 12/34] perf cs-etm: Track sched out events James Clark
2026-11-18 16:40   ` sashiko-bot
2026-11-18 16:29 ` [PATCH 13/34] perf cs-etm: Handle PERF_RECORD_SWITCH events James Clark
2026-11-18 16:36   ` sashiko-bot
2026-11-18 16:29 ` [PATCH 14/34] perf cs-etm: Always enable Perf event timestamps James Clark
2026-11-18 16:40   ` sashiko-bot
2026-11-18 16:29 ` [PATCH 15/34] perf cs-etm: Use time from Perf samples James Clark
2026-11-18 16:51   ` sashiko-bot
2026-11-18 16:29 ` [PATCH 16/34] perf cs-etm: Don't buffer non-timestamped packets James Clark
2026-11-18 16:43   ` sashiko-bot
2026-11-18 16:29 ` [PATCH 17/34] perf cs-etm: Decode in order of Perf samples James Clark
2026-11-18 17:10   ` sashiko-bot
2026-11-18 16:29 ` [PATCH 18/34] perf cs-etm: Don't special case per-thread mode James Clark
2026-11-18 16:40   ` sashiko-bot
2026-11-18 16:29 ` [PATCH 19/34] perf cs-etm: Decode one packet at a time and don't estimate timestamps James Clark
2026-11-18 16:39   ` sashiko-bot
2026-11-18 16:29 ` [PATCH 20/34] perf cs-etm: Remove the decoded packet ring buffer James Clark
2026-11-18 16:46   ` sashiko-bot
2026-11-18 16:29 ` [PATCH 21/34] perf cs-etm: Fold packet state into the trace ID queue James Clark
2026-11-18 16:40   ` sashiko-bot
2026-11-18 16:29 ` [PATCH 22/34] perf cs-etm: Rename trace ID queues to trace ID contexts James Clark
2026-11-18 16:40   ` sashiko-bot
2026-11-18 16:29 ` [PATCH 23/34] perf cs-etm: Rename tidq variables to tidc James Clark
2026-11-18 16:49   ` sashiko-bot
2026-11-18 16:29 ` [PATCH 24/34] perf cs-etm: Share the thread ctxt between frontend and backend James Clark
2026-11-18 16:47   ` sashiko-bot
2026-11-18 16:29 ` [PATCH 25/34] perf cs-etm: Consume each OpenCSD packet immediately James Clark
2026-11-18 16:44   ` sashiko-bot
2026-11-18 16:29 ` [PATCH 26/34] perf cs-etm: Split base and packet decoder state James Clark
2026-11-18 16:42   ` sashiko-bot
2026-11-18 16:29 ` [PATCH 27/34] perf cs-etm: Add packet-only timestamp decoder ops James Clark
2026-11-18 16:42   ` sashiko-bot
2026-11-18 16:29 ` [PATCH 28/34] perf cs-etm: Create timestamp decoders James Clark
2026-11-18 16:48   ` sashiko-bot
2026-11-18 16:29 ` [PATCH 29/34] perf cs-etm: Find timestamps by searching ahead James Clark
2026-11-18 17:01   ` sashiko-bot
2026-11-18 16:29 ` [PATCH 30/34] perf cs-etm: Invalidate OpenCSD's cache on MMAPs James Clark
2026-11-18 16:45   ` sashiko-bot
2026-11-18 16:29 ` [PATCH 31/34] perf test cs-etm: Add a Java JIT source-line test James Clark
2026-11-18 17:11   ` sashiko-bot
2026-11-18 16:29 ` [PATCH 32/34] perf test cs-etm: Test trace is ordered with context switch records James Clark
2026-11-18 16:49   ` sashiko-bot
2026-11-18 16:29 ` [PATCH 33/34] perf test cs-etm: Test decoding of kernel modules James Clark
2026-11-18 16:57   ` sashiko-bot
2026-11-18 16:29 ` [PATCH 34/34] perf test cs-etm: Add an HHVM JIT call stack test James Clark
2026-11-18 17:01   ` sashiko-bot
2026-11-18 16:33 ` [PATCH 00/34] perf cs-etm: JIT decoding support James Clark

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=sashiko-outbox-221576@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=james.clark@linaro.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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.