diff options
author | Peter Zijlstra <peterz@infradead.org> | 2010-03-18 21:00:19 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-04-01 19:01:29 -0400 |
commit | 06432c9591a2607d70580333a50aba19344e2e40 (patch) | |
tree | cb1706f959b0dc06ef81ef1cd8378f634be53155 /arch/x86/kernel | |
parent | f3cfe648b427db8768a1039cfd201842ae8a4a1d (diff) |
perf: Provide generic perf_sample_data initialization
This makes it easier to extend perf_sample_data and fixes a bug on arm
and sparc, which failed to set ->raw to NULL, which can cause crashes
when combined with PERF_SAMPLE_RAW.
It also optimizes PowerPC and tracepoint, because the struct
initialization is forced to zero out the whole structure.
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Acked-by: Jean Pihet <jpihet@mvista.com>
Reviewed-by: Frederic Weisbecker <fweisbec@gmail.com>
Acked-by: David S. Miller <davem@davemloft.net>
Cc: Jamie Iles <jamie.iles@picochip.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Stephane Eranian <eranian@google.com>
LKML-Reference: <20100304140100.315416040@chello.nl>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'arch/x86/kernel')
-rw-r--r-- | arch/x86/kernel/cpu/perf_event.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/arch/x86/kernel/cpu/perf_event.c b/arch/x86/kernel/cpu/perf_event.c index 8c1c07073ccc..98819b32bb5f 100644 --- a/arch/x86/kernel/cpu/perf_event.c +++ b/arch/x86/kernel/cpu/perf_event.c | |||
@@ -1636,10 +1636,9 @@ static void intel_pmu_drain_bts_buffer(struct cpu_hw_events *cpuc) | |||
1636 | 1636 | ||
1637 | ds->bts_index = ds->bts_buffer_base; | 1637 | ds->bts_index = ds->bts_buffer_base; |
1638 | 1638 | ||
1639 | perf_sample_data_init(&data, 0); | ||
1639 | 1640 | ||
1640 | data.period = event->hw.last_period; | 1641 | data.period = event->hw.last_period; |
1641 | data.addr = 0; | ||
1642 | data.raw = NULL; | ||
1643 | regs.ip = 0; | 1642 | regs.ip = 0; |
1644 | 1643 | ||
1645 | /* | 1644 | /* |
@@ -1756,8 +1755,7 @@ static int p6_pmu_handle_irq(struct pt_regs *regs) | |||
1756 | int idx, handled = 0; | 1755 | int idx, handled = 0; |
1757 | u64 val; | 1756 | u64 val; |
1758 | 1757 | ||
1759 | data.addr = 0; | 1758 | perf_sample_data_init(&data, 0); |
1760 | data.raw = NULL; | ||
1761 | 1759 | ||
1762 | cpuc = &__get_cpu_var(cpu_hw_events); | 1760 | cpuc = &__get_cpu_var(cpu_hw_events); |
1763 | 1761 | ||
@@ -1802,8 +1800,7 @@ static int intel_pmu_handle_irq(struct pt_regs *regs) | |||
1802 | int bit, loops; | 1800 | int bit, loops; |
1803 | u64 ack, status; | 1801 | u64 ack, status; |
1804 | 1802 | ||
1805 | data.addr = 0; | 1803 | perf_sample_data_init(&data, 0); |
1806 | data.raw = NULL; | ||
1807 | 1804 | ||
1808 | cpuc = &__get_cpu_var(cpu_hw_events); | 1805 | cpuc = &__get_cpu_var(cpu_hw_events); |
1809 | 1806 | ||