Patch "perf header: Set proper module name when build-id event found" has been added to the 4.9-stable tree
Subsystems (2)
This is a note to let you know that I've just added the patch titled
perf header: Set proper module name when build-id event found
to the 4.9-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
perf-header-set-proper-module-name-when-build-id-event-found.patch
and it can be found in the queue-4.9 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
Quoted 1 line
From foo@baz Mon Apr 9 17:09:24 CEST 2018
From: Namhyung Kim <[email protected]>
Date: Wed, 31 May 2017 21:01:03 +0900
Subject: perf header: Set proper module name when build-id event found
From: Namhyung Kim <[email protected]>
[ Upstream commit 1deec1bd96ccd8beb04d2112a6d12fe20505c3a6 ]
When perf processes build-id event, it creates DSOs with the build-id. But it didn't set the module short name (like '[module-name]') so when processing a kernel mmap event of the module, it cannot found the DSO as it only checks the short names.
That leads for perf to create a same DSO without the build-id info and it'll lookup the system path even if the DSO is already in the build-id cache. After kernel was updated, perf cannot find the DSO and cannot show symbols in it anymore.
You can see this if you have an old data file (w/ old kernel version):
$ perf report -i perf.data.old -v |& grep scsi_mod build id event received for /lib/modules/3.19.2-1-ARCH/kernel/drivers/scsi/scsi_mod.ko.gz : cafe1ce6ca13a98a5d9ed3425cde249e57a27fc1 Failed to open /lib/modules/3.19.2-1-ARCH/kernel/drivers/scsi/scsi_mod.ko.gz, continuing without symbols ...
The second message didn't show the build-id. With this patch:
$ perf report -i perf.data.old -v |& grep scsi_mod build id event received for /lib/modules/3.19.2-1-ARCH/kernel/drivers/scsi/scsi_mod.ko.gz: cafe1ce6ca13a98a5d9ed3425cde249e57a27fc1 /lib/modules/3.19.2-1-ARCH/kernel/drivers/scsi/scsi_mod.ko.gz with build id cafe1ce6ca13a98a5d9ed3425cde249e57a27fc1 not found, continuing without symbols ...
Now it shows the build-id but still cannot load the symbol table. This is a different problem which will be fixed in the next patch.
--- tools/perf/util/header.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
tools/perf/util/header.c +10 -2
@@ -1454,8 +1454,16 @@ static int __event_process_build_id(strudso__set_build_id (dso, &bev->build_id); -if (!is_kernel_module (filename, cpumode)) - dso->kernel = dso_type; +if (dso_type !=DSO_TYPE_USER ) { +struct kmod_path m = { .name =NULL , }; + +if (!kmod_path__parse_name (&m, filename) && m.kmod) +dso__set_short_name (dso,strdup (m.name), true); +else + dso->kernel = dso_type; + +free (m.name); + }build_id__sprintf (dso->build_id,sizeof (dso->build_id), sbuild_id);
Patches currently in stable-queue which might be from [email protected] are
queue-4.9/perf-report-fix-off-by-one-for-non-activation-frames.patch queue-4.9/perf-trace-add-mmap-alias-for-s390.patch queue-4.9/perf-report-ensure-the-perf-dso-mapping-matches-what-libdw-sees.patch queue-4.9/perf-tools-fix-copyfile_offset-update-of-output-offset.patch queue-4.9/perf-tools-decompress-kernel-module-when-reading-dso-data.patch queue-4.9/perf-tests-decompress-kernel-module-before-objdump.patch queue-4.9/perf-header-set-proper-module-name-when-build-id-event-found.patch