Re: printk: selective deactivation of feature ignoring non panic cpu's messages
From: Petr Mladek
Date: Tue Mar 04 2025 - 09:17:37 EST
On Tue 2025-03-04 15:05:52, John Ogness wrote:
> On 2025-03-04, Petr Mladek <pmladek@xxxxxxxx> wrote:
> > I mean something like:
> >
> > --- a/kernel/printk/printk_ringbuffer.c
> > +++ b/kernel/printk/printk_ringbuffer.c
> > @@ -2143,7 +2143,9 @@ static bool _prb_read_valid(struct printk_ringbuffer *rb, u64 *seq,
> > * But it would have the sequence number returned
> > * by "prb_next_reserve_seq() - 1".
> > */
> > - if (this_cpu_in_panic() && ((*seq + 1) < prb_next_reserve_seq(rb)))
> > + if (this_cpu_in_panic() &&
> > + (!printk_debug_non_panic_cpus || legacy_allow_panic_sync) &&
> > + ((*seq + 1) < prb_next_reserve_seq(rb)))
> > (*seq)++;
> > else
> > return false;
>
> Ah, OK. Thanks for the clarification
>
> > OK, I propose the following changes:
> >
> > + rename the option to "printk_debug_non_panic_cpus"
> >
> > + do not skip the messages in _prb_read_valid() when this option
> > is used before the non-panic CPUs are stopped.
>
> And of course:
>
> + allow non-panic CPUs in panic to store messages when this option
> is set
Yes.
> I would also keep the dump_stack_lvl() implementation as it is, even if
> it could lead to interweaving of backtraces. Anyone using
> printk_debug_non_panic_cpus should have CONFIG_PRINTK_CALLER enabled.
I agree.
Best Regards,
Petr