Messages in this thread | | | Date | Tue, 6 Feb 2024 11:21:06 +0100 | From | Petr Mladek <> | Subject | Re: [PATCH 2/4] watchdog/softlockup: Use printk_cpu_sync_get_irqsave() to serialize reporting |
| |
On Fri 2023-12-22 10:36:37, John Ogness wrote: > On 2023-12-20, Douglas Anderson <dianders@chromium.org> wrote: > > Instead of introducing a spinlock, use printk_cpu_sync_get_irqsave() > > and printk_cpu_sync_put_irqrestore() to serialize softlockup > > reporting. Alone this doesn't have any real advantage over the > > spinlock, but this will allow us to use the same function in a future > > change to also serialize hardlockup crawls. > > Thanks for this change. For me, this is the preferred workaround to > best-effort serialize a particular type of output.
I agree.
The good thing is that dump_stack_lvl() and nmi_cpu_backtrace() use this lock on its known. Also nmi_trigger_cpumask_backtrace() prevents parallel calls. It means that the particular backtraces should be serialized for most callers.
> Hopefully one day we > will get to implementing printk contexts [0] [1] so that message blocks > can be inserted atomically.
I didn't think about this possibility. You are right. It might be even better than the printk_cpu_sync_put_irqrestore() because it allows passing the lock to a higher priority context and supports timeout.
Best Regards, Petr
| |