Re: [PATCH] powerpc/64: Initialise thread_info for emergency stacks
From: Nicholas Piggin <npiggin@gmail.com>
Date: 2017-06-21 02:41:58
On Wed, 21 Jun 2017 12:01:37 +1000 Michael Ellerman [off-list ref] wrote:
Nicholas Piggin [off-list ref] writes:quoted
diff --git a/arch/powerpc/include/asm/thread_info.h b/arch/powerpc/include/asm/thread_info.h index a941cc6fc3e9..5995e4b2996d 100644 --- a/arch/powerpc/include/asm/thread_info.h +++ b/arch/powerpc/include/asm/thread_info.h@@ -62,6 +63,24 @@ struct thread_info { #define THREAD_SIZE_ORDER (THREAD_SHIFT - PAGE_SHIFT) +/* + * Emergency stacks are used for a range of things, from asynchronous + * NMIs (system reset, machine check) to synchronous, process context. + * Set HARDIRQ_OFFSET because we don't know exactly what context we + * come from or if it had a valid stack, which is about the best we + * can do. + * TODO: what to do with accounting? + */ +#define emstack_init_thread_info(ti, c) \ +do { \ + (ti)->task = NULL; \ + (ti)->cpu = (c); \ + (ti)->preempt_count = HARDIRQ_OFFSET; \ + (ti)->local_flags = 0; \ + (ti)->flags = 0; \ + klp_init_thread_info(ti); \ +} while (0)Why don't we just bzero() the whole thing? Like we do for the other stacks?
Wouldn't hurt to. Thanks, Nick