Skip to content

Commit 3d9a0a2

Browse files
Sreenath Vijayanpmladek
authored andcommitted
printk: Rename console_replay_all() and update context
Rename console_replay_all() to console_try_replay_all() to make clear that the implementation is best effort. Also, the function should not be called in NMI context as it takes locks, so update the comment in code. Fixes: 693f75b ("printk: Add function to replay kernel log on consoles") Fixes: 1b74348 ("tty/sysrq: Replay kernel log messages on consoles via sysrq") Suggested-by: Petr Mladek <[email protected]> Signed-off-by: Shimoyashiki Taichi <[email protected]> Signed-off-by: Sreenath Vijayan <[email protected]> Link: https://lore.kernel.org/r/Zlguq/[email protected]@sony.com Reviewed-by: Petr Mladek <[email protected]> Signed-off-by: Petr Mladek <[email protected]>
1 parent 1613e60 commit 3d9a0a2

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

drivers/tty/sysrq.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,7 @@ static const struct sysrq_key_op sysrq_unrt_op = {
452452

453453
static void sysrq_handle_replay_logs(u8 key)
454454
{
455-
console_replay_all();
455+
console_try_replay_all();
456456
}
457457
static struct sysrq_key_op sysrq_replay_logs_op = {
458458
.handler = sysrq_handle_replay_logs,

include/linux/printk.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ void show_regs_print_info(const char *log_lvl);
195195
extern asmlinkage void dump_stack_lvl(const char *log_lvl) __cold;
196196
extern asmlinkage void dump_stack(void) __cold;
197197
void printk_trigger_flush(void);
198-
void console_replay_all(void);
198+
void console_try_replay_all(void);
199199
#else
200200
static inline __printf(1, 0)
201201
int vprintk(const char *s, va_list args)
@@ -275,7 +275,7 @@ static inline void dump_stack(void)
275275
static inline void printk_trigger_flush(void)
276276
{
277277
}
278-
static inline void console_replay_all(void)
278+
static inline void console_try_replay_all(void)
279279
{
280280
}
281281
#endif

kernel/printk/printk.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4314,15 +4314,15 @@ void kmsg_dump_rewind(struct kmsg_dump_iter *iter)
43144314
EXPORT_SYMBOL_GPL(kmsg_dump_rewind);
43154315

43164316
/**
4317-
* console_replay_all - replay kernel log on consoles
4317+
* console_try_replay_all - try to replay kernel log on consoles
43184318
*
43194319
* Try to obtain lock on console subsystem and replay all
43204320
* available records in printk buffer on the consoles.
43214321
* Does nothing if lock is not obtained.
43224322
*
4323-
* Context: Any context.
4323+
* Context: Any, except for NMI.
43244324
*/
4325-
void console_replay_all(void)
4325+
void console_try_replay_all(void)
43264326
{
43274327
if (console_trylock()) {
43284328
__console_rewind_all();

0 commit comments

Comments
 (0)