diff options
author | Sebastian Andrzej Siewior <bigeasy@linutronix.de> | 2024-08-20 08:35:30 +0206 |
---|---|---|
committer | Petr Mladek <pmladek@suse.com> | 2024-08-21 14:56:22 +0200 |
commit | 0e1d5731d3c1e2214249ef36dcd13ad51ad304cf (patch) | |
tree | 233495ac5884d8db4a5e60afaa81e77e58989c4a /kernel/printk | |
parent | d3ff380d47b6312d537c00829008528d1caad639 (diff) | |
download | linux-0e1d5731d3c1e2214249ef36dcd13ad51ad304cf.tar.gz linux-0e1d5731d3c1e2214249ef36dcd13ad51ad304cf.tar.bz2 linux-0e1d5731d3c1e2214249ef36dcd13ad51ad304cf.zip |
printk: Check printk_deferred_enter()/_exit() usage
Add validation that printk_deferred_enter()/_exit() are called in
non-migration contexts.
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: John Ogness <john.ogness@linutronix.de>
Reviewed-by: Petr Mladek <pmladek@suse.com>
Link: https://lore.kernel.org/r/20240820063001.36405-5-john.ogness@linutronix.de
Signed-off-by: Petr Mladek <pmladek@suse.com>
Diffstat (limited to 'kernel/printk')
-rw-r--r-- | kernel/printk/internal.h | 3 | ||||
-rw-r--r-- | kernel/printk/printk_safe.c | 12 |
2 files changed, 15 insertions, 0 deletions
diff --git a/kernel/printk/internal.h b/kernel/printk/internal.h index 398ecb40d279..dc8bc0890fd2 100644 --- a/kernel/printk/internal.h +++ b/kernel/printk/internal.h @@ -53,6 +53,9 @@ int vprintk_store(int facility, int level, __printf(1, 0) int vprintk_default(const char *fmt, va_list args); __printf(1, 0) int vprintk_deferred(const char *fmt, va_list args); +void __printk_safe_enter(void); +void __printk_safe_exit(void); + bool printk_percpu_data_ready(void); #define printk_safe_enter_irqsave(flags) \ diff --git a/kernel/printk/printk_safe.c b/kernel/printk/printk_safe.c index 6d10927a07d8..4421ccac3113 100644 --- a/kernel/printk/printk_safe.c +++ b/kernel/printk/printk_safe.c @@ -26,6 +26,18 @@ void __printk_safe_exit(void) this_cpu_dec(printk_context); } +void __printk_deferred_enter(void) +{ + cant_migrate(); + __printk_safe_enter(); +} + +void __printk_deferred_exit(void) +{ + cant_migrate(); + __printk_safe_exit(); +} + asmlinkage int vprintk(const char *fmt, va_list args) { #ifdef CONFIG_KGDB_KDB |