Commit 782cc5ae authored by Markus Metzger's avatar Markus Metzger Committed by Ingo Molnar

x86, ds: fix buffer alignment in debug store selftest

The debug store selftest code uses a stack-allocated buffer, which is
not necessarily correctly aligned.

For tests using a buffer to hold a single entry, the buffer that is
passed to ds_request must already be suitably aligned.

Pass a suitably aligned portion of the bigger buffer.

[ Impact: fix hw-branch-tracer self-test failure ]
Signed-off-by: default avatarMarkus Metzger <markus.t.metzger@intel.com>
Cc: markus.t.metzger@gmail.com
LKML-Reference: <20090424094309.A30145@sedona.ch.intel.com>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent 416dfdcd
...@@ -323,13 +323,15 @@ static int ds_selftest_bts_bad_request_task(void *buffer) ...@@ -323,13 +323,15 @@ static int ds_selftest_bts_bad_request_task(void *buffer)
int ds_selftest_bts(void) int ds_selftest_bts(void)
{ {
struct ds_selftest_bts_conf conf; struct ds_selftest_bts_conf conf;
unsigned char buffer[BUFFER_SIZE]; unsigned char buffer[BUFFER_SIZE], *small_buffer;
unsigned long irq; unsigned long irq;
int cpu; int cpu;
printk(KERN_INFO "[ds] bts selftest..."); printk(KERN_INFO "[ds] bts selftest...");
conf.error = 0; conf.error = 0;
small_buffer = (unsigned char *)ALIGN((unsigned long)buffer, 8) + 8;
get_online_cpus(); get_online_cpus();
for_each_online_cpu(cpu) { for_each_online_cpu(cpu) {
conf.suspend = ds_suspend_bts_wrap; conf.suspend = ds_suspend_bts_wrap;
...@@ -381,7 +383,7 @@ int ds_selftest_bts(void) ...@@ -381,7 +383,7 @@ int ds_selftest_bts(void)
conf.suspend = ds_suspend_bts_noirq; conf.suspend = ds_suspend_bts_noirq;
conf.resume = ds_resume_bts_noirq; conf.resume = ds_resume_bts_noirq;
conf.tracer = conf.tracer =
ds_request_bts_task(current, buffer, SMALL_BUFFER_SIZE, ds_request_bts_task(current, small_buffer, SMALL_BUFFER_SIZE,
NULL, (size_t)-1, BTS_KERNEL); NULL, (size_t)-1, BTS_KERNEL);
local_irq_save(irq); local_irq_save(irq);
ds_selftest_bts_cpu(&conf); ds_selftest_bts_cpu(&conf);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment