Re: [PATCH v2 0/7] kvm: fix latent guest entry/exit bugs

From: Mark Rutland
Date: Thu Jan 20 2022 - 06:57:27 EST


On Wed, Jan 19, 2022 at 08:30:17PM +0100, Christian Borntraeger wrote:
>
>
> Am 19.01.22 um 20:22 schrieb Mark Rutland:
> > On Wed, Jan 19, 2022 at 07:25:20PM +0100, Christian Borntraeger wrote:
> > > Am 19.01.22 um 11:58 schrieb Mark Rutland:
> > >
> > >
> > > CCing new emails for Anup and Atish so that they are aware of this thread.
> >
> > Ah; whoops. I'd meant to fix the Ccs on the patches.
> >
> > Thanks!
> >
> > [...]
> >
> > > I just gave this a spin on s390 with debugging on and I got the following:
> > >
> > > [ 457.151295] ------------[ cut here ]------------
> > > [ 457.151311] WARNING: CPU: 14 PID: 0 at kernel/rcu/tree.c:613 rcu_eqs_enter.constprop.0+0xf8/0x118
> >
> > Hmm, so IIUC that's:
> >
> > WARN_ON_ONCE(rdp->dynticks_nmi_nesting != DYNTICK_IRQ_NONIDLE);
> >
> > ... and we're clearly in the idle thread here.
> >
> > I wonder, is the s390 guest entry/exit *preemptible* ?
>
> Looks like debug_defconfig is indeed using preemption:
>
> CONFIG_PREEMPT_BUILD=y
> # CONFIG_PREEMPT_NONE is not set
> # CONFIG_PREEMPT_VOLUNTARY is not set
> CONFIG_PREEMPT=y
> CONFIG_PREEMPT_COUNT=y
> CONFIG_PREEMPTION=y
> CONFIG_PREEMPT_RCU=y
> CONFIG_PREEMPT_NOTIFIERS=y
> CONFIG_DEBUG_PREEMPT=y
> CONFIG_PREEMPTIRQ_TRACEPOINTS=y
> CONFIG_TRACE_PREEMPT_TOGGLE=y
> CONFIG_PREEMPT_TRACER=y
> # CONFIG_PREEMPTIRQ_DELAY_TEST is not set

Thanks for confirming!

Could you try with CONFIG_PROVE_RCU=y ? That can't be selected directly, but
selecting PROVE_LOCKING=y will enable it.

If I'm right, with that we should get a splat out of
rcu_irq_exit_check_preempt().

If so, I think we can solve this with preempt_{disable,enable}() around the
guest_timing_{enter,exit}_irqoff() calls. We'll also need to add some more
comments around arch_in_rcu_eqs() that arch-specific EQSs should be
non-preemptible.

Thanks,
Mark.