On Mon, 2023-12-04 at 14:43 +0000, Paul Durrant wrote:
From: Paul Durrant pdurrant@amazon.com
As described in [1] compiling with CONFIG_PROVE_RAW_LOCK_NESTING shows that kvm_xen_set_evtchn_fast() is blocking on pfncache locks in IRQ context. Instead, use read_trylock() and treat failure to lock the same as an invalid cache.
[1] https://lore.kernel.org/lkml/99771ef3a4966a01fefd3adbb2ba9c3a75f97cf2.camel@...
Signed-off-by: Paul Durrant pdurrant@amazon.com
Reviewed-by: David Woodhouse dwmw@amazon.co.uk
Although I would prefer the commit comment to note that this is only wrong for PREEMPT_RT, as all those locks were irq-safe. This is because PREEMPT_RT is going to turn them into mutexes — and mostly trick things into working by making all IRQ handlers threaded... except this one isn't just in an IRQ handler; its in an HRTIMER_MODE_ABS_HARD callback which still *will* be in real interrupt context.
And there's no 'raw' version of the rwlock for us to use.