Linux Perf Users
 help / color / mirror / Atom feed
From: Namhyung Kim <namhyung@kernel.org>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Ian Rogers <irogers@google.com>, Ingo Molnar <mingo@redhat.com>,
	Arnaldo Carvalho de Melo <acme@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Jiri Olsa <jolsa@kernel.org>,
	Adrian Hunter <adrian.hunter@intel.com>,
	James Clark <james.clark@linaro.org>,
	Athira Rajeev <atrajeev@linux.ibm.com>,
	Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Andrii Nakryiko <andrii@kernel.org>,
	Martin KaFai Lau <martin.lau@linux.dev>,
	Eduard Zingerman <eddyz87@gmail.com>, Song Liu <song@kernel.org>,
	Yonghong Song <yonghong.song@linux.dev>,
	Ihor Solodrai <ihor.solodrai@linux.dev>,
	Leo Yan <leo.yan@linux.dev>, Dmitry Vyukov <dvyukov@google.com>,
	"Steinar H . Gunderson" <sesse@google.com>,
	Stephen Brennan <stephen.s.brennan@oracle.com>,
	Thomas Falcon <thomas.falcon@intel.com>,
	linux-perf-users@vger.kernel.org, bpf@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v4 03/19] perf/uapi: Add BUILD_ID_OFFSET sample types to UAPI
Date: Thu, 3 Dec 2026 12:42:27 -0800	[thread overview]
Message-ID: <axHUM7_ucxohw1Q2@google.com> (raw)
In-Reply-To: <20261202103327.GG2883950@noisy.programming.kicks-ass.net>

On Wed, Dec 02, 2026 at 11:33:27AM +0100, Peter Zijlstra wrote:
> On Tue, Dec 01, 2026 at 09:10:49AM -0800, Ian Rogers wrote:
> 
> > > > Which aspect is the main objection here -- the 8-bit/56-bit packing,
> > > > the per-sample deduplication in the kernel, or repeating build IDs per
> > > > sample instead of a sideband mapping?
> > >
> > > Like I just replied; I don't see why we need it at all; we already have
> > > buildid in the mmap sideband data. That is sufficient to reconstruct at
> > > post processing.
> > 
> > The point of having build ID + offset in samples is to avoid needing
> > MMAP2 sideband and /proc synthesis altogether -- with a symbol server /
> > debuginfod, samples carry everything needed to symbolize without
> > tracking every process's address space.
> > 
> > Relying on MMAP2 sideband only gives new mappings; for system-wide
> > profiling, perf still has to crawl /proc/<pid>/maps for every existing
> > task at startup and record every subsequent mmap/fork across the
> > machine, even for processes that are never sampled. On large
> > consolidated servers that overhead is substantial:
> > 
> > - For infrequent system-wide events (e.g. bus lock), synthesizing and
> >   recording all system-wide mmaps dwarfs the cost and size of the
> >   actual samples.
> > - Even for high-frequency events like cycles, on a large server with
> >   lots of consolidated work we see over half of perf.data consisting of
> >   mmap events, and that share keeps growing as more work (including
> >   guest VMs / containers) is consolidated onto larger machines.
> > - On a loaded machine, just allocating the procfs inodes to scan
> >   /proc/<pid>/maps at perf startup can trigger memory reclaim and
> >   latency spikes -- worst when you are profiling a machine because it
> >   is already under stress.
> > 
> > So build ID + offset samples make sense today for infrequent
> > system-wide events (like bus lock) and for profiling machines under
> > stress without an upfront synthesis storm (reusing the kernel's
> > existing stack_map_get_build_id_offset() helper via defer_callchain).
> > 
> > Longer term, for general profiling this also lets us optimize sideband
> > overhead by running two events -- one with build ID + offset and one
> > with raw virtual addresses -- starting with build-ID samples while
> > lazily synthesizing mappings in the background, then switching over to
> > compact virtual-address samples once mappings are ready.
> > 
> > Given those use cases, is your objection specifically to the packed
> > table encoding in v4 (where a simpler UAPI layout could work), or to
> > having build-ID + offset samples in perf at all?
> 
> Bah. So realistically buildid *never* changes vs the frequency of
> samples. Adding buildid into samples is utterly insane from that
> perspective.
> 
> Additionally, the whole buildid thing is an utter shitshow when trying
> to do it from sample context.
> 
> So I really don't want buildid from sample context. It doesn't make
> sense on so many levels.

Right, that's why this patchset tries to do it in the deferred context.

Having build-id in sample may be inefficient, agreed.  But it could open
new opportunities too.  I'm thinking of paravirt KVM profiling where
guest samples come with build-ID.  Of course there will be many other
issues but I think this could help much.

> 
> I would much rather invest in better means of doing that initial setup.
> Eg. would it help to have UNMAP events for executable mappings (that
> contain the buildid of what was)?

I'm not sure..  but it won't be useful for long running processes not
calling munmap.

Thanks,
Namhyung


  reply	other threads:[~2026-12-03 20:42 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-25  0:50 [PATCH v4 00/19] perf/core, perf/tools: Add PERF_SAMPLE_BUILD_ID_OFFSET support Ian Rogers
2026-11-25  0:50 ` [PATCH v4 01/19] perf/core: Protect per-CPU callchain buffer across bpf_overflow_handler() Ian Rogers
2026-11-25  0:50 ` [PATCH v4 02/19] perf/uapi: Factor perf_build_id out into its own top-level struct Ian Rogers
2026-11-25 13:17   ` Peter Zijlstra
2026-11-30 19:34     ` Ian Rogers
2026-11-25  0:50 ` [PATCH v4 03/19] perf/uapi: Add BUILD_ID_OFFSET sample types to UAPI Ian Rogers
2026-11-25 13:25   ` Peter Zijlstra
2026-11-25 21:45     ` Namhyung Kim
2026-11-30 19:38       ` Ian Rogers
2026-12-01  8:14         ` Peter Zijlstra
2026-12-01 17:10           ` Ian Rogers
2026-12-02 10:33             ` Peter Zijlstra
2026-12-03 20:42               ` Namhyung Kim [this message]
2026-12-02 12:43             ` Peter Zijlstra
2026-12-01  8:10       ` Peter Zijlstra
2026-11-25  0:50 ` [PATCH v4 04/19] bpf: Export stack_map_get_build_id_offset() for perf events Ian Rogers
2026-11-25  0:50 ` [PATCH v4 05/19] perf/core: Implement BUILD_ID_OFFSET and CALLCHAIN_BUILD_ID_OFFSET sample types Ian Rogers
2026-11-25  1:19   ` sashiko-bot
2026-11-25  0:50 ` [PATCH v4 06/19] perf/core: Support deferred unwinding for BUILD_ID_OFFSET " Ian Rogers
2026-11-25  0:50 ` [PATCH v4 07/19] perf inject: Set ordered_events and ordering_requires_timestamps for --aslr Ian Rogers
2026-11-25  0:50 ` [PATCH v4 08/19] perf session: Avoid double byte-swapping re-parsed deferred samples Ian Rogers
2026-11-25  1:12   ` sashiko-bot
2026-11-25  0:50 ` [PATCH v4 09/19] perf inject: Fix PERF_SAMPLE_READ layout and bounds checks in aslr_tool__process_sample() Ian Rogers
2026-11-25  0:50 ` [PATCH v4 10/19] tools headers UAPI: Sync linux/perf_event.h for struct perf_build_id Ian Rogers
2026-11-25  0:51 ` [PATCH v4 11/19] tools headers UAPI: Sync linux/perf_event.h for BUILD_ID_OFFSET Ian Rogers
2026-11-25  0:51 ` [PATCH v4 12/19] perf: Refactor thread map and symbol APIs to take perf_sample Ian Rogers
2026-11-25  0:51 ` [PATCH v4 13/19] perf maps: Add dsos__find_by_build_id() and maps__find_by_build_id() Ian Rogers
2026-11-25  0:51 ` [PATCH v4 14/19] perf evsel: Parse, synthesize, and dump BUILD_ID_OFFSET sample types Ian Rogers
2026-11-25  0:51 ` [PATCH v4 15/19] perf symbol: Resolve symbols and callchains using build ID and offset Ian Rogers
2026-11-25  0:51 ` [PATCH v4 16/19] perf inject: Add --sample-buildids to convert samples to build ID + offset Ian Rogers
2026-11-25  1:18   ` sashiko-bot
2026-11-25  0:51 ` [PATCH v4 17/19] perf record: Add --buildid-offset option Ian Rogers
2026-11-25  1:19   ` sashiko-bot
2026-11-25  0:51 ` [PATCH v4 18/19] perf test: Add BUILD_ID_OFFSET C unit tests Ian Rogers
2026-11-25  0:51 ` [PATCH v4 19/19] perf test: Add inject --sample-buildids and record --buildid-offset shell tests Ian Rogers
2026-11-25  1:19 ` [PATCH v4 00/19] perf/core, perf/tools: Add PERF_SAMPLE_BUILD_ID_OFFSET support sashiko-bot

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=axHUM7_ucxohw1Q2@google.com \
    --to=namhyung@kernel.org \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=atrajeev@linux.ibm.com \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=dvyukov@google.com \
    --cc=eddyz87@gmail.com \
    --cc=ihor.solodrai@linux.dev \
    --cc=irogers@google.com \
    --cc=james.clark@linaro.org \
    --cc=jolsa@kernel.org \
    --cc=leo.yan@linux.dev \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=martin.lau@linux.dev \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=sesse@google.com \
    --cc=song@kernel.org \
    --cc=stephen.s.brennan@oracle.com \
    --cc=thomas.falcon@intel.com \
    --cc=yonghong.song@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox