Messages in this thread | | | Date | Thu, 13 Apr 2023 14:20:47 +0200 | From | Petr Mladek <> | Subject | Re: [PATCH printk v1 18/18] printk: Perform atomic flush in console_flush_on_panic() |
| |
On Thu 2023-03-02 21:02:18, John Ogness wrote: > Typically the panic() function will take care of atomic flushing the > non-BKL consoles on panic. However, there are several users of > console_flush_on_panic() outside of panic(). > > Also perform atomic flushing in console_flush_on_panic(). A new > function cons_force_seq() is implemented to support the > mode=CONSOLE_REPLAY_ALL feature. > > --- a/kernel/printk/printk.c > +++ b/kernel/printk/printk.c > @@ -3160,6 +3160,28 @@ void console_unblank(void) > */ > void console_flush_on_panic(enum con_flush_mode mode) > { > + struct console *c; > + short flags; > + int cookie; > + u64 seq; > + > + seq = prb_first_valid_seq(prb); > + > + /* > + * Safely flush the atomic consoles before trying to flush any > + * BKL/legacy consoles. > + */ > + if (mode == CONSOLE_REPLAY_ALL) { > + cookie = console_srcu_read_lock(); > + for_each_console_srcu(c) { > + flags = console_srcu_read_flags(c); > + if (flags & CON_NO_BKL) > + cons_force_seq(c, seq); > + } > + console_srcu_read_unlock(cookie); > + } > + cons_atomic_flush(NULL, true); > + > if (!have_bkl_console) > return; > > @@ -3174,12 +3196,6 @@ void console_flush_on_panic(enum con_flush_mode mode) > console_may_schedule = 0; > > if (mode == CONSOLE_REPLAY_ALL) { > - struct console *c; > - int cookie; > - u64 seq; > - > - seq = prb_first_valid_seq(prb); > - > cookie = console_srcu_read_lock(); > for_each_console_srcu(c) { > /*
The code in this for_each_console_srcu(c) will reset r->seq for all consoles, including NO_BLK ones. It should do it only for the legacy consoles.
Best Regards, Petr
| |