[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1391683834-29868-12-git-send-email-alexander.shishkin@linux.intel.com>
Date: Thu, 6 Feb 2014 12:50:34 +0200
From: Alexander Shishkin <alexander.shishkin@...ux.intel.com>
To: Peter Zijlstra <a.p.zijlstra@...llo.nl>
Cc: Ingo Molnar <mingo@...hat.com>, linux-kernel@...r.kernel.org,
Frederic Weisbecker <fweisbec@...il.com>,
Mike Galbraith <efault@....de>,
Paul Mackerras <paulus@...ba.org>,
Stephane Eranian <eranian@...gle.com>,
Andi Kleen <ak@...ux.intel.com>,
Adrian Hunter <adrian.hunter@...el.com>,
Matt Fleming <matt.fleming@...el.com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>
Subject: [PATCH v1 11/11] x86: perf: intel_bts: Add core dump related functionality
BTS data can be used in process core dumps. This patch implements itrace
core dump related hooks that will configure and output BTS traces into
a core file.
Signed-off-by: Alexander Shishkin <alexander.shishkin@...ux.intel.com>
---
arch/x86/kernel/cpu/perf_event_intel_bts.c | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/arch/x86/kernel/cpu/perf_event_intel_bts.c b/arch/x86/kernel/cpu/perf_event_intel_bts.c
index 0a08969..20a19b2 100644
--- a/arch/x86/kernel/cpu/perf_event_intel_bts.c
+++ b/arch/x86/kernel/cpu/perf_event_intel_bts.c
@@ -436,6 +436,26 @@ static void bts_event_read(struct perf_event *event)
{
}
+static size_t bts_trace_core_size(struct perf_event *event)
+{
+ return 0;
+}
+
+static void bts_trace_core_output(struct coredump_params *cprm,
+ struct perf_event *event,
+ unsigned long len)
+{
+ struct bts_buffer *buf = itrace_event_get_priv(event);
+ u64 head = local64_read(&buf->head);
+
+ if (head < len) {
+ dump_emit(cprm, buf->buf + head, buf->real_size - head);
+ dump_emit(cprm, buf->buf, len - buf->real_size + head);
+ } else
+ dump_emit(cprm, buf->buf + head - len, len);
+ itrace_event_put(event);
+}
+
static __init int bts_init(void)
{
int ret, cpu;
@@ -459,6 +479,8 @@ static __init int bts_init(void)
bts_pmu.pmu.read = bts_event_read;
bts_pmu.alloc_buffer = bts_buffer_itrace_alloc;
bts_pmu.free_buffer = bts_buffer_itrace_free;
+ bts_pmu.core_size = bts_trace_core_size;
+ bts_pmu.core_output = bts_trace_core_output;
bts_pmu.name = "intel_bts";
ret = itrace_pmu_register(&bts_pmu);
--
1.8.5.2
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists