Re: [PATCH v3] softlockup: serialized softlockup's log
From: Petr Mladek
Date: Mon Nov 27 2023 - 12:32:36 EST
On Thu 2023-11-23 16:40:22, lizhe.67@xxxxxxxxxxxxx wrote:
> From: Li Zhe <lizhe.67@xxxxxxxxxxxxx>
>
> If multiple CPUs trigger softlockup at the same time with
> 'softlockup_all_cpu_backtrace=0', the softlockup's logs will appear
> staggeredly in dmesg, which will affect the viewing of the logs for
> developer. Since the code path for outputting softlockup logs is not
> a kernel hotspot and the performance requirements for the code are
> not strict, locks are used to serialize the softlockup log output to
> improve the readability of the logs.
>
> Signed-off-by: Li Zhe <lizhe.67@xxxxxxxxxxxxx>
I do not feel fully comfortable with adding a lock into a code path
which reports system lockups. There might already be a deadlock on
the system and yet another lock would not make things easier.
On the other hand, the added spinlock looks pretty safe:
+ It synchronizes only watchdog_timer_fn() calls against each other.
watchdog_timer_fn() could not be nested.
+ The locked code seems to be synchronized only by RCU
and does not wait for other CPUs to finish something.
I haven't found any real deadlock scenario. Feel free
to use:
Reviewed-by: Petr Mladek <pmladek@xxxxxxxx>
Best Regards,
Petr