mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-27 17:11:46 +00:00
perf machine: Synthesize and process mmap events for x86 PTI entry trampolines
Like the kernel text, the location of x86 PTI entry trampolines must be recorded in the perf.data file. Like the kernel, synthesize a mmap event for that, and add processing for it. Signed-off-by: Adrian Hunter <adrian.hunter@intel.com> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Andi Kleen <ak@linux.intel.com> Cc: Andy Lutomirski <luto@kernel.org> Cc: Dave Hansen <dave.hansen@linux.intel.com> Cc: H. Peter Anvin <hpa@zytor.com> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Joerg Roedel <joro@8bytes.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: x86@kernel.org Link: http://lkml.kernel.org/r/1526986485-6562-10-git-send-email-adrian.hunter@intel.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
1c5aae7710
commit
a8ce99b0ee
5 changed files with 140 additions and 7 deletions
|
@ -1387,6 +1387,32 @@ static bool machine__uses_kcore(struct machine *machine)
|
|||
return false;
|
||||
}
|
||||
|
||||
static bool perf_event__is_extra_kernel_mmap(struct machine *machine,
|
||||
union perf_event *event)
|
||||
{
|
||||
return machine__is(machine, "x86_64") &&
|
||||
is_entry_trampoline(event->mmap.filename);
|
||||
}
|
||||
|
||||
static int machine__process_extra_kernel_map(struct machine *machine,
|
||||
union perf_event *event)
|
||||
{
|
||||
struct map *kernel_map = machine__kernel_map(machine);
|
||||
struct dso *kernel = kernel_map ? kernel_map->dso : NULL;
|
||||
struct extra_kernel_map xm = {
|
||||
.start = event->mmap.start,
|
||||
.end = event->mmap.start + event->mmap.len,
|
||||
.pgoff = event->mmap.pgoff,
|
||||
};
|
||||
|
||||
if (kernel == NULL)
|
||||
return -1;
|
||||
|
||||
strlcpy(xm.name, event->mmap.filename, KMAP_NAME_LEN);
|
||||
|
||||
return machine__create_extra_kernel_map(machine, kernel, &xm);
|
||||
}
|
||||
|
||||
static int machine__process_kernel_mmap_event(struct machine *machine,
|
||||
union perf_event *event)
|
||||
{
|
||||
|
@ -1490,6 +1516,8 @@ static int machine__process_kernel_mmap_event(struct machine *machine,
|
|||
*/
|
||||
dso__load(kernel, machine__kernel_map(machine));
|
||||
}
|
||||
} else if (perf_event__is_extra_kernel_mmap(machine, event)) {
|
||||
return machine__process_extra_kernel_map(machine, event);
|
||||
}
|
||||
return 0;
|
||||
out_problem:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue