From: Namhyung Kim <namhyung@kernel.org>
To: Alireza Haghdoost <haghdoost@uber.com>
Cc: Peter Zijlstra <peterz@infradead.org>,
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>, Ian Rogers <irogers@google.com>,
Adrian Hunter <adrian.hunter@intel.com>,
James Clark <james.clark@linaro.org>,
Alexei Starovoitov <ast@kernel.org>,
Andrii Nakryiko <andriin@fb.com>,
linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v5 2/5] perf dso: Allow reading DSO data from an explicit file
Date: Sun, 18 Oct 2026 09:26:36 -0700 [thread overview]
Message-ID: <atTzPJJvR2-sqtJn@google.com> (raw)
In-Reply-To: <CA+w=M=TtAfiHVQqiwmchtsWwNeN5So5MxWW=82RRAUXHhg8D+A@mail.gmail.com>
Hello Alireza,
On Sun, Oct 18, 2026 at 08:09:41AM -0700, Alireza Haghdoost wrote:
> Hi Namhyung,
>
> Sorry for the late reply, and thank you for the clarification.
>
> On Wed, Oct 7, 2026 at 3:09 PM Namhyung Kim <namhyung@kernel.org> wrote:
> > I'm afraid it may confuse perf annotate where it needs to read binary
> > data from a file as well as lazy-load symbols from another. I'm working
> > on cleaning up the relevant code and I'm reluctant to add 'path' to the
> > dso. We have too many names for a DSO already. :)
> >
> > For a short term solution, I'm afraid you need to use dso__get_filename()
> > with symtab_type and read the file without using the data cache API.
>
> I understand the concern about storing this path in the DSO. Perf
> annotate and the lazy loader can read different files. I will drop this
> patch in the next revision (v6).
>
> For context, the v1 lazy loader kept one file descriptor open for each
> DSO. In your v1 review, you asked me to use dso__data_read_offset().
> This let the data cache control the open descriptors and close them
> when necessary.
>
> Using dso__data_read_offset() also showed a problem with split
> debuginfo. The symbol name offsets refer to the symbol table file.
> However, the data cache opens the runtime binary. The same offset in
> these two files can contain different data. That is why I needed to
> tell the data cache to open the symbol table file.
>
> I put this support in a separate patch after your v2 review requested
> that I split the exact-path DSO data-cache support into an independent
> split-debuginfo fix.
>
> For v6 revision, the lazy loader will call dso__get_filename() with the symtab
> type. It will open the returned file, read the names with pread(), and
> close the file. Thus, it will not keep one descriptor open for each
> DSO. It will also not change the existing data cache.
>
> This short-term solution can open the same file many times. It also
> cannot use one DSO cache entry for nearby names. However, later reads
> can usually use data that is still in the kernel page cache and avoid
> storage I/O. Therefore, the main additional costs are the open, close,
> and pread system calls.
>
> The performance cost is small in the test profile. Eager loading takes
> 3.2 seconds. v5 lazy loading takes 1.4 seconds. v6 lazy loading takes
> 1.5 seconds. All three produce identical output.
Thanks for checking this!
>
> > In the long term, I think it needs to pass a binary type arguments to
> > read data from the dso. It'd clarify what users want to read and
> > support different files at the same time.
>
> Ack. Your recent cleanup keeps the binary type separate from the symtab
> type during symbol loading. The DSO also has a separate debug-info type.
> These fields identify the files that a caller wants to read. The data
> cache does not use this information yet.
>
> Unless you are already working on this part, I can send a separate
> series to make the data cache type-aware. The series will add a type
> argument to the read API and keep separate cache state for each backing
> file. I can then change the lazy loader to use the data cache again. I
> will keep this work separate from the lazy loader patch series.
Sounds good. Please go ahead!
Thanks,
Namhyung
next prev parent reply other threads:[~2026-10-18 16:26 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-05 17:30 [PATCH v5 0/5] perf script: Lazy symbol loading Alireza Haghdoost via B4 Relay
2026-10-05 17:30 ` [PATCH v5 1/5] perf symbols: Fix broken ELF_C_READ_MMAP fallback guard Alireza Haghdoost via B4 Relay
2026-10-05 17:30 ` [PATCH v5 2/5] perf dso: Allow reading DSO data from an explicit file Alireza Haghdoost via B4 Relay
2026-10-07 22:09 ` Namhyung Kim
2026-10-18 15:09 ` Alireza Haghdoost
2026-10-18 16:26 ` Namhyung Kim [this message]
2026-10-05 17:30 ` [PATCH v5 3/5] perf symbols: Factor out duplicate symbol selection Alireza Haghdoost via B4 Relay
2026-10-05 17:30 ` [PATCH v5 4/5] perf script: Add --lazy-load-symbols for lazy symbol loading Alireza Haghdoost via B4 Relay
2026-10-07 22:15 ` Namhyung Kim
2026-10-18 16:23 ` Alireza Haghdoost
2026-10-05 17:30 ` [PATCH v5 5/5] perf test: Test " Alireza Haghdoost via B4 Relay
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=atTzPJJvR2-sqtJn@google.com \
--to=namhyung@kernel.org \
--cc=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=andriin@fb.com \
--cc=ast@kernel.org \
--cc=haghdoost@uber.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=mark.rutland@arm.com \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
/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®