[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 05/30] misc/pvpanic: Convert regular spinlock into trylock on panic path
- To: "Guilherme G. Piccoli" <gpiccoli@xxxxxxxxxx>
- From: Petr Mladek <pmladek@xxxxxxxx>
- Date: Tue, 10 May 2022 14:14:16 +0200
- Cc: akpm@xxxxxxxxxxxxxxxxxxxx, bhe@xxxxxxxxxx, kexec@xxxxxxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx, bcm-kernel-feedback-list@xxxxxxxxxxxx, coresight@xxxxxxxxxxxxxxxx, linuxppc-dev@xxxxxxxxxxxxxxxx, linux-alpha@xxxxxxxxxxxxxxx, linux-arm-kernel@xxxxxxxxxxxxxxxxxxx, linux-edac@xxxxxxxxxxxxxxx, linux-hyperv@xxxxxxxxxxxxxxx, linux-leds@xxxxxxxxxxxxxxx, linux-mips@xxxxxxxxxxxxxxx, linux-parisc@xxxxxxxxxxxxxxx, linux-pm@xxxxxxxxxxxxxxx, linux-remoteproc@xxxxxxxxxxxxxxx, linux-s390@xxxxxxxxxxxxxxx, linux-tegra@xxxxxxxxxxxxxxx, linux-um@xxxxxxxxxxxxxxxxxxx, linux-xtensa@xxxxxxxxxxxxxxxx, netdev@xxxxxxxxxxxxxxx, openipmi-developer@xxxxxxxxxxxxxxxxxxxxx, rcu@xxxxxxxxxxxxxxx, sparclinux@xxxxxxxxxxxxxxx, xen-devel@xxxxxxxxxxxxxxxxxxxx, x86@xxxxxxxxxx, kernel-dev@xxxxxxxxxx, kernel@xxxxxxxxxxxx, halves@xxxxxxxxxxxxx, fabiomirmar@xxxxxxxxx, alejandro.j.jimenez@xxxxxxxxxx, andriy.shevchenko@xxxxxxxxxxxxxxx, arnd@xxxxxxxx, bp@xxxxxxxxx, corbet@xxxxxxx, d.hatayama@xxxxxxxxxxxxxx, dave.hansen@xxxxxxxxxxxxxxx, dyoung@xxxxxxxxxx, feng.tang@xxxxxxxxx, gregkh@xxxxxxxxxxxxxxxxxxx, mikelley@xxxxxxxxxxxxx, hidehiro.kawai.ez@xxxxxxxxxxx, jgross@xxxxxxxx, john.ogness@xxxxxxxxxxxxx, keescook@xxxxxxxxxxxx, luto@xxxxxxxxxx, mhiramat@xxxxxxxxxx, mingo@xxxxxxxxxx, paulmck@xxxxxxxxxx, peterz@xxxxxxxxxxxxx, rostedt@xxxxxxxxxxx, senozhatsky@xxxxxxxxxxxx, stern@xxxxxxxxxxxxxxxxxxx, tglx@xxxxxxxxxxxxx, vgoyal@xxxxxxxxxx, vkuznets@xxxxxxxxxx, will@xxxxxxxxxx, Christophe JAILLET <christophe.jaillet@xxxxxxxxxx>, Mihai Carabas <mihai.carabas@xxxxxxxxxx>, Shile Zhang <shile.zhang@xxxxxxxxxxxxxxxxx>, Wang ShaoBo <bobo.shaobowang@xxxxxxxxxx>, zhenwei pi <pizhenwei@xxxxxxxxxxxxx>
- Delivery-date: Tue, 10 May 2022 12:14:23 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On Wed 2022-04-27 19:48:59, Guilherme G. Piccoli wrote:
> The pvpanic driver relies on panic notifiers to execute a callback
> on panic event. Such function is executed in atomic context - the
> panic function disables local IRQs, preemption and all other CPUs
> that aren't running the panic code.
>
> With that said, it's dangerous to use regular spinlocks in such path,
> as introduced by commit b3c0f8774668 ("misc/pvpanic: probe multiple
> instances").
> This patch fixes that by replacing regular spinlocks with the trylock
> safer approach.
It seems that the lock is used just to manipulating a list. A super
safe solution would be to use the rcu API: rcu_add_rcu() and
list_del_rcu() under rcu_read_lock(). The spin lock will not be
needed and the list will always be valid.
The advantage would be that it will always call members that
were successfully added earlier. That said, I am not familiar
with pvpanic and am not sure if it is worth it.
> It also fixes an old comment (about a long gone framebuffer code) and
> the notifier priority - we should execute hypervisor notifiers early,
> deferring this way the panic action to the hypervisor, as expected by
> the users that are setting up pvpanic.
This should be done in a separate patch. It changes the behavior.
Also there might be a discussion whether it really should be
the maximal priority.
Best Regards,
Petr
|