Re: [tip:x86/irq] x86: Always use irq stacks

From: Steven Rostedt
Date: Fri Jul 23 2010 - 10:24:10 EST


On Fri, 2010-07-23 at 10:15 -0400, Steven Rostedt wrote:
> On Wed, 2010-07-14 at 17:47 +0200, Christoph Hellwig wrote:

> In arch/x86/kernel/dumpstack_32.c:
>
> context = (struct thread_info *)
> ((unsigned long)stack & (~(THREAD_SIZE - 1)));
> bp = ops->walk_stack(context, stack, bp, ops, data, NULL, &graph);
>
> Note: here, context (which ends up being tinfo) is just a bitmasking of
> the current stack. If the stack is the irqstack, then what is passed to
> walk_stack() is not the actual thread info structure.
>
> Note, if THREAD_SIZE is 8k and irqstacks are 4K then context is totally
> wrong here.

irqstacks are indeed 8k as well, but:

union irq_ctx {
struct thread_info tinfo;
u32 stack[THREAD_SIZE/sizeof(u32)];
} __attribute__((aligned(PAGE_SIZE)));


The stack is 8k, but it is aligned 4k. Which will have

context = (struct thread_info *)
((unsigned long)stack & (~(THREAD_SIZE - 1)));

not give the expected result.

So we should do:

} __attribute__((aligned(THREAD_SIZE)));

-- Steve


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/