From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marcelo Tosatti Subject: Re: [PATCH] KVM: VMX: Fix locking order in handle_invalid_guest_state Date: Thu, 23 Jul 2009 18:45:53 -0300 Message-ID: <20090723214553.GA10152@amt.cnet> References: <4A678A56.7050901@web.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: kvm-devel To: Jan Kiszka Return-path: Received: from mx2.redhat.com ([66.187.237.31]:38710 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753490AbZGWVqk (ORCPT ); Thu, 23 Jul 2009 17:46:40 -0400 Content-Disposition: inline In-Reply-To: <4A678A56.7050901@web.de> Sender: kvm-owner@vger.kernel.org List-ID: On Wed, Jul 22, 2009 at 11:53:26PM +0200, Jan Kiszka wrote: > Release and re-acquire preemption and IRQ lock in the same order as > vcpu_enter_guest does. This should happen in vcpu_enter_guest, before it decides to disable preemption/irqs (so you consolidate the control there). Maybe add a new member to x86_ops? > > Signed-off-by: Jan Kiszka > --- > > arch/x86/kvm/vmx.c | 4 ++-- > 1 files changed, 2 insertions(+), 2 deletions(-) > > diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c > index d75c271..4f914c3 100644 > --- a/arch/x86/kvm/vmx.c > +++ b/arch/x86/kvm/vmx.c > @@ -3324,8 +3324,8 @@ static void handle_invalid_guest_state(struct kvm_vcpu *vcpu, > struct vcpu_vmx *vmx = to_vmx(vcpu); > enum emulation_result err = EMULATE_DONE; > > - preempt_enable(); > local_irq_enable(); > + preempt_enable(); > > while (!guest_state_valid(vcpu)) { > err = emulate_instruction(vcpu, kvm_run, 0, 0, 0); > @@ -3344,8 +3344,8 @@ static void handle_invalid_guest_state(struct kvm_vcpu *vcpu, > schedule(); > } > > - local_irq_disable(); > preempt_disable(); > + local_irq_disable(); > > vmx->invalid_state_emulation_result = err; > } >