mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-09-18 22:14:16 +00:00
printk: Prepare for nested printk_nmi_enter()
There is plenty of space in the printk_context variable. Reserve one byte there for the NMI context to be on the safe side. It should never overflow. The BUG_ON(in_nmi() == NMI_MASK) in nmi_enter() will trigger much earlier. Signed-off-by: Petr Mladek <pmladek@suse.com> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Alexandre Chartre <alexandre.chartre@oracle.com> Link: https://lkml.kernel.org/r/20200505134100.681374113@linutronix.de
This commit is contained in:
parent
1ed0948eea
commit
8c4e93c362
2 changed files with 7 additions and 5 deletions
|
@ -6,9 +6,11 @@
|
||||||
|
|
||||||
#ifdef CONFIG_PRINTK
|
#ifdef CONFIG_PRINTK
|
||||||
|
|
||||||
#define PRINTK_SAFE_CONTEXT_MASK 0x3fffffff
|
#define PRINTK_SAFE_CONTEXT_MASK 0x007ffffff
|
||||||
#define PRINTK_NMI_DIRECT_CONTEXT_MASK 0x40000000
|
#define PRINTK_NMI_DIRECT_CONTEXT_MASK 0x008000000
|
||||||
#define PRINTK_NMI_CONTEXT_MASK 0x80000000
|
#define PRINTK_NMI_CONTEXT_MASK 0xff0000000
|
||||||
|
|
||||||
|
#define PRINTK_NMI_CONTEXT_OFFSET 0x010000000
|
||||||
|
|
||||||
extern raw_spinlock_t logbuf_lock;
|
extern raw_spinlock_t logbuf_lock;
|
||||||
|
|
||||||
|
|
|
@ -295,12 +295,12 @@ static __printf(1, 0) int vprintk_nmi(const char *fmt, va_list args)
|
||||||
|
|
||||||
void notrace printk_nmi_enter(void)
|
void notrace printk_nmi_enter(void)
|
||||||
{
|
{
|
||||||
this_cpu_or(printk_context, PRINTK_NMI_CONTEXT_MASK);
|
this_cpu_add(printk_context, PRINTK_NMI_CONTEXT_OFFSET);
|
||||||
}
|
}
|
||||||
|
|
||||||
void notrace printk_nmi_exit(void)
|
void notrace printk_nmi_exit(void)
|
||||||
{
|
{
|
||||||
this_cpu_and(printk_context, ~PRINTK_NMI_CONTEXT_MASK);
|
this_cpu_sub(printk_context, PRINTK_NMI_CONTEXT_OFFSET);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Add table
Reference in a new issue