Re: printk: selective deactivation of feature ignoring non panic cpu's messages

From: Donghyeok Choe
Date: Mon Mar 17 2025 - 01:08:43 EST


On Tue, Mar 04, 2025 at 03:15:46PM +0100, Petr Mladek wrote:
> 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
> > 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.


Hi Petr Mladek,

This is gentle remind.

I did upload the patch containing the above contents.
Link: https://lore.kernel.org/all/20250305044046.1249972-1-d7271.choe@xxxxxxxxxxx/

Even if it's not necessarily this patch, I hope the content will be applied.
When can the 'printk_debug_non_panic_cpus' function be reflected
in mainline source code?


Thanks.