]> git.baikalelectronics.ru Git - kernel.git/commit
perf: Correctly align perf event tracing buffer
authorFrederic Weisbecker <fweisbec@gmail.com>
Mon, 22 Mar 2010 23:08:59 +0000 (00:08 +0100)
committerFrederic Weisbecker <fweisbec@gmail.com>
Thu, 1 Apr 2010 06:26:30 +0000 (08:26 +0200)
commit43e794d0049fffa310a6e3cb55ef197ff9fcdc2e
tree0d5ebdb4a0b178fcd524d3b725da3e8a3cd6151e
parent656a0227d19826da6335cef0f298e024ed2b6f9c
perf: Correctly align perf event tracing buffer

The trace event buffer used by perf to record raw sample events
is typed as an array of char and may then not be aligned to 8
by alloc_percpu().

But we need it to be aligned to 8 in sparc64 because we cast
this buffer into a random structure type built by the TRACE_EVENT()
macro to store the traces. So if a random 64 bits field is accessed
inside, it may be not under an expected good alignment.

Use an array of long instead to force the appropriate alignment, and
perform a compile time check to ensure the size in byte of the buffer
is a multiple of sizeof(long) so that its actual size doesn't get
shrinked under us.

This fixes unaligned accesses reported while using perf lock
in sparc 64.

Suggested-by: David Miller <davem@davemloft.net>
Suggested-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: David Miller <davem@davemloft.net>
Cc: Steven Rostedt <rostedt@goodmis.org>
kernel/trace/trace_event_perf.c