Re: [PATCH v2] perf symbols: Don't apply the symfs layout to synthesised paths
From: Zhan Xusheng
Date: Tue Sep 15 2026 - 23:37:02 EST
On Tue, Sep 15, 2026 at 01:31:16PM -0700, Ian Rogers wrote:
> In those before and after examples, the 'before' case seems to better
> match what the user is requesting on the command line, so I think I'm
> misunderstanding something.
Neither side is the flat layout. The changelog showed the prefixes and
not the full paths they end up in, so there was nothing in it to see that
from.
For /usr/lib/x86_64-linux-gnu/libc.so.6 the base name is libc.so.6.debug,
so the flat lookup is /s/libc.so.6.debug. With --symfs /s,flat, the
FEDORA_DEBUGINFO path actually tried is
before /s/debug/usr/lib/x86_64-linux-gnu/libc.so.6.debug
after /s//usr/lib/debug/usr/lib/x86_64-linux-gnu/libc.so.6.debug
Both carry /usr/lib/x86_64-linux-gnu/libc.so.6 whole. perf_basename()
only ever saw the prefix, because the DSO path arrives after it:
len = __symbol__join_symfs(filename, size, "/usr/lib/debug");
snprintf(filename + len, size - len, "%s.debug", dso__long_name(dso));
Before is shorter in its first component, which is what makes it read as
flatter, but the layout that was asked for is on neither side.
BUILDID_DEBUGINFO is the one I would not try to defend as intended. Its
prefix is "/usr/lib/debug/.build-id/", and perf_basename() of a path
ending in '/' is "", so the prefix does not become shorter, it disappears:
before <symfs>/ab/cdef...ff.debug
after <symfs>//usr/lib/debug/.build-id/ab/cdef...ff.debug
Where the argument is the file being looked for, the option does what it
says and the patch changes nothing:
__symbol__join_symfs(filename, size, dso__long_name(dso));
/s/libc.so.6, /s/ld-linux-x86-64.so.2, /s/sleep.
So the patch is narrow: it keeps a flat request from rewriting perf's own
fixed prefixes. It does not make flat find distro debuginfo -- for a user
whose debug files really are flat under <symfs>, both columns miss. That
needs the base name taken from the composed filename instead of the
prefix, which is a different change and not a Fixes:. I can write that
one instead if you would rather have it.
8 paths change across those 4 sites and 13 are untouched; hierarchy is
identical between the two builds at all 21. The doubled slash comes from
path__join(), it predates this and shows up in untouched paths too.
The v2 changelog also said four paths differ while listing four call
sites; it is eight paths. That did not help.
Thanks,
Zhan Xusheng