mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-22 07:53:11 -05:00
Merge branch 'for-6.14-cpu_sync-fixup' into for-linus
This commit is contained in:
commit
4859bcd7a5
3 changed files with 17 additions and 10 deletions
|
@ -338,3 +338,9 @@ bool printk_get_next_message(struct printk_message *pmsg, u64 seq,
|
||||||
void console_prepend_dropped(struct printk_message *pmsg, unsigned long dropped);
|
void console_prepend_dropped(struct printk_message *pmsg, unsigned long dropped);
|
||||||
void console_prepend_replay(struct printk_message *pmsg);
|
void console_prepend_replay(struct printk_message *pmsg);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_SMP
|
||||||
|
bool is_printk_cpu_sync_owner(void);
|
||||||
|
#else
|
||||||
|
static inline bool is_printk_cpu_sync_owner(void) { return false; }
|
||||||
|
#endif
|
||||||
|
|
|
@ -4922,6 +4922,11 @@ void console_try_replay_all(void)
|
||||||
static atomic_t printk_cpu_sync_owner = ATOMIC_INIT(-1);
|
static atomic_t printk_cpu_sync_owner = ATOMIC_INIT(-1);
|
||||||
static atomic_t printk_cpu_sync_nested = ATOMIC_INIT(0);
|
static atomic_t printk_cpu_sync_nested = ATOMIC_INIT(0);
|
||||||
|
|
||||||
|
bool is_printk_cpu_sync_owner(void)
|
||||||
|
{
|
||||||
|
return (atomic_read(&printk_cpu_sync_owner) == raw_smp_processor_id());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* __printk_cpu_sync_wait() - Busy wait until the printk cpu-reentrant
|
* __printk_cpu_sync_wait() - Busy wait until the printk cpu-reentrant
|
||||||
* spinning lock is not owned by any CPU.
|
* spinning lock is not owned by any CPU.
|
||||||
|
|
|
@ -61,10 +61,15 @@ bool is_printk_legacy_deferred(void)
|
||||||
/*
|
/*
|
||||||
* The per-CPU variable @printk_context can be read safely in any
|
* The per-CPU variable @printk_context can be read safely in any
|
||||||
* context. CPU migration is always disabled when set.
|
* context. CPU migration is always disabled when set.
|
||||||
|
*
|
||||||
|
* A context holding the printk_cpu_sync must not spin waiting for
|
||||||
|
* another CPU. For legacy printing, it could be the console_lock
|
||||||
|
* or the port lock.
|
||||||
*/
|
*/
|
||||||
return (force_legacy_kthread() ||
|
return (force_legacy_kthread() ||
|
||||||
this_cpu_read(printk_context) ||
|
this_cpu_read(printk_context) ||
|
||||||
in_nmi());
|
in_nmi() ||
|
||||||
|
is_printk_cpu_sync_owner());
|
||||||
}
|
}
|
||||||
|
|
||||||
asmlinkage int vprintk(const char *fmt, va_list args)
|
asmlinkage int vprintk(const char *fmt, va_list args)
|
||||||
|
@ -74,15 +79,6 @@ asmlinkage int vprintk(const char *fmt, va_list args)
|
||||||
if (unlikely(kdb_trap_printk && kdb_printf_cpu < 0))
|
if (unlikely(kdb_trap_printk && kdb_printf_cpu < 0))
|
||||||
return vkdb_printf(KDB_MSGSRC_PRINTK, fmt, args);
|
return vkdb_printf(KDB_MSGSRC_PRINTK, fmt, args);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
|
||||||
* Use the main logbuf even in NMI. But avoid calling console
|
|
||||||
* drivers that might have their own locks.
|
|
||||||
*/
|
|
||||||
if (is_printk_legacy_deferred())
|
|
||||||
return vprintk_deferred(fmt, args);
|
|
||||||
|
|
||||||
/* No obstacles. */
|
|
||||||
return vprintk_default(fmt, args);
|
return vprintk_default(fmt, args);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(vprintk);
|
EXPORT_SYMBOL(vprintk);
|
||||||
|
|
Loading…
Reference in a new issue