Re: kvm: RCU warning in async pf
From: Gleb Natapov
Date: Wed Apr 04 2012 - 10:18:53 EST
On Wed, Apr 04, 2012 at 07:04:16AM -0700, Paul E. McKenney wrote:
> On Wed, Apr 04, 2012 at 03:30:33PM +0300, Gleb Natapov wrote:
> > On Tue, Apr 03, 2012 at 01:52:26PM +0300, Gleb Natapov wrote:
> > > On Mon, Apr 02, 2012 at 08:54:32PM -0400, Sasha Levin wrote:
> > > > Hi all,
> > > >
> > > > I got the spew at the bottom of the mail in a KVM guest using the KVM tools and running trinity.
> > > >
> > > > I'm not quite sure how default_idle managed to trigger a pagefault, so that part looks odd to me.
> > > >
> > > This is not regular page fault. This is async page fault that tells the
> > > guest that a page, previously swapped out by hypervisor, is now swapped
> > > back in and it can happen while vcpu is idle. The code does not leave
> > > idle state properly though. We probably need to call rcu_irq_enter()
> > > there. Will look into it.
> > >
> >
> > The patch below solves it for me:
> >
> > "Page ready" async PF can kick vcpu out of idle state much like IRQ.
> > We need to tell RCU about this.
>
> This is invoked from an exception or interrupt handler, not from
> process-level code? If so:
>
>From an exception.
> Reviewed-by: Paul E. McKenney <paulmck@xxxxxxxxxxxxxxxxxx>
>
> > Signed-off-by: Gleb Natapov <gleb@xxxxxxxxxx>
> > diff --git a/arch/x86/kernel/kvm.c b/arch/x86/kernel/kvm.c
> > index f0c6fd6..380079f 100644
> > --- a/arch/x86/kernel/kvm.c
> > +++ b/arch/x86/kernel/kvm.c
> > @@ -38,6 +38,7 @@
> > #include <asm/traps.h>
> > #include <asm/desc.h>
> > #include <asm/tlbflush.h>
> > +#include <asm/idle.h>
> >
> > static int kvmapf = 1;
> >
> > @@ -253,7 +254,10 @@ do_async_page_fault(struct pt_regs *regs, unsigned long error_code)
> > kvm_async_pf_task_wait((u32)read_cr2());
> > break;
> > case KVM_PV_REASON_PAGE_READY:
> > + rcu_irq_enter();
> > + exit_idle();
> > kvm_async_pf_task_wake((u32)read_cr2());
> > + rcu_irq_exit();
> > break;
> > }
> > }
> > --
> > Gleb.
> >
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
--
Gleb.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/