From mboxrd@z Thu Jan 1 00:00:00 1970 From: Gleb Natapov Subject: Re: kvm: RCU warning in async pf Date: Mon, 16 Apr 2012 15:58:48 +0300 Message-ID: <20120416125848.GT11918@redhat.com> References: <1333414472.11455.7.camel@lappy> <20120403105226.GF14939@redhat.com> <20120404123033.GD11918@redhat.com> <1334396693.2528.45.camel@twins> <20120416102855.GP11918@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Sasha Levin , Avi Kivity , Marcelo Tosatti , Thomas Gleixner , Ingo Molnar , "Paul E. McKenney" , kvm , linux-kernel , Dave Jones To: Peter Zijlstra Return-path: Content-Disposition: inline In-Reply-To: <20120416102855.GP11918@redhat.com> Sender: linux-kernel-owner@vger.kernel.org List-Id: kvm.vger.kernel.org On Mon, Apr 16, 2012 at 01:28:55PM +0300, Gleb Natapov wrote: > On Sat, Apr 14, 2012 at 11:44:53AM +0200, Peter Zijlstra wrote: > > On Wed, 2012-04-04 at 15:30 +0300, Gleb Natapov wrote: > > > > > > @@ -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; > > > } > > > } > > > > Wouldn't irq_enter() / irq_exit() be more appropriate? You're basically > > taking an interrupt/exception from idle, irq_enter() will fix up > > everything that needs fixing up, including time sources (which the > > scheduler expects to be up-to-date). > > > You are right. Will send a patch. > KVM: Call irq_enter() instead of rcu_irq_enter() during async PF. As Peter noted there are more things that should be done when leaving idle state. irq_(enter|exit)() does them and also call rcu functions. Signed-off-by: Gleb Natapov diff --git a/arch/x86/kernel/kvm.c b/arch/x86/kernel/kvm.c index b8ba6e4..83a48f6 100644 --- a/arch/x86/kernel/kvm.c +++ b/arch/x86/kernel/kvm.c @@ -254,10 +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(); + irq_enter(); exit_idle(); kvm_async_pf_task_wake((u32)read_cr2()); - rcu_irq_exit(); + irq_exit(); break; } } -- Gleb.