From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Ian Rogers <irogers@google.com>
Cc: Namhyung Kim <namhyung@kernel.org>,
Ingo Molnar <mingo@kernel.org>,
Thomas Gleixner <tglx@linutronix.de>,
James Clark <james.clark@linaro.org>,
Jiri Olsa <jolsa@kernel.org>,
Adrian Hunter <adrian.hunter@intel.com>,
Clark Williams <williams@redhat.com>,
linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org,
Arnaldo Carvalho de Melo <acme@redhat.com>
Subject: Re: [PATCH 02/12] perf debuginfo: Fetch debuginfo keyed by build ID using debuginfod
Date: Wed, 16 Sep 2026 16:02:10 -0300 [thread overview]
Message-ID: <aqrnssk8iekDb2jC@x2> (raw)
In-Reply-To: <CAP-5=fWr46YKripkCvFHO23k+0SUHfGgYBTDc_qp=ev_Fucc1Q@mail.gmail.com>
On Wed, Sep 16, 2026 at 10:59:31AM -0700, Ian Rogers wrote:
> On Wed, Sep 16, 2026 at 4:48 AM Arnaldo Carvalho de Melo <acme@kernel.org> wrote:
> >
> > perf already uses debuginfod to fetch source files when annotating
> > (via probe-finder.c) and 'perf probe' has open_from_debuginfod(),
> > which queries debuginfo keyed by build ID when a module's debuginfo
> > isn't found locally, largely the same thing this adds; eventually
> > that one could be moved over to the new helper. For the analysis
> > tools there was no way to obtain the debuginfo for a DSO in a
> > profile when it isn't available locally under the name the DSO was
> > opened with, for instance the vmlinux for the kernel a profile was
> > recorded on when processing it on another machine, or after the
> > kernel and its debuginfo package got upgraded in between.
> >
> > Add debuginfo__find_build_id(), that uses the debuginfod client to
> > locate a debuginfo file keyed by the build ID, checking its local
> > cache first and then querying the servers in DEBUGINFOD_URLS, and
> > debuginfo__new_build_id(), that opens the DWARF in the file it finds.
> When do we have a build ID but not a DSO? The current intent is that
Trying to parse this: Before we had a PERF_RECORD_MMAP with a dso name
that we, at the end, when enabled, would look for a build-id to add to
the perf.data headers, now we get both in the PERF_RECORD_MMAP3, right?
> dso__debuginfo hide these complexities. We currently don't purge DSOs
From the cache, right, and that is a problem, we need to do that LRU you
mention, to not have a ever growing cache.
There is a recent patch from someone at Uber about another aspect of
this, the symtabs loaded in memory for resolving symbols are not in any
way constrained, we go on loading, not purging, hope that patch gets
resubmitted addressing the sashiko reviews that were acknowledged.
> and the first call to dso__debuginfo should trigger loading with the
> DSO owning the debuginfo. With this change we now have a duplication
> of DSO's data, keyed by build ID and mapping directly to the
> debuginfo. I can't see a performance or efficiency gain and we could
> potentially implement some kind of LRU mechanism for DSOs, which would
> benefit memory usage for things like perf top.
> > The debuginfod client fails when DEBUGINFOD_URLS isn't set even when
> > what it wants is in its local cache, and the distro setup scripts that
> > populate it from /etc/debuginfod don't reach cron jobs, systemd services
> > and other environments that don't source the profile scripts, so also
> > set it from the .urls files in /etc/debuginfod when not set.
> I found the explanation above hard to follow. Are we setting an
> environment variable because debuginfod isn't respecting its /etc
> setup?
IIRC what I saw was the debuginfod client not finding things in the
cache when that DEBUGINFO_URLS variable wasn't set, so setting it
doesn't mean to ask for downloads necessarily, but to use what is
already cached locally.
> > That has
> > to happen before any thread that can call getenv() is started, as
> > setenv() is not thread safe, and there are getenv()s outside the fetch
> > lock: libdebuginfod reads DEBUGINFOD_URLS in every debuginfod_begin(),
> > which perf also does in build-id.c, probe-event.c and probe-finder.c,
> > so do it from symbol__init(), on the single-threaded setup, and not
> > lazily from the fetch path.
> >
> > Querying servers, possibly third party ones, sends off-box the build
> > IDs of the binaries being analysed and a fetch can take a while, so
> > this is opt-out: on by default, off with --no-debuginfod, with
> > core.debuginfod=false, per tool with report.debuginfod and
> > top.debuginfod, and, since users that set buildid.dir to /dev/null
> > (e.g. Linus) or otherwise turn the local build-id cache off clearly
> > don't want fetched files stored on the box, off too in that case.
> > The opt-outs also cover libdwfl's own debuginfod client, that reads
> > DEBUGINFOD_URLS in every query: when debuginfod is off, be it with
> > --no-debuginfod, core.debuginfod=false or by disabling the build-id
> > cache, the variable is set to the empty string, that the client treats
> > as an opt-out and fails the query without even looking at its cache,
> > instead of being exported from /etc/debuginfod. Tools that manage
> > DEBUGINFOD_URLS themselves, such as 'perf record --debuginfod', keep
> > doing so.
> Libdwfl is part of elfutils and so is debuginfod. Is it possible to
> share clients?
We need to stop using ~/.debug/ and move to have the cache where elfutils
libraries have it.
Transitioning should just use ~/.debug if available but saving copies of
local DSOs like perf does in the elfutils cache directory.
<SNIP>
> > +static bool build_id__equal(const struct build_id *a, const struct build_id *b)
> > +{
> > + return a->size == b->size && memcmp(a->data, b->data, a->size) == 0;
> > +}
>
> This is probably worth moving to the build-id.[ch] file. I see similar
> logic in places like __dso_id__cmp, dso__missing_buildid_cache in
> builitin-buildid-cache.c and sort__dcacheline_cmp. dso__build_id_equal
> has some special backward compatibility checks.
Agreed, will do.
- Arnaldo
next prev parent reply other threads:[~2026-09-16 19:02 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-16 11:47 [PATCH v6 0/12] perf tools: Annotate fixes, stdio progress indication, debuginfo-client in more places Arnaldo Carvalho de Melo
2026-09-16 11:47 ` [PATCH 01/12] perf test: Skip data_type_profiling when the PMU cannot record memory events Arnaldo Carvalho de Melo
2026-09-16 11:47 ` [PATCH 02/12] perf debuginfo: Fetch debuginfo keyed by build ID using debuginfod Arnaldo Carvalho de Melo
2026-09-16 17:59 ` Ian Rogers
2026-09-16 19:02 ` Arnaldo Carvalho de Melo [this message]
2026-09-16 21:28 ` Ian Rogers
2026-09-16 18:42 ` Namhyung Kim
2026-09-16 11:47 ` [PATCH 03/12] perf config: Move perf_config__set_variable() to util/config.c Arnaldo Carvalho de Melo
2026-09-16 11:47 ` [PATCH 04/12] perf debuginfo: Let the user skip and disable debuginfod fetches Arnaldo Carvalho de Melo
2026-09-16 18:53 ` Namhyung Kim
2026-09-16 21:27 ` Arnaldo Carvalho de Melo
2026-09-16 11:47 ` [PATCH 05/12] perf debuginfo: Show the debuginfod fetch progress and keys in the TUI Arnaldo Carvalho de Melo
2026-09-16 11:47 ` [PATCH 06/12] perf symbol: Fall back to fetching the vmlinux by build ID Arnaldo Carvalho de Melo
2026-09-16 11:47 ` [PATCH 07/12] perf annotate-data: Show the sample count in the data-type browser Arnaldo Carvalho de Melo
2026-09-16 21:28 ` Namhyung Kim
2026-09-16 11:47 ` [PATCH 08/12] perf report: Add --progress option Arnaldo Carvalho de Melo
2026-09-16 11:47 ` [PATCH 09/12] perf scripts: Add perf-stuck, to tell where a running perf is stuck Arnaldo Carvalho de Melo
2026-09-16 11:47 ` [PATCH 10/12] perf annotate-data: Resolve type DIEs in the debug file they came from Arnaldo Carvalho de Melo
2026-09-16 21:44 ` Namhyung Kim
2026-09-16 11:47 ` [PATCH 11/12] perf mem record: Request PERF_SAMPLE_CPU by default Arnaldo Carvalho de Melo
2026-09-16 21:50 ` Namhyung Kim
2026-09-16 11:47 ` [PATCH 12/12] perf mem record: Use the IBS swfilt filter when available Arnaldo Carvalho de Melo
2026-09-16 21:59 ` Namhyung Kim
2026-09-16 22:27 ` [PATCH v6 0/12] perf tools: Annotate fixes, stdio progress indication, debuginfo-client in more places Namhyung Kim
2026-09-16 18:32 Arnaldo Carvalho de Melo
2026-09-16 18:32 ` [PATCH 02/12] perf debuginfo: Fetch debuginfo keyed by build ID using debuginfod Arnaldo Carvalho de Melo
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=aqrnssk8iekDb2jC@x2 \
--to=acme@kernel.org \
--cc=acme@redhat.com \
--cc=adrian.hunter@intel.com \
--cc=irogers@google.com \
--cc=james.clark@linaro.org \
--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=tglx@linutronix.de \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®