lkml.org 
[lkml]   [2010]   [Oct]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[tip:perf/urgent] perf, x86: Extract PEBS/BTS buffer free routines
Commit-ID:  b39f88acd7d989b6b247ba87c480fc24ed71d9c5
Gitweb: http://git.kernel.org/tip/b39f88acd7d989b6b247ba87c480fc24ed71d9c5
Author: Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Tue, 19 Oct 2010 14:08:29 +0200
Committer: Ingo Molnar <mingo@elte.hu>
CommitDate: Fri, 22 Oct 2010 14:18:24 +0200

perf, x86: Extract PEBS/BTS buffer free routines

So that we may grow additional call-sites..

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Acked-by: Stephane Eranian <eranian@google.com>
LKML-Reference: <20101019134808.196793164@chello.nl>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
arch/x86/kernel/cpu/perf_event_intel_ds.c | 30 ++++++++++++++++++++++++----
1 files changed, 25 insertions(+), 5 deletions(-)
diff --git a/arch/x86/kernel/cpu/perf_event_intel_ds.c b/arch/x86/kernel/cpu/perf_event_intel_ds.c
index 4977f9c..1bc1351 100644
--- a/arch/x86/kernel/cpu/perf_event_intel_ds.c
+++ b/arch/x86/kernel/cpu/perf_event_intel_ds.c
@@ -74,6 +74,28 @@ static void fini_debug_store_on_cpu(int cpu)
wrmsr_on_cpu(cpu, MSR_IA32_DS_AREA, 0, 0);
}

+static void release_pebs_buffer(int cpu)
+{
+ struct debug_store *ds = per_cpu(cpu_hw_events, cpu).ds;
+
+ if (!ds || !x86_pmu.pebs)
+ return;
+
+ kfree((void *)(unsigned long)ds->pebs_buffer_base);
+ ds->pebs_buffer_base = 0;
+}
+
+static void release_bts_buffer(int cpu)
+{
+ struct debug_store *ds = per_cpu(cpu_hw_events, cpu).ds;
+
+ if (!ds || !x86_pmu.bts)
+ return;
+
+ kfree((void *)(unsigned long)ds->bts_buffer_base);
+ ds->bts_buffer_base = 0;
+}
+
static void release_ds_buffers(void)
{
int cpu;
@@ -82,7 +104,6 @@ static void release_ds_buffers(void)
return;

get_online_cpus();
-
for_each_online_cpu(cpu)
fini_debug_store_on_cpu(cpu);

@@ -92,13 +113,12 @@ static void release_ds_buffers(void)
if (!ds)
continue;

- per_cpu(cpu_hw_events, cpu).ds = NULL;
+ release_pebs_buffer(cpu);
+ release_bts_buffer(cpu);

- kfree((void *)(unsigned long)ds->pebs_buffer_base);
- kfree((void *)(unsigned long)ds->bts_buffer_base);
+ per_cpu(cpu_hw_events, cpu).ds = NULL;
kfree(ds);
}
-
put_online_cpus();
}


\
 
 \ /
  Last update: 2010-10-22 15:05    [from the cache]
©2003-2011 Jasper Spaans