diff options
author | John Ogness <john.ogness@linutronix.de> | 2022-11-16 17:27:25 +0106 |
---|---|---|
committer | Petr Mladek <pmladek@suse.com> | 2022-12-02 11:25:00 +0100 |
commit | 12335446e06f1b3c9112576f894df856d3d466fc (patch) | |
tree | 9ca390c663e7d8e8c159319bfc60965b03f285e6 /arch/um | |
parent | 100bdef2c198b8dc64df011dc4a2152db913c8ba (diff) | |
download | linux-stable-12335446e06f1b3c9112576f894df856d3d466fc.tar.gz linux-stable-12335446e06f1b3c9112576f894df856d3d466fc.tar.bz2 linux-stable-12335446e06f1b3c9112576f894df856d3d466fc.zip |
um: kmsg_dumper: use srcu console list iterator
Rather than using the console_lock to guarantee safe console list
traversal, use srcu console list iteration.
Signed-off-by: John Ogness <john.ogness@linutronix.de>
Reviewed-by: Petr Mladek <pmladek@suse.com>
Signed-off-by: Petr Mladek <pmladek@suse.com>
Link: https://lore.kernel.org/r/20221116162152.193147-14-john.ogness@linutronix.de
Diffstat (limited to 'arch/um')
-rw-r--r-- | arch/um/kernel/kmsg_dump.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/arch/um/kernel/kmsg_dump.c b/arch/um/kernel/kmsg_dump.c index 40abf1e9ccb1..427dd5a61a38 100644 --- a/arch/um/kernel/kmsg_dump.c +++ b/arch/um/kernel/kmsg_dump.c @@ -16,29 +16,26 @@ static void kmsg_dumper_stdout(struct kmsg_dumper *dumper, struct console *con; unsigned long flags; size_t len = 0; + int cookie; /* * If no consoles are available to output crash information, dump * the kmsg buffer to stdout. */ - if (!console_trylock()) - return; - - for_each_console(con) { + cookie = console_srcu_read_lock(); + for_each_console_srcu(con) { /* * The ttynull console and disabled consoles are ignored * since they cannot output. All other consoles are * expected to output the crash information. */ if (strcmp(con->name, "ttynull") != 0 && - (con->flags & CON_ENABLED)) { + (console_srcu_read_flags(con) & CON_ENABLED)) { break; } } - - console_unlock(); - + console_srcu_read_unlock(cookie); if (con) return; |