Skip to content

Commit f534332

Browse files
jognesspmladek
authored andcommitted
printk: cpu sync always disable interrupts
The CPU sync functions are a NOP for !CONFIG_SMP. But for !CONFIG_SMP they still need to disable interrupts in order to preserve context within the CPU sync sections. Signed-off-by: John Ogness <[email protected]> Reviewed-by: Petr Mladek <[email protected]> Reviewed-by: Sergey Senozhatsky <[email protected]> Signed-off-by: Petr Mladek <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent faebd69 commit f534332

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

include/linux/printk.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -281,9 +281,16 @@ extern int __printk_cpu_sync_try_get(void);
281281
extern void __printk_cpu_sync_wait(void);
282282
extern void __printk_cpu_sync_put(void);
283283

284+
#else
285+
286+
#define __printk_cpu_sync_try_get() true
287+
#define __printk_cpu_sync_wait()
288+
#define __printk_cpu_sync_put()
289+
#endif /* CONFIG_SMP */
290+
284291
/**
285-
* printk_cpu_sync_get_irqsave() - Acquire the printk cpu-reentrant spinning
286-
* lock and disable interrupts.
292+
* printk_cpu_sync_get_irqsave() - Disable interrupts and acquire the printk
293+
* cpu-reentrant spinning lock.
287294
* @flags: Stack-allocated storage for saving local interrupt state,
288295
* to be passed to printk_cpu_sync_put_irqrestore().
289296
*
@@ -322,13 +329,6 @@ extern void __printk_cpu_sync_put(void);
322329
local_irq_restore(flags); \
323330
} while (0)
324331

325-
#else
326-
327-
#define printk_cpu_sync_get_irqsave(flags) ((void)flags)
328-
#define printk_cpu_sync_put_irqrestore(flags) ((void)flags)
329-
330-
#endif /* CONFIG_SMP */
331-
332332
extern int kptr_restrict;
333333

334334
/**

0 commit comments

Comments
 (0)