[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210622153918.688500-2-jolsa@kernel.org>
Date: Tue, 22 Jun 2021 17:39:09 +0200
From: Jiri Olsa <jolsa@...hat.com>
To: Arnaldo Carvalho de Melo <acme@...nel.org>
Cc: lkml <linux-kernel@...r.kernel.org>,
Peter Zijlstra <a.p.zijlstra@...llo.nl>,
Ingo Molnar <mingo@...nel.org>,
Mark Rutland <mark.rutland@....com>,
Namhyung Kim <namhyung@...nel.org>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Michael Petlan <mpetlan@...hat.com>,
Ian Rogers <irogers@...gle.com>
Subject: [PATCH 01/10] perf: Track build id faults for mmap2 event
Keep track of build id parsing faults per event,
so we can report it in following patches.
Signed-off-by: Jiri Olsa <jolsa@...nel.org>
---
include/linux/perf_event.h | 1 +
kernel/events/core.c | 11 +++++++++--
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index f5a6a2f069ed..5110a998f59b 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -669,6 +669,7 @@ struct perf_event {
unsigned int attach_state;
local64_t count;
atomic64_t child_count;
+ local64_t build_id_faults;
/*
* These are the total time in nanoseconds that the event
diff --git a/kernel/events/core.c b/kernel/events/core.c
index 6fee4a7e88d7..d83ccb58a3c1 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -8183,6 +8183,7 @@ struct perf_mmap_event {
u32 prot, flags;
u8 build_id[BUILD_ID_SIZE_MAX];
u32 build_id_size;
+ bool build_id_fault;
struct {
struct perf_event_header header;
@@ -8244,6 +8245,9 @@ static void perf_event_mmap_output(struct perf_event *event,
if (event->attr.mmap2 && use_build_id)
mmap_event->event_id.header.misc |= PERF_RECORD_MISC_MMAP_BUILD_ID;
+ if (mmap_event->build_id_fault)
+ local64_inc(&event->build_id_faults);
+
perf_output_put(&handle, mmap_event->event_id);
if (event->attr.mmap2) {
@@ -8386,8 +8390,11 @@ static void perf_event_mmap_event(struct perf_mmap_event *mmap_event)
mmap_event->event_id.header.size = sizeof(mmap_event->event_id) + size;
- if (atomic_read(&nr_build_id_events))
- build_id_parse(vma, mmap_event->build_id, &mmap_event->build_id_size);
+ if (atomic_read(&nr_build_id_events)) {
+ int err = build_id_parse(vma, mmap_event->build_id,
+ &mmap_event->build_id_size);
+ mmap_event->build_id_fault = err == -EFAULT;
+ }
perf_iterate_sb(perf_event_mmap_output,
mmap_event,
--
2.31.1
Powered by blists - more mailing lists