From: Namhyung Kim <namhyung@kernel.org>
To: Petr Mladek <pmladek@suse.com>
Cc: linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org,
live-patching@vger.kernel.org,
Joe Lawrence <joe.lawrence@redhat.com>
Subject: Re: [PATCH v2 0/2] perf symbols: skip livepatch symbols
Date: Wed, 1 Jul 2026 16:54:02 -0700 [thread overview]
Message-ID: <akWomlgaxlvkBwkX@google.com> (raw)
In-Reply-To: <20260626212140.1380094-1-joe.lawrence@redhat.com>
Hello,
On Fri, Jun 26, 2026 at 05:21:38PM -0400, Joe Lawrence wrote:
> This patchset fixes two minor perf bugs when livepatches containing
> special so-called livepatch symbols are loaded. In both cases, perf
> should ignore these symbols as they resolve as relocations to kernel
> addresses and not module space.
>
> - Patch 1 fixes `perf test 1`
> - Patch 2 fixes `perf record --kcore` bloat
>
>
> Testing notes
> =============
>
> ("perf symbols: skip livepatch symbols when loading kallsyms"):
>
> Without patch:
> ./tools/perf/perf test 1
> 1: vmlinux symtab matches kallsyms : FAILED!
>
> With patch:
> ./tools/perf/perf test 1
> 1: vmlinux symtab matches kallsyms : Ok
>
> ("perf symbols: skip livepatch symbols in kcore_copy")
>
> 1. Baseline = pre-patch perf, no livepatch
> ------------------------------------------
>
> $ ./tools/perf/perf record --kcore -a -o /tmp/baseline.data -- sleep 1
> [ perf record: Woken up 1 times to write data ]
> [ perf record: Captured and wrote 0.221 MB /tmp/baseline.data (1717 samples) ]
>
> $ tree --noreport -h /tmp/baseline.data
> /tmp/baseline.data
> |-- [ 235K] data
> `-- [ 50] kcore_dir
> |-- [ 11M] kallsyms
> |-- [ 25M] kcore
> `-- [ 1.7K] modules
>
>
> 2. Bloated kcore = pre-patch perf, with livepatch
> -------------------------------------------------
>
> $ insmod kpatch-5_14_0-570_94_1-1-3.ko
> $ ./tools/perf/perf record --kcore -a -o /tmp/klp-bloated.data -- sleep 1
> [ perf record: Woken up 1 times to write data ]
> [ perf record: Captured and wrote 0.274 MB /tmp/klp-bloated.data (2757 samples) ]
>
> $ tree --noreport -h /tmp/klp-bloated.data
> /tmp/klp-bloated.data
> |-- [ 288K] data
> `-- [ 50] kcore_dir
> |-- [ 11M] kallsyms
> |-- [ 68M] kcore
> `-- [ 1.8K] modules
>
>
> 3. Post-fix = patched perf, with livepatch
> ------------------------------------------
>
> [ kpatch-5_14_0-570_94_1-1-3.ko still loaded from test (2) ]
>
> $ ./tools/perf/perf record --kcore -a -o /tmp/postfix.data -- sleep 1
> [ perf record: Woken up 1 times to write data ]
> [ perf record: Captured and wrote 0.274 MB /tmp/postfix.data (2763 samples) ]
>
> $ tree --noreport -h /tmp/postfix.data
> /tmp/postfix.data
> |-- [ 289K] data
> `-- [ 50] kcore_dir
> |-- [ 11M] kallsyms
> |-- [ 25M] kcore
> `-- [ 1.8K] modules
>
> Changes
> =======
>
> v2:
> - Move klp symbol check into tools/perf/util/symbol.h alongside similar
> is_ignored_kernel_symbol() check [Petr]
> - Use KLP_SYM_PREFIX instead of inlining it [Petr]
> - Add similar check to kcore_copy__process_kallsyms() [Sashiko]
>
> - Note: Sashiko flagged a pre-existing off-by-one in kallsyms__parse()
> where the symbol-name loop could write past symbol_name[] on overlong
> entries. That issue is unrelated to livepatch symbols and was already
> fixed by Rui Qi's 68018df3f55e ("perf: Fix off-by-one stack buffer
> overflow in kallsyms__parse()").
Petr, are you ok with this change?
Thanks,
Namhyung
>
> v1: https://lore.kernel.org/linux-perf-users/ajzwjNncrI3Bob_o@pathway.suse.cz/T/#t
>
> Joe Lawrence (2):
> perf symbols: skip livepatch symbols when loading kallsyms
> perf symbols: skip livepatch symbols in kcore_copy kallsyms processing
>
> tools/perf/util/symbol-elf.c | 4 ++++
> tools/perf/util/symbol.c | 4 ++--
> tools/perf/util/symbol.h | 12 ++++++++++++
> 3 files changed, 18 insertions(+), 2 deletions(-)
>
> --
> 2.54.0
>
next prev parent reply other threads:[~2026-07-01 23:54 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-26 21:21 [PATCH v2 0/2] perf symbols: skip livepatch symbols Joe Lawrence
2026-06-26 21:21 ` [PATCH v2 1/2] perf symbols: skip livepatch symbols when loading kallsyms Joe Lawrence
2026-06-26 21:21 ` [PATCH v2 2/2] perf symbols: skip livepatch symbols in kcore_copy kallsyms processing Joe Lawrence
2026-07-01 23:54 ` Namhyung Kim [this message]
2026-07-02 7:59 ` [PATCH v2 0/2] perf symbols: skip livepatch symbols Petr Mladek
2026-07-03 20:39 ` Namhyung Kim
2026-07-04 16:11 ` Namhyung Kim
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=akWomlgaxlvkBwkX@google.com \
--to=namhyung@kernel.org \
--cc=joe.lawrence@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=live-patching@vger.kernel.org \
--cc=pmladek@suse.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 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.