diff options
author | James Hogan <james.hogan@imgtec.com> | 2012-05-30 07:11:19 -0400 |
---|---|---|
committer | James Hogan <james.hogan@imgtec.com> | 2013-03-02 15:09:16 -0500 |
commit | 649508f684751122aa302ab10f0f06cb4a88415b (patch) | |
tree | c8e4852f2470f6068880d4509d2d3a510104c9c6 /kernel/trace | |
parent | c19fa94a8fed72754e81800dfa14af6daaf6d331 (diff) |
trace/ring_buffer: handle 64bit aligned structs
Some 32 bit architectures require 64 bit values to be aligned (for
example Meta which has 64 bit read/write instructions). These require 8
byte alignment of event data too, so use
!CONFIG_HAVE_64BIT_ALIGNED_ACCESS instead of !CONFIG_64BIT ||
CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS to decide alignment, and align
buffer_data_page::data accordingly.
Signed-off-by: James Hogan <james.hogan@imgtec.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@redhat.com>
Acked-by: Steven Rostedt <rostedt@goodmis.org> (previous version subtly different)
Diffstat (limited to 'kernel/trace')
-rw-r--r-- | kernel/trace/ring_buffer.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c index ce8514feedcd..cb4524fd0cb3 100644 --- a/kernel/trace/ring_buffer.c +++ b/kernel/trace/ring_buffer.c | |||
@@ -177,7 +177,7 @@ void tracing_off_permanent(void) | |||
177 | #define RB_MAX_SMALL_DATA (RB_ALIGNMENT * RINGBUF_TYPE_DATA_TYPE_LEN_MAX) | 177 | #define RB_MAX_SMALL_DATA (RB_ALIGNMENT * RINGBUF_TYPE_DATA_TYPE_LEN_MAX) |
178 | #define RB_EVNT_MIN_SIZE 8U /* two 32bit words */ | 178 | #define RB_EVNT_MIN_SIZE 8U /* two 32bit words */ |
179 | 179 | ||
180 | #if !defined(CONFIG_64BIT) || defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) | 180 | #ifndef CONFIG_HAVE_64BIT_ALIGNED_ACCESS |
181 | # define RB_FORCE_8BYTE_ALIGNMENT 0 | 181 | # define RB_FORCE_8BYTE_ALIGNMENT 0 |
182 | # define RB_ARCH_ALIGNMENT RB_ALIGNMENT | 182 | # define RB_ARCH_ALIGNMENT RB_ALIGNMENT |
183 | #else | 183 | #else |
@@ -185,6 +185,8 @@ void tracing_off_permanent(void) | |||
185 | # define RB_ARCH_ALIGNMENT 8U | 185 | # define RB_ARCH_ALIGNMENT 8U |
186 | #endif | 186 | #endif |
187 | 187 | ||
188 | #define RB_ALIGN_DATA __aligned(RB_ARCH_ALIGNMENT) | ||
189 | |||
188 | /* define RINGBUF_TYPE_DATA for 'case RINGBUF_TYPE_DATA:' */ | 190 | /* define RINGBUF_TYPE_DATA for 'case RINGBUF_TYPE_DATA:' */ |
189 | #define RINGBUF_TYPE_DATA 0 ... RINGBUF_TYPE_DATA_TYPE_LEN_MAX | 191 | #define RINGBUF_TYPE_DATA 0 ... RINGBUF_TYPE_DATA_TYPE_LEN_MAX |
190 | 192 | ||
@@ -333,7 +335,7 @@ EXPORT_SYMBOL_GPL(ring_buffer_event_data); | |||
333 | struct buffer_data_page { | 335 | struct buffer_data_page { |
334 | u64 time_stamp; /* page time stamp */ | 336 | u64 time_stamp; /* page time stamp */ |
335 | local_t commit; /* write committed index */ | 337 | local_t commit; /* write committed index */ |
336 | unsigned char data[]; /* data of buffer page */ | 338 | unsigned char data[] RB_ALIGN_DATA; /* data of buffer page */ |
337 | }; | 339 | }; |
338 | 340 | ||
339 | /* | 341 | /* |