On Fri, 22 Nov 2019 at 12:27, <glider@xxxxxxxxxx> wrote: > > KMSAN instruments the code heavily, increasing register pressure and > preventing functions from being inlined. As a result, the kernel > requires more stack space to run. > > Rename KASAN_STACK_ORDER to EXTRA_STACK_ORDER and set EXTRA_STACK_ORDER > to 2 for KMSAN builds, effectively making the stacks 4 times larger. > > Signed-off-by: Alexander Potapenko <glider@xxxxxxxxxx> > Cc: Jens Axboe <axboe@xxxxxxxxx> > Cc: Andy Lutomirski <luto@xxxxxxxxxx> > Cc: Vegard Nossum <vegard.nossum@xxxxxxxxxx> > Cc: Dmitry Vyukov <dvyukov@xxxxxxxxxx> > Cc: Christoph Hellwig <hch@xxxxxx> > Cc: linux-mm@xxxxxxxxx Acked-by: Marco Elver <elver@xxxxxxxxxx> Thanks, -- Marco > --- > > Change-Id: I1d9df161419a885bf654abff141e247366895b68 > --- > arch/x86/include/asm/page_64_types.h | 12 +++++++----- > 1 file changed, 7 insertions(+), 5 deletions(-) > > diff --git a/arch/x86/include/asm/page_64_types.h b/arch/x86/include/asm/page_64_types.h > index 288b065955b7..ea9fbf09f43b 100644 > --- a/arch/x86/include/asm/page_64_types.h > +++ b/arch/x86/include/asm/page_64_types.h > @@ -7,18 +7,20 @@ > #endif > > #ifdef CONFIG_KASAN > -#define KASAN_STACK_ORDER 1 > +#define EXTRA_STACK_ORDER 1 > +#elif defined(CONFIG_KMSAN) > +#define EXTRA_STACK_ORDER 2 > #else > -#define KASAN_STACK_ORDER 0 > +#define EXTRA_STACK_ORDER 0 > #endif > > -#define THREAD_SIZE_ORDER (2 + KASAN_STACK_ORDER) > +#define THREAD_SIZE_ORDER (2 + EXTRA_STACK_ORDER) > #define THREAD_SIZE (PAGE_SIZE << THREAD_SIZE_ORDER) > > -#define EXCEPTION_STACK_ORDER (0 + KASAN_STACK_ORDER) > +#define EXCEPTION_STACK_ORDER (0 + EXTRA_STACK_ORDER) > #define EXCEPTION_STKSZ (PAGE_SIZE << EXCEPTION_STACK_ORDER) > > -#define IRQ_STACK_ORDER (2 + KASAN_STACK_ORDER) > +#define IRQ_STACK_ORDER (2 + EXTRA_STACK_ORDER) > #define IRQ_STACK_SIZE (PAGE_SIZE << IRQ_STACK_ORDER) > > /* > -- > 2.24.0.432.g9d3f5f5b63-goog >