[PATCH] powerpc/64: Initialise thread_info for emergency stacks

Nicholas Piggin npiggin at gmail.com
Wed Jun 21 12:41:41 AEST 2017


On Wed, 21 Jun 2017 12:01:37 +1000
Michael Ellerman <mpe at ellerman.id.au> wrote:

> Nicholas Piggin <npiggin at gmail.com> writes:
> 
> > 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


More information about the Linuxppc-dev mailing list