diff options
author | Peter Zijlstra <a.p.zijlstra@chello.nl> | 2010-03-03 09:55:04 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2010-03-10 07:22:23 -0500 |
commit | dc1d628a67a8f042e711ea5accc0beedc3ef0092 (patch) | |
tree | 728f72a5f9a8368b225890a95ea947c1c8cda301 /arch/powerpc | |
parent | 548b84166917d6f5e2296123b85ad24aecd3801d (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>
Cc: stable@kernel.org
LKML-Reference: <20100304140100.315416040@chello.nl>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/powerpc')
-rw-r--r-- | arch/powerpc/kernel/perf_event.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/arch/powerpc/kernel/perf_event.c b/arch/powerpc/kernel/perf_event.c index b6cf8f1f4d35..5120bd44f69a 100644 --- a/arch/powerpc/kernel/perf_event.c +++ b/arch/powerpc/kernel/perf_event.c | |||
@@ -1164,10 +1164,10 @@ static void record_and_restart(struct perf_event *event, unsigned long val, | |||
1164 | * Finally record data if requested. | 1164 | * Finally record data if requested. |
1165 | */ | 1165 | */ |
1166 | if (record) { | 1166 | if (record) { |
1167 | struct perf_sample_data data = { | 1167 | struct perf_sample_data data; |
1168 | .addr = ~0ULL, | 1168 | |
1169 | .period = event->hw.last_period, | 1169 | perf_sample_data_init(&data, ~0ULL); |
1170 | }; | 1170 | data.period = event->hw.last_period; |
1171 | 1171 | ||
1172 | if (event->attr.sample_type & PERF_SAMPLE_ADDR) | 1172 | if (event->attr.sample_type & PERF_SAMPLE_ADDR) |
1173 | perf_get_data_addr(regs, &data.addr); | 1173 | perf_get_data_addr(regs, &data.addr); |