------- Comment From tmri...@de.ibm.com 2019-07-05 07:48 EDT------- I have tried to last 2 days to find a patch series to apply the required patch which failed above.
The difference between upstream linux kernel 5.2.0rc7 and the ubuntu 18.04 kernel I downloaded from url = git://kernel.ubuntu.com/ubuntu/ubuntu-bionic branch master-next in regards to the function machine__create_kernel_maps() in file tools/perf/util/machine.c is very big. Command git log --oneline '-L: machine__create_kernel_maps:tools/perf/util/machine.c' identifies the difference of applied patches. The following patches are missing in ubuntu version: Commit-ID Description ed9adb2035b5 perf machine: Read also the end of the kernel 977c7a6d1e26 perf machine: Update kernel map address and re-order properly 1c5aae7710bb perf machine: Create maps for x86 PTI entry trampolines 3183f8ca304f perf symbols: Unify symbol maps ee05d21791db perf machine: Set main kernel end address properly 1fb87b8e9599 perf machine: Don't search for active kernel start in __machine__create_kernel_maps Already the first patch missing: Commit-ID Description 1fb87b8e9599 perf machine: Don't search for active kernel start in __machine__create_kernel_maps does not apply because in this patch a function named machine__set_kernel_mmap() is moved in file perf/tools/util/machine.c but this function is missing in the ubuntu 18.04 master-next tree. It turned out that this tree also misses patch: Commit-ID Description 05db6ff73d80 perf machine: Generalize machine__set_kernel_mmap() Having found the starting patch, I can applied the following patch sequence: root@s8360046:~/ubuntu-bionic# patch -p1 < ../patches/0001-perf-machine-Generalize- machine__set_kernel_mmap.patch patching file tools/perf/util/machine.c Hunk #1 succeeded at 1255 (offset -7 lines). Hunk #2 succeeded at 1370 (offset -5 lines). root@s8360046:~/ubuntu-bionic# patch -p1 < ../patches/0001-perf-machine-Don-t-search-for-active-kernel-start-in.patch patching file tools/perf/util/machine.c Hunk #1 succeeded at 849 (offset -7 lines). Hunk #2 succeeded at 861 (offset -7 lines). Hunk #3 succeeded at 1212 (offset -7 lines). Hunk #4 succeeded at 1254 (offset -7 lines). patching file tools/perf/util/machine.h Hunk #1 succeeded at 239 (offset 1 line). root@s8360046:~/ubuntu-bionic# patch -p1 < ../patches/0001-perf-machine-Set-main-kernel-end-address-properly.patch patching file tools/perf/util/machine.c Hunk #1 succeeded at 1020 (offset 1 line). Hunk #2 succeeded at 1227 (offset 1 line). Hunk #3 succeeded at 1254 (offset 1 line). root@s8360046:~/ubuntu-bionic# patch -p1 < ../patches/0001-perf-machine-Update-kernel-map-address-and-re-order-.patch patching file tools/perf/util/machine.c Hunk #1 succeeded at 1223 with fuzz 1 (offset -198 lines). Hunk #2 succeeded at 1269 with fuzz 1 (offset -198 lines). Hunk #3 succeeded at 1381 (offset -226 lines). root@s8360046:~/ubuntu-bionic# patch -p1 < ../patches/0001-perf-machine-Read-also-the-end-of-the-kernel.patch patching file tools/perf/util/machine.c Hunk #1 succeeded at 821 (offset -103 lines). Hunk #2 succeeded at 847 (offset -103 lines). Hunk #3 succeeded at 1248 (offset -199 lines). Hunk #4 FAILED at 1466. Hunk #5 FAILED at 1478. 2 out of 5 hunks FAILED -- saving rejects to file tools/perf/util/machine.c.rej root@s8360046:~/ubuntu-bionic# The last patch is the one we need and it fails. Refering to above patch list, I do not want to apply these two patches: Commit-ID Description 1c5aae7710bb perf machine: Create maps for x86 PTI entry trampolines 3183f8ca304f perf symbols: Unify symbol maps Both patches require tremendous change in the symbol table code of perf and introduce trampoline functionality to handle security fixes in the kernel for x86. If you want to apply these two patch, better upgrade the perf tool completely. Appling the last patch, the last 2 hunks fail because of missing context. The changes itself are trivial, but I can not do the changes as the code of the last patch is not from IBM. Here is the difference from the file tools/perf/util/machine.c.rej: -- tools/perf/util/machine.c +++ tools/perf/util/machine.c @@ -1466,9 +1472,9 @@ int machine__create_kernel_maps(struct machine *machine) "continuing anyway...\n", machine->pid); } - if (!machine__get_running_kernel_start(machine, &name, &addr)) { + if (!machine__get_running_kernel_start(machine, &name, &start, &end)) { if (name && - map__set_kallsyms_ref_reloc_sym(machine->vmlinux_map, name, addr)) { + map__set_kallsyms_ref_reloc_sym(machine->vmlinux_map, name, start)) { machine__destroy_kernel_maps(machine); ret = -1; goto out_put; @@ -1478,16 +1484,19 @@ int machine__create_kernel_maps(struct machine *machine) * we have a real start address now, so re-order the kmaps * assume it's the last in the kmaps */ - machine__update_kernel_mmap(machine, addr, ~0ULL); + machine__update_kernel_mmap(machine, start, end); } if (machine__create_extra_kernel_maps(machine, kernel)) pr_debug("Problems creating extra kernel maps, continuing anyway...\n"); - /* update end address of the kernel map using adjacent module address */ - map = map__next(machine__kernel_map(machine)); - if (map) - machine__set_kernel_mmap(machine, addr, map->start); + if (end == ~0ULL) { + /* update end address of the kernel map using adjacent module address */ + map = map__next(machine__kernel_map(machine)); + if (map) + machine__set_kernel_mmap(machine, start, map->start); + } + out_put: dso__put(kernel); return ret; Hope this helps. Sorry that I did not come to a better solution. The differences between both versions of perf is just too big. Ubuntu 18.04 is based on Linux 4.15 whereas the reqired patch was made for linux 5.2. I have not compiled the perf tool nor tested the result -- You received this bug notification because you are a member of Kernel Packages, which is subscribed to linux in Ubuntu. https://bugs.launchpad.net/bugs/1828166 Title: perf top problem on z with Ubuntu 18.04 Status in Ubuntu on IBM z Systems: Confirmed Status in linux package in Ubuntu: Confirmed Status in linux source package in Bionic: In Progress Status in linux source package in Cosmic: In Progress Bug description: SRU Justification: ================== [Impact] * The perf top tool hangs and shows error messages, like 'Not enough memory for annotating' [Fix] * edeb0c90df3581b821a764052d185df985f8b8dc edeb0c9 "perf tools: Stop fallbacking to kallsyms for vdso symbols lookup" [Test Case] * start a benchmark (mem_alloc, but it doesn't really matter what) * execute perf top in a second terminal * the output of perf top is correct * now stop the benchmark * and perf top shows an error message, like "Not enough memory for annotating '__irf_end' symbol!)" * and perf top can't be exited anymore [Regression Potential] * The regression potential can be considered as low since this happens only while using the perf top tool * and it is known that the commit (above) fixes the problem * and the fix is upstream since 4.19 [Other Info] * current disco and eoan kernels don't show that problem * bisecting result points to above commit * applies cleanly on cosmic, but has a little conflict on bionic (both master-next) _________________________ perf top hangs and shows error messages ---uname output--- Linux weather 4.15.0-46-generic #49-Ubuntu SMP Wed Feb 6 09:32:27 UTC 2019 s390x s390x s390x GNU/Linux ---Steps to Reproduce--- I start a benchmark (mem_alloc, but it really doesn't matter) and then issue perf top in a second terminal, the output from perf top is correct. Now I stop the benchmark: perf top shows a error message (Not enough memory for annotating '__irf_end' symbol!) and I can't quit from perf top anymore Following analyse took place: No problem with current kernel . Bi-Secting of perf tool took place and following commit was found: commit edeb0c90df3581b821a764052d185df985f8b8dc (HEAD, refs/bisect/bad) Author: Arnaldo Carvalho de Melo <a...@redhat.com> Date: Tue Oct 16 17:08:29 2018 -0300 perf tools: Stop fallbacking to kallsyms for vdso symbols lookup When you apply this patch the issue is gone, however it is contained in these versions: git tag --contains edeb0c90df3581b821 v4.19 v4.20 .... The level I was debugging was kernel 4.15 which does not contain this patch. To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu-z-systems/+bug/1828166/+subscriptions -- Mailing list: https://launchpad.net/~kernel-packages Post to : kernel-packages@lists.launchpad.net Unsubscribe : https://launchpad.net/~kernel-packages More help : https://help.launchpad.net/ListHelp