[rh7,3/3] Revert "perf tools: Stop fallbacking to kallsyms for vdso symbols lookup"

Submitted by Konstantin Khorenko on Dec. 9, 2019, 10:21 a.m.

Details

Message ID 20191209102159.29671-4-khorenko@virtuozzo.com
State New
Series "perf: make it working again"
Headers show

Commit Message

Konstantin Khorenko Dec. 9, 2019, 10:21 a.m.
This reverts commit edeb0c90df3581b821a764052d185df985f8b8dc.

RHEL7.7 perf does not resolve symbols normally,
so let's just roll back the patch which broke this.

This is a temporary solution:
 - RedHat is aware of the issue and will hopefully fix it in RHEL7.8
 - once we inherit the proper fix from RedHat, we'll just drop this revert

https://jira.sw.ru/browse/HCI-128
https://bugzilla.redhat.com/show_bug.cgi?id=1780532

Signed-off-by: Konstantin Khorenko <khorenko@virtuozzo.com>
---
 tools/perf/util/event.c | 21 +++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)

Patch hide | download patch | download mbox

diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c
index a7bab025f563..55c93bf1b498 100644
--- a/tools/perf/util/event.c
+++ b/tools/perf/util/event.c
@@ -1417,9 +1417,26 @@  struct map *thread__find_map(struct thread *thread, u8 cpumode, u64 addr,
 
 		return NULL;
 	}
-
+try_again:
 	al->map = map_groups__find(mg, al->addr);
-	if (al->map != NULL) {
+	if (al->map == NULL) {
+		/*
+		 * If this is outside of all known maps, and is a negative
+		 * address, try to look it up in the kernel dso, as it might be
+		 * a vsyscall or vdso (which executes in user-mode).
+		 *
+		 * XXX This is nasty, we should have a symbol list in the
+		 * "[vdso]" dso, but for now lets use the old trick of looking
+		 * in the whole kernel symbol list.
+		 */
+		if (cpumode == PERF_RECORD_MISC_USER && machine &&
+		    mg != &machine->kmaps &&
+		    machine__kernel_ip(machine, al->addr)) {
+			mg = &machine->kmaps;
+			load_map = true;
+			goto try_again;
+		}
+	} else {
 		/*
 		 * Kernel maps might be changed when loading symbols so loading
 		 * must be done prior to using kernel maps.