From df7b1d8d7e00d9cdc7ddd678998db46faa04d703 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Fri, 19 Jun 2020 16:10:02 +0200 Subject: [PATCH] 5.4-stable patches added patches: f2fs-fix-checkpoint-disable-u.patch perf-probe-check-address-correctness-by-map-instead-of-_etext.patch perf-probe-do-not-show-the-skipped-events.patch perf-probe-fix-to-check-blacklist-address-correctly.patch perf-symbols-fix-debuginfo-search-for-ubuntu.patch perf-symbols-fix-kernel-maps-for-kcore-and-ebpf.patch --- queue-5.4/f2fs-fix-checkpoint-disable-u.patch | 87 +++++++++++++ ...correctness-by-map-instead-of-_etext.patch | 115 ++++++++++++++++ ...probe-do-not-show-the-skipped-events.patch | 67 ++++++++++ ...to-check-blacklist-address-correctly.patch | 119 +++++++++++++++++ ...bols-fix-debuginfo-search-for-ubuntu.patch | 123 ++++++++++++++++++ ...s-fix-kernel-maps-for-kcore-and-ebpf.patch | 82 ++++++++++++ queue-5.4/series | 6 + 7 files changed, 599 insertions(+) create mode 100644 queue-5.4/f2fs-fix-checkpoint-disable-u.patch create mode 100644 queue-5.4/perf-probe-check-address-correctness-by-map-instead-of-_etext.patch create mode 100644 queue-5.4/perf-probe-do-not-show-the-skipped-events.patch create mode 100644 queue-5.4/perf-probe-fix-to-check-blacklist-address-correctly.patch create mode 100644 queue-5.4/perf-symbols-fix-debuginfo-search-for-ubuntu.patch create mode 100644 queue-5.4/perf-symbols-fix-kernel-maps-for-kcore-and-ebpf.patch diff --git a/queue-5.4/f2fs-fix-checkpoint-disable-u.patch b/queue-5.4/f2fs-fix-checkpoint-disable-u.patch new file mode 100644 index 00000000000..f855a835632 --- /dev/null +++ b/queue-5.4/f2fs-fix-checkpoint-disable-u.patch @@ -0,0 +1,87 @@ +From 1ae18f71cb522684bac1718f5c188fb5e30eb23d Mon Sep 17 00:00:00 2001 +From: Jaegeuk Kim +Date: Fri, 15 May 2020 17:20:50 -0700 +Subject: f2fs: fix checkpoint=disable:%u%% + +From: Jaegeuk Kim + +commit 1ae18f71cb522684bac1718f5c188fb5e30eb23d upstream. + +When parsing the mount option, we don't have sbi->user_block_count. +Should do it after getting it. + +Cc: +Reviewed-by: Chao Yu +Signed-off-by: Jaegeuk Kim +Signed-off-by: Greg Kroah-Hartman + +--- + fs/f2fs/f2fs.h | 1 + + fs/f2fs/super.c | 25 +++++++++++++++++++------ + 2 files changed, 20 insertions(+), 6 deletions(-) + +--- a/fs/f2fs/f2fs.h ++++ b/fs/f2fs/f2fs.h +@@ -138,6 +138,7 @@ struct f2fs_mount_info { + int alloc_mode; /* segment allocation policy */ + int fsync_mode; /* fsync policy */ + bool test_dummy_encryption; /* test dummy encryption */ ++ block_t unusable_cap_perc; /* percentage for cap */ + block_t unusable_cap; /* Amount of space allowed to be + * unusable when disabling checkpoint + */ +--- a/fs/f2fs/super.c ++++ b/fs/f2fs/super.c +@@ -277,6 +277,22 @@ static inline void limit_reserve_root(st + F2FS_OPTION(sbi).s_resgid)); + } + ++static inline void adjust_unusable_cap_perc(struct f2fs_sb_info *sbi) ++{ ++ if (!F2FS_OPTION(sbi).unusable_cap_perc) ++ return; ++ ++ if (F2FS_OPTION(sbi).unusable_cap_perc == 100) ++ F2FS_OPTION(sbi).unusable_cap = sbi->user_block_count; ++ else ++ F2FS_OPTION(sbi).unusable_cap = (sbi->user_block_count / 100) * ++ F2FS_OPTION(sbi).unusable_cap_perc; ++ ++ f2fs_info(sbi, "Adjust unusable cap for checkpoint=disable = %u / %u%%", ++ F2FS_OPTION(sbi).unusable_cap, ++ F2FS_OPTION(sbi).unusable_cap_perc); ++} ++ + static void init_once(void *foo) + { + struct f2fs_inode_info *fi = (struct f2fs_inode_info *) foo; +@@ -790,12 +806,7 @@ static int parse_options(struct super_bl + return -EINVAL; + if (arg < 0 || arg > 100) + return -EINVAL; +- if (arg == 100) +- F2FS_OPTION(sbi).unusable_cap = +- sbi->user_block_count; +- else +- F2FS_OPTION(sbi).unusable_cap = +- (sbi->user_block_count / 100) * arg; ++ F2FS_OPTION(sbi).unusable_cap_perc = arg; + set_opt(sbi, DISABLE_CHECKPOINT); + break; + case Opt_checkpoint_disable_cap: +@@ -1735,6 +1746,7 @@ skip: + (test_opt(sbi, POSIX_ACL) ? SB_POSIXACL : 0); + + limit_reserve_root(sbi); ++ adjust_unusable_cap_perc(sbi); + *flags = (*flags & ~SB_LAZYTIME) | (sb->s_flags & SB_LAZYTIME); + return 0; + restore_gc: +@@ -3397,6 +3409,7 @@ try_onemore: + sbi->reserved_blocks = 0; + sbi->current_reserved_blocks = 0; + limit_reserve_root(sbi); ++ adjust_unusable_cap_perc(sbi); + + for (i = 0; i < NR_INODE_TYPE; i++) { + INIT_LIST_HEAD(&sbi->inode_list[i]); diff --git a/queue-5.4/perf-probe-check-address-correctness-by-map-instead-of-_etext.patch b/queue-5.4/perf-probe-check-address-correctness-by-map-instead-of-_etext.patch new file mode 100644 index 00000000000..da5de95f478 --- /dev/null +++ b/queue-5.4/perf-probe-check-address-correctness-by-map-instead-of-_etext.patch @@ -0,0 +1,115 @@ +From 2ae5d0d7d8868df7c05c2013c0b9cddd4d40610e Mon Sep 17 00:00:00 2001 +From: Masami Hiramatsu +Date: Thu, 23 Apr 2020 20:01:13 +0900 +Subject: perf probe: Check address correctness by map instead of _etext + +From: Masami Hiramatsu + +commit 2ae5d0d7d8868df7c05c2013c0b9cddd4d40610e upstream. + +Since commit 03db8b583d1c ("perf tools: Fix +maps__find_symbol_by_name()") introduced map address range check in +maps__find_symbol_by_name(), we can not get "_etext" from kernel map +because _etext is placed on the edge of the kernel .text section (= +kernel map in perf.) + +To fix this issue, this checks the address correctness by map address +range information (map->start and map->end) instead of using _etext +address. + +This can cause an error if the target inlined function is embedded in +both __init function and normal function. + +For exaample, request_resource() is a normal function but also embedded +in __init reserve_setup(). In this case, the probe point in +reserve_setup() must be skipped. + +However, without this fix, it failes to setup all probe points: + + # ./perf probe -v request_resource + probe-definition(0): request_resource + symbol:request_resource file:(null) line:0 offset:0 return:0 lazy:(null) + 0 arguments + Looking at the vmlinux_path (8 entries long) + Using /usr/lib/debug/lib/modules/5.5.17-200.fc31.x86_64/vmlinux for symbols + Open Debuginfo file: /usr/lib/debug/lib/modules/5.5.17-200.fc31.x86_64/vmlinux + Try to find probe point from debuginfo. + Matched function: request_resource [15e29ad] + found inline addr: 0xffffffff82fbf892 + Probe point found: reserve_setup+204 + found inline addr: 0xffffffff810e9790 + Probe point found: request_resource+0 + Found 2 probe_trace_events. + Opening /sys/kernel/debug/tracing//kprobe_events write=1 + Opening /sys/kernel/debug/tracing//README write=0 + Writing event: p:probe/request_resource _text+33290386 + Failed to write event: Invalid argument + Error: Failed to add events. Reason: Invalid argument (Code: -22) + # + +With this fix, + + # ./perf probe request_resource + reserve_setup is out of .text, skip it. + Added new events: + (null):(null) (on request_resource) + probe:request_resource (on request_resource) + + You can now use it in all perf tools, such as: + + perf record -e probe:request_resource -aR sleep 1 + + # + +Fixes: 03db8b583d1c ("perf tools: Fix maps__find_symbol_by_name()") +Reported-by: Arnaldo Carvalho de Melo +Signed-off-by: Masami Hiramatsu +Tested-by: Arnaldo Carvalho de Melo +Cc: Jiri Olsa +Cc: Namhyung Kim +Cc: stable@vger.kernel.org +Link: http://lore.kernel.org/lkml/158763967332.30755.4922496724365529088.stgit@devnote2 +Signed-off-by: Arnaldo Carvalho de Melo +Signed-off-by: Greg Kroah-Hartman + +--- + tools/perf/util/probe-event.c | 25 +++++++++++++------------ + 1 file changed, 13 insertions(+), 12 deletions(-) + +--- a/tools/perf/util/probe-event.c ++++ b/tools/perf/util/probe-event.c +@@ -236,21 +236,22 @@ static void clear_probe_trace_events(str + static bool kprobe_blacklist__listed(unsigned long address); + static bool kprobe_warn_out_range(const char *symbol, unsigned long address) + { +- u64 etext_addr = 0; +- int ret; ++ struct map *map; ++ bool ret = false; + +- /* Get the address of _etext for checking non-probable text symbol */ +- ret = kernel_get_symbol_address_by_name("_etext", &etext_addr, +- false, false); +- +- if (ret == 0 && etext_addr < address) +- pr_warning("%s is out of .text, skip it.\n", symbol); +- else if (kprobe_blacklist__listed(address)) ++ map = kernel_get_module_map(NULL); ++ if (map) { ++ ret = address <= map->start || map->end < address; ++ if (ret) ++ pr_warning("%s is out of .text, skip it.\n", symbol); ++ map__put(map); ++ } ++ if (!ret && kprobe_blacklist__listed(address)) { + pr_warning("%s is blacklisted function, skip it.\n", symbol); +- else +- return false; ++ ret = true; ++ } + +- return true; ++ return ret; + } + + /* diff --git a/queue-5.4/perf-probe-do-not-show-the-skipped-events.patch b/queue-5.4/perf-probe-do-not-show-the-skipped-events.patch new file mode 100644 index 00000000000..bd111e40363 --- /dev/null +++ b/queue-5.4/perf-probe-do-not-show-the-skipped-events.patch @@ -0,0 +1,67 @@ +From f41ebe9defacddeae96a872a33f0f22ced0bfcef Mon Sep 17 00:00:00 2001 +From: Masami Hiramatsu +Date: Thu, 23 Apr 2020 20:01:22 +0900 +Subject: perf probe: Do not show the skipped events + +From: Masami Hiramatsu + +commit f41ebe9defacddeae96a872a33f0f22ced0bfcef upstream. + +When a probe point is expanded to several places (like inlined) and if +some of them are skipped because of blacklisted or __init function, +those trace_events has no event name. It must be skipped while showing +results. + +Without this fix, you can see "(null):(null)" on the list, + + # ./perf probe request_resource + reserve_setup is out of .text, skip it. + Added new events: + (null):(null) (on request_resource) + probe:request_resource (on request_resource) + + You can now use it in all perf tools, such as: + + perf record -e probe:request_resource -aR sleep 1 + + # + +With this fix, it is ignored: + + # ./perf probe request_resource + reserve_setup is out of .text, skip it. + Added new events: + probe:request_resource (on request_resource) + + You can now use it in all perf tools, such as: + + perf record -e probe:request_resource -aR sleep 1 + + # + +Fixes: 5a51fcd1f30c ("perf probe: Skip kernel symbols which is out of .text") +Signed-off-by: Masami Hiramatsu +Tested-by: Arnaldo Carvalho de Melo +Cc: Jiri Olsa +Cc: Namhyung Kim +Cc: stable@vger.kernel.org +Link: http://lore.kernel.org/lkml/158763968263.30755.12800484151476026340.stgit@devnote2 +Signed-off-by: Arnaldo Carvalho de Melo +Signed-off-by: Greg Kroah-Hartman + +--- + tools/perf/builtin-probe.c | 3 +++ + 1 file changed, 3 insertions(+) + +--- a/tools/perf/builtin-probe.c ++++ b/tools/perf/builtin-probe.c +@@ -364,6 +364,9 @@ static int perf_add_probe_events(struct + + for (k = 0; k < pev->ntevs; k++) { + struct probe_trace_event *tev = &pev->tevs[k]; ++ /* Skipped events have no event name */ ++ if (!tev->event) ++ continue; + + /* We use tev's name for showing new events */ + show_perf_probe_event(tev->group, tev->event, pev, diff --git a/queue-5.4/perf-probe-fix-to-check-blacklist-address-correctly.patch b/queue-5.4/perf-probe-fix-to-check-blacklist-address-correctly.patch new file mode 100644 index 00000000000..c3b69ed955f --- /dev/null +++ b/queue-5.4/perf-probe-fix-to-check-blacklist-address-correctly.patch @@ -0,0 +1,119 @@ +From 80526491c2ca6abc028c0f0dbb0707a1f35fb18a Mon Sep 17 00:00:00 2001 +From: Masami Hiramatsu +Date: Thu, 23 Apr 2020 20:01:04 +0900 +Subject: perf probe: Fix to check blacklist address correctly + +From: Masami Hiramatsu + +commit 80526491c2ca6abc028c0f0dbb0707a1f35fb18a upstream. + +Fix to check kprobe blacklist address correctly with relocated address +by adjusting debuginfo address. + +Since the address in the debuginfo is same as objdump, it is different +from relocated kernel address with KASLR. Thus, 'perf probe' always +misses to catch the blacklisted addresses. + +Without this patch, 'perf probe' can not detect the blacklist addresses +on a KASLR enabled kernel. + + # perf probe kprobe_dispatcher + Failed to write event: Invalid argument + Error: Failed to add events. + # + +With this patch, it correctly shows the error message. + + # perf probe kprobe_dispatcher + kprobe_dispatcher is blacklisted function, skip it. + Probe point 'kprobe_dispatcher' not found. + Error: Failed to add events. + # + +Fixes: 9aaf5a5f479b ("perf probe: Check kprobes blacklist when adding new events") +Signed-off-by: Masami Hiramatsu +Tested-by: Arnaldo Carvalho de Melo +Cc: Jiri Olsa +Cc: Namhyung Kim +Cc: stable@vger.kernel.org +Link: http://lore.kernel.org/lkml/158763966411.30755.5882376357738273695.stgit@devnote2 +Signed-off-by: Arnaldo Carvalho de Melo +Signed-off-by: Greg Kroah-Hartman + +--- + tools/perf/util/probe-event.c | 21 +++++++++++++++------ + 1 file changed, 15 insertions(+), 6 deletions(-) + +--- a/tools/perf/util/probe-event.c ++++ b/tools/perf/util/probe-event.c +@@ -102,7 +102,7 @@ void exit_probe_symbol_maps(void) + symbol__exit(); + } + +-static struct ref_reloc_sym *kernel_get_ref_reloc_sym(void) ++static struct ref_reloc_sym *kernel_get_ref_reloc_sym(struct map **pmap) + { + /* kmap->ref_reloc_sym should be set if host_machine is initialized */ + struct kmap *kmap; +@@ -114,6 +114,10 @@ static struct ref_reloc_sym *kernel_get_ + kmap = map__kmap(map); + if (!kmap) + return NULL; ++ ++ if (pmap) ++ *pmap = map; ++ + return kmap->ref_reloc_sym; + } + +@@ -125,7 +129,7 @@ static int kernel_get_symbol_address_by_ + struct map *map; + + /* ref_reloc_sym is just a label. Need a special fix*/ +- reloc_sym = kernel_get_ref_reloc_sym(); ++ reloc_sym = kernel_get_ref_reloc_sym(NULL); + if (reloc_sym && strcmp(name, reloc_sym->name) == 0) + *addr = (reloc) ? reloc_sym->addr : reloc_sym->unrelocated_addr; + else { +@@ -745,6 +749,7 @@ post_process_kernel_probe_trace_events(s + int ntevs) + { + struct ref_reloc_sym *reloc_sym; ++ struct map *map; + char *tmp; + int i, skipped = 0; + +@@ -753,7 +758,7 @@ post_process_kernel_probe_trace_events(s + return post_process_offline_probe_trace_events(tevs, ntevs, + symbol_conf.vmlinux_name); + +- reloc_sym = kernel_get_ref_reloc_sym(); ++ reloc_sym = kernel_get_ref_reloc_sym(&map); + if (!reloc_sym) { + pr_warning("Relocated base symbol is not found!\n"); + return -EINVAL; +@@ -764,9 +769,13 @@ post_process_kernel_probe_trace_events(s + continue; + if (tevs[i].point.retprobe && !kretprobe_offset_is_supported()) + continue; +- /* If we found a wrong one, mark it by NULL symbol */ ++ /* ++ * If we found a wrong one, mark it by NULL symbol. ++ * Since addresses in debuginfo is same as objdump, we need ++ * to convert it to addresses on memory. ++ */ + if (kprobe_warn_out_range(tevs[i].point.symbol, +- tevs[i].point.address)) { ++ map__objdump_2mem(map, tevs[i].point.address))) { + tmp = NULL; + skipped++; + } else { +@@ -2922,7 +2931,7 @@ static int find_probe_trace_events_from_ + /* Note that the symbols in the kmodule are not relocated */ + if (!pev->uprobes && !pev->target && + (!pp->retprobe || kretprobe_offset_is_supported())) { +- reloc_sym = kernel_get_ref_reloc_sym(); ++ reloc_sym = kernel_get_ref_reloc_sym(NULL); + if (!reloc_sym) { + pr_warning("Relocated base symbol is not found!\n"); + ret = -EINVAL; diff --git a/queue-5.4/perf-symbols-fix-debuginfo-search-for-ubuntu.patch b/queue-5.4/perf-symbols-fix-debuginfo-search-for-ubuntu.patch new file mode 100644 index 00000000000..35f2dd174e8 --- /dev/null +++ b/queue-5.4/perf-symbols-fix-debuginfo-search-for-ubuntu.patch @@ -0,0 +1,123 @@ +From 85afd35575a3c1a3a905722dde5ee70b49282e70 Mon Sep 17 00:00:00 2001 +From: Adrian Hunter +Date: Tue, 26 May 2020 18:52:07 +0300 +Subject: perf symbols: Fix debuginfo search for Ubuntu + +From: Adrian Hunter + +commit 85afd35575a3c1a3a905722dde5ee70b49282e70 upstream. + +Reportedly, from 19.10 Ubuntu has begun mixing up the location of some +debug symbol files, putting files expected to be in +/usr/lib/debug/usr/lib into /usr/lib/debug/lib instead. Fix by adding +another dso_binary_type. + +Example on Ubuntu 20.04 + + Before: + + $ perf record -e intel_pt//u uname + Linux + [ perf record: Woken up 1 times to write data ] + [ perf record: Captured and wrote 0.030 MB perf.data ] + $ perf script --call-trace | head -5 + uname 14003 [005] 15321.764958566: cbr: 42 freq: 4219 MHz (156%) + uname 14003 [005] 15321.764958566: (/usr/lib/x86_64-linux-gnu/ld-2.31.so ) 7f1e71cc4100 + uname 14003 [005] 15321.764961566: (/usr/lib/x86_64-linux-gnu/ld-2.31.so ) 7f1e71cc4df0 + uname 14003 [005] 15321.764961900: (/usr/lib/x86_64-linux-gnu/ld-2.31.so ) 7f1e71cc4e18 + uname 14003 [005] 15321.764963233: (/usr/lib/x86_64-linux-gnu/ld-2.31.so ) 7f1e71cc5128 + + After: + + $ perf script --call-trace | head -5 + uname 14003 [005] 15321.764958566: cbr: 42 freq: 4219 MHz (156%) + uname 14003 [005] 15321.764958566: (/usr/lib/x86_64-linux-gnu/ld-2.31.so ) _start + uname 14003 [005] 15321.764961566: (/usr/lib/x86_64-linux-gnu/ld-2.31.so ) _dl_start + uname 14003 [005] 15321.764961900: (/usr/lib/x86_64-linux-gnu/ld-2.31.so ) _dl_start + uname 14003 [005] 15321.764963233: (/usr/lib/x86_64-linux-gnu/ld-2.31.so ) _dl_start + +Reported-by: Travis Downs +Signed-off-by: Adrian Hunter +Cc: Jiri Olsa +Cc: stable@vger.kernel.org +Link: http://lore.kernel.org/lkml/20200526155207.9172-1-adrian.hunter@intel.com +Signed-off-by: Arnaldo Carvalho de Melo +Signed-off-by: Greg Kroah-Hartman + +--- + tools/perf/util/dso.c | 16 ++++++++++++++++ + tools/perf/util/dso.h | 1 + + tools/perf/util/probe-finder.c | 1 + + tools/perf/util/symbol.c | 2 ++ + 4 files changed, 20 insertions(+) + +--- a/tools/perf/util/dso.c ++++ b/tools/perf/util/dso.c +@@ -47,6 +47,7 @@ char dso__symtab_origin(const struct dso + [DSO_BINARY_TYPE__BUILD_ID_CACHE_DEBUGINFO] = 'D', + [DSO_BINARY_TYPE__FEDORA_DEBUGINFO] = 'f', + [DSO_BINARY_TYPE__UBUNTU_DEBUGINFO] = 'u', ++ [DSO_BINARY_TYPE__MIXEDUP_UBUNTU_DEBUGINFO] = 'x', + [DSO_BINARY_TYPE__OPENEMBEDDED_DEBUGINFO] = 'o', + [DSO_BINARY_TYPE__BUILDID_DEBUGINFO] = 'b', + [DSO_BINARY_TYPE__SYSTEM_PATH_DSO] = 'd', +@@ -129,6 +130,21 @@ int dso__read_binary_type_filename(const + snprintf(filename + len, size - len, "%s", dso->long_name); + break; + ++ case DSO_BINARY_TYPE__MIXEDUP_UBUNTU_DEBUGINFO: ++ /* ++ * Ubuntu can mixup /usr/lib with /lib, putting debuginfo in ++ * /usr/lib/debug/lib when it is expected to be in ++ * /usr/lib/debug/usr/lib ++ */ ++ if (strlen(dso->long_name) < 9 || ++ strncmp(dso->long_name, "/usr/lib/", 9)) { ++ ret = -1; ++ break; ++ } ++ len = __symbol__join_symfs(filename, size, "/usr/lib/debug"); ++ snprintf(filename + len, size - len, "%s", dso->long_name + 4); ++ break; ++ + case DSO_BINARY_TYPE__OPENEMBEDDED_DEBUGINFO: + { + const char *last_slash; +--- a/tools/perf/util/dso.h ++++ b/tools/perf/util/dso.h +@@ -30,6 +30,7 @@ enum dso_binary_type { + DSO_BINARY_TYPE__BUILD_ID_CACHE_DEBUGINFO, + DSO_BINARY_TYPE__FEDORA_DEBUGINFO, + DSO_BINARY_TYPE__UBUNTU_DEBUGINFO, ++ DSO_BINARY_TYPE__MIXEDUP_UBUNTU_DEBUGINFO, + DSO_BINARY_TYPE__BUILDID_DEBUGINFO, + DSO_BINARY_TYPE__SYSTEM_PATH_DSO, + DSO_BINARY_TYPE__GUEST_KMODULE, +--- a/tools/perf/util/probe-finder.c ++++ b/tools/perf/util/probe-finder.c +@@ -101,6 +101,7 @@ enum dso_binary_type distro_dwarf_types[ + DSO_BINARY_TYPE__UBUNTU_DEBUGINFO, + DSO_BINARY_TYPE__OPENEMBEDDED_DEBUGINFO, + DSO_BINARY_TYPE__BUILDID_DEBUGINFO, ++ DSO_BINARY_TYPE__MIXEDUP_UBUNTU_DEBUGINFO, + DSO_BINARY_TYPE__NOT_FOUND, + }; + +--- a/tools/perf/util/symbol.c ++++ b/tools/perf/util/symbol.c +@@ -79,6 +79,7 @@ static enum dso_binary_type binary_type_ + DSO_BINARY_TYPE__SYSTEM_PATH_KMODULE, + DSO_BINARY_TYPE__SYSTEM_PATH_KMODULE_COMP, + DSO_BINARY_TYPE__OPENEMBEDDED_DEBUGINFO, ++ DSO_BINARY_TYPE__MIXEDUP_UBUNTU_DEBUGINFO, + DSO_BINARY_TYPE__NOT_FOUND, + }; + +@@ -1530,6 +1531,7 @@ static bool dso__is_compatible_symtab_ty + case DSO_BINARY_TYPE__SYSTEM_PATH_DSO: + case DSO_BINARY_TYPE__FEDORA_DEBUGINFO: + case DSO_BINARY_TYPE__UBUNTU_DEBUGINFO: ++ case DSO_BINARY_TYPE__MIXEDUP_UBUNTU_DEBUGINFO: + case DSO_BINARY_TYPE__BUILDID_DEBUGINFO: + case DSO_BINARY_TYPE__OPENEMBEDDED_DEBUGINFO: + return !kmod && dso->kernel == DSO_TYPE_USER; diff --git a/queue-5.4/perf-symbols-fix-kernel-maps-for-kcore-and-ebpf.patch b/queue-5.4/perf-symbols-fix-kernel-maps-for-kcore-and-ebpf.patch new file mode 100644 index 00000000000..ded09a2b194 --- /dev/null +++ b/queue-5.4/perf-symbols-fix-kernel-maps-for-kcore-and-ebpf.patch @@ -0,0 +1,82 @@ +From 0affd0e5262b6d40f5f63466d88933e99698e240 Mon Sep 17 00:00:00 2001 +From: Adrian Hunter +Date: Tue, 2 Jun 2020 14:25:05 +0300 +Subject: perf symbols: Fix kernel maps for kcore and eBPF + +From: Adrian Hunter + +commit 0affd0e5262b6d40f5f63466d88933e99698e240 upstream. + +Adjust 'map->pgoff' also when moving a map's start address. + +Example with v5.4.34 based kernel: + + Before: + + $ sudo tools/perf/perf record -a --kcore -e intel_pt//k sleep 1 + [ perf record: Woken up 1 times to write data ] + [ perf record: Captured and wrote 1.958 MB perf.data ] + $ sudo tools/perf/perf script --itrace=e >/dev/null + Warning: + 961 instruction trace errors + + After: + + $ sudo tools/perf/perf script --itrace=e >/dev/null + $ + +Committer testing: + + # uname -a + Linux seventh 5.6.10-100.fc30.x86_64 #1 SMP Mon May 4 15:36:44 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux + # + +Before: + + # perf record -a --kcore -e intel_pt//k sleep 1 + [ perf record: Woken up 1 times to write data ] + [ perf record: Captured and wrote 0.923 MB perf.data ] + # perf script --itrace=e >/dev/null + Warning: + 295 instruction trace errors + # + +After: + + # perf record -a --kcore -e intel_pt//k sleep 1 + [ perf record: Woken up 1 times to write data ] + [ perf record: Captured and wrote 0.919 MB perf.data ] + # perf script --itrace=e >/dev/null + # + +Fixes: fb5a88d4131a ("perf tools: Preserve eBPF maps when loading kcore") +Signed-off-by: Adrian Hunter +Tested-by: Arnaldo Carvalho de Melo +Cc: Jiri Olsa +Cc: stable@vger.kernel.org +Link: http://lore.kernel.org/lkml/20200602112505.1406-1-adrian.hunter@intel.com +Signed-off-by: Arnaldo Carvalho de Melo +Signed-off-by: Greg Kroah-Hartman + +--- + tools/perf/util/symbol.c | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/tools/perf/util/symbol.c ++++ b/tools/perf/util/symbol.c +@@ -1221,6 +1221,7 @@ int map_groups__merge_in(struct map_grou + + m->end = old_map->start; + list_add_tail(&m->node, &merged); ++ new_map->pgoff += old_map->end - new_map->start; + new_map->start = old_map->end; + } + } else { +@@ -1241,6 +1242,7 @@ int map_groups__merge_in(struct map_grou + * |new......| -> |new...| + * |old....| -> |old....| + */ ++ new_map->pgoff += old_map->end - new_map->start; + new_map->start = old_map->end; + } + } diff --git a/queue-5.4/series b/queue-5.4/series index 2b54bd63bc7..b9ef1ef0596 100644 --- a/queue-5.4/series +++ b/queue-5.4/series @@ -253,3 +253,9 @@ mtd-rawnand-pasemi-fix-the-probe-error-path.patch mtd-rawnand-mtk-fix-the-probe-error-path.patch mtd-rawnand-tmio-fix-the-probe-error-path.patch w1-omap-hdq-cleanup-to-add-missing-newline-for-some-dev_dbg.patch +f2fs-fix-checkpoint-disable-u.patch +perf-probe-do-not-show-the-skipped-events.patch +perf-probe-fix-to-check-blacklist-address-correctly.patch +perf-probe-check-address-correctness-by-map-instead-of-_etext.patch +perf-symbols-fix-debuginfo-search-for-ubuntu.patch +perf-symbols-fix-kernel-maps-for-kcore-and-ebpf.patch -- 2.47.3