aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorPeter Zijlstra <a.p.zijlstra@chello.nl>2010-10-19 08:08:29 -0400
committerIngo Molnar <mingo@elte.hu>2010-10-22 08:18:24 -0400
commitb39f88acd7d989b6b247ba87c480fc24ed71d9c5 (patch)
tree10a314af9f587b262dc5e7fd5bc7a9d94b19739a /arch
parentd4429f608abde89e8bc1e24b43cd503feb95c496 (diff)
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>
Diffstat (limited to 'arch')
-rw-r--r--arch/x86/kernel/cpu/perf_event_intel_ds.c30
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 4977f9c400e5..1bc13518dd59 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)
74 wrmsr_on_cpu(cpu, MSR_IA32_DS_AREA, 0, 0); 74 wrmsr_on_cpu(cpu, MSR_IA32_DS_AREA, 0, 0);
75} 75}
76 76
77static void release_pebs_buffer(int cpu)
78{
79 struct debug_store *ds = per_cpu(cpu_hw_events, cpu).ds;
80
81 if (!ds || !x86_pmu.pebs)
82 return;
83
84 kfree((void *)(unsigned long)ds->pebs_buffer_base);
85 ds->pebs_buffer_base = 0;
86}
87
88static void release_bts_buffer(int cpu)
89{
90 struct debug_store *ds = per_cpu(cpu_hw_events, cpu).ds;
91
92 if (!ds || !x86_pmu.bts)
93 return;
94
95 kfree((void *)(unsigned long)ds->bts_buffer_base);
96 ds->bts_buffer_base = 0;
97}
98
77static void release_ds_buffers(void) 99static void release_ds_buffers(void)
78{ 100{
79 int cpu; 101 int cpu;
@@ -82,7 +104,6 @@ static void release_ds_buffers(void)
82 return; 104 return;
83 105
84 get_online_cpus(); 106 get_online_cpus();
85
86 for_each_online_cpu(cpu) 107 for_each_online_cpu(cpu)
87 fini_debug_store_on_cpu(cpu); 108 fini_debug_store_on_cpu(cpu);
88 109
@@ -92,13 +113,12 @@ static void release_ds_buffers(void)
92 if (!ds) 113 if (!ds)
93 continue; 114 continue;
94 115
95 per_cpu(cpu_hw_events, cpu).ds = NULL; 116 release_pebs_buffer(cpu);
117 release_bts_buffer(cpu);
96 118
97 kfree((void *)(unsigned long)ds->pebs_buffer_base); 119 per_cpu(cpu_hw_events, cpu).ds = NULL;
98 kfree((void *)(unsigned long)ds->bts_buffer_base);
99 kfree(ds); 120 kfree(ds);
100 } 121 }
101
102 put_online_cpus(); 122 put_online_cpus();
103} 123}
104 124