All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@web.de>
To: Marcelo Tosatti <mtosatti@redhat.com>
Cc: kvm-devel <kvm@vger.kernel.org>
Subject: Re: [PATCH] KVM: VMX: Fix locking order in	handle_invalid_guest_state
Date: Fri, 24 Jul 2009 09:00:45 +0200	[thread overview]
Message-ID: <4A695C1D.7030807@web.de> (raw)
In-Reply-To: <20090723214553.GA10152@amt.cnet>

[-- Attachment #1: Type: text/plain, Size: 1792 bytes --]

Marcelo Tosatti wrote:
> 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, maybe not. handle_invalid_guest_state is an alternative way of
"executing" guest code, and it currently shares the setup and tear-down
with vmx_vcpu_run. If it has to share parts that actually require
preemption and IRQ lock, then moving makes not much sense. Can anyone
comment on what the requirements for handle_invalid_guest_state are?

I would suggest to merge this fix first and then decide about and
potentially merge a refactoring patch.

Jan

> 
> Maybe add a new member to x86_ops?
> 
>> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
>> ---
>>
>>  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;
>>  }
>>
> 
> 



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 257 bytes --]

  reply	other threads:[~2009-07-24  7:00 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-22 21:53 [PATCH] KVM: VMX: Fix locking order in handle_invalid_guest_state Jan Kiszka
2009-07-23 21:45 ` Marcelo Tosatti
2009-07-24  7:00   ` Jan Kiszka [this message]
2009-07-26 13:51     ` Avi Kivity
2009-07-26 14:23       ` Jan Kiszka
2009-07-26 14:36         ` Avi Kivity
2009-07-26 14:38           ` Jan Kiszka
2009-07-26 14:47             ` Avi Kivity
2009-07-26 14:55               ` Jan Kiszka
2009-07-26 15:02                 ` Avi Kivity
2009-07-29 12:24   ` Marcelo Tosatti
2009-07-29 12:44     ` Avi Kivity
2009-07-29 14:07       ` Marcelo Tosatti
2009-07-29 14:32         ` Gleb Natapov
2009-07-30 11:16         ` Avi Kivity
2009-07-30 11:16           ` Gleb Natapov
2009-07-30 11:26             ` Avi Kivity
2009-07-30 11:24               ` Gleb Natapov
2009-07-30 11:46                 ` Avi Kivity
2009-07-30 11:47                   ` Gleb Natapov
2009-07-30 11:57                     ` Gleb Natapov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4A695C1D.7030807@web.de \
    --to=jan.kiszka@web.de \
    --cc=kvm@vger.kernel.org \
    --cc=mtosatti@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.