From: tip-bot for Adrian Hunter <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: hpa@zytor.com, tglx@linutronix.de, linux-kernel@vger.kernel.org,
acme@redhat.com, mingo@kernel.org, adrian.hunter@intel.com,
jolsa@redhat.com
Subject: [tip:perf/urgent] perf map: Consider PTI entry trampolines in rip_2objdump()
Date: Thu, 7 Jun 2018 01:20:35 -0700 [thread overview]
Message-ID: <tip-97802f3b81dc0d1da0f89c498249547d73a01164@git.kernel.org> (raw)
In-Reply-To: <1528183800-21577-1-git-send-email-adrian.hunter@intel.com>
Commit-ID: 97802f3b81dc0d1da0f89c498249547d73a01164
Gitweb: https://git.kernel.org/tip/97802f3b81dc0d1da0f89c498249547d73a01164
Author: Adrian Hunter <adrian.hunter@intel.com>
AuthorDate: Tue, 5 Jun 2018 10:30:00 +0300
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Wed, 6 Jun 2018 12:52:06 -0300
perf map: Consider PTI entry trampolines in rip_2objdump()
perf tools uses map__rip_2objdump() to calculate objdump virtual addresses.
map__rip_2objdump() needs to be amended to deal with PTI entry trampolines.
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Reported-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Link: http://lkml.kernel.org/r/1528183800-21577-1-git-send-email-adrian.hunter@intel.com
[ split from a larger patch ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/map.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/tools/perf/util/map.c b/tools/perf/util/map.c
index 92abc8e248c5..89ac5b5dc218 100644
--- a/tools/perf/util/map.c
+++ b/tools/perf/util/map.c
@@ -449,6 +449,20 @@ int map__fprintf_srcline(struct map *map, u64 addr, const char *prefix,
*/
u64 map__rip_2objdump(struct map *map, u64 rip)
{
+ struct kmap *kmap = __map__kmap(map);
+
+ /*
+ * vmlinux does not have program headers for PTI entry trampolines and
+ * kcore may not either. However the trampoline object code is on the
+ * main kernel map, so just use that instead.
+ */
+ if (kmap && is_entry_trampoline(kmap->name) && kmap->kmaps && kmap->kmaps->machine) {
+ struct map *kernel_map = machine__kernel_map(kmap->kmaps->machine);
+
+ if (kernel_map)
+ map = kernel_map;
+ }
+
if (!map->dso->adjust_symbols)
return rip;
prev parent reply other threads:[~2018-06-07 8:20 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-05 7:30 [PATCH] perf tools: Fix object code reading for PTI entry trampolines Adrian Hunter
2018-06-05 13:41 ` Arnaldo Carvalho de Melo
2018-06-05 14:08 ` Adrian Hunter
2018-06-05 15:31 ` Arnaldo Carvalho de Melo
2018-06-07 8:20 ` [tip:perf/urgent] perf test code-reading: Fix perf_env setup " tip-bot for Adrian Hunter
2018-06-07 8:20 ` tip-bot for Adrian Hunter [this message]
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=tip-97802f3b81dc0d1da0f89c498249547d73a01164@git.kernel.org \
--to=tipbot@zytor.com \
--cc=acme@redhat.com \
--cc=adrian.hunter@intel.com \
--cc=hpa@zytor.com \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=tglx@linutronix.de \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox