public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Avi Kivity <avi@qumranet.com>
To: Marcelo Tosatti <mtosatti@redhat.com>
Cc: kvm-devel <kvm-devel@lists.sourceforge.net>
Subject: Re: KVM: kvm_vcpu_block task state race
Date: Fri, 09 May 2008 18:09:41 +0300	[thread overview]
Message-ID: <48246935.50603@qumranet.com> (raw)
In-Reply-To: <20080509142101.GA11591@dmt>

Marcelo Tosatti wrote:
> On Fri, May 09, 2008 at 10:40:47AM +0300, Avi Kivity wrote:
>
>   
>>> Unfortunately it can't use wait_event_interruptible() due to
>>> vcpu_put/vcpu_load.
>>>
>>>  
>>>       
>> schedule() will call vcpu_put()/vcpu_load() for us through preempt 
>> notifiers.  I feel a little uneasy about it, but no concreate reason why 
>> not to rely on it.
>>     
>
> The preempt notifiers hook call kvm_arch_vcpu_load / kvm_arch_vcpu_put,
> which won't unlock the vcpu mutex, right?
>
>   

Yes.

> I worry about a possible deadlock where some other operation that
> requires the vcpu mutex happens but the vcpu thread itself is in hlt.
>   

Suppose the guest executed a busy-spin waiting for an interrupt instead 
of a hlt?  We need to be able to handle that too.

The best practice is to issue all vcpu ioctls from the thread that 
created the vcpu; this becomes mandatory if we ever switch to a syscall 
interface and remove the mutex.

-- 
Do not meddle in the internals of kernels, for they are subtle and quick to panic.


-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone

  reply	other threads:[~2008-05-09 15:09 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-08 22:47 KVM: kvm_vcpu_block task state race Marcelo Tosatti
2008-05-09  7:40 ` Avi Kivity
2008-05-09 14:21   ` Marcelo Tosatti
2008-05-09 15:09     ` Avi Kivity [this message]
2008-05-09 19:22       ` Marcelo Tosatti
2008-05-09 19:27         ` Marcelo Tosatti
2008-05-11 14:24           ` Avi Kivity
2008-05-11 14:26         ` Avi Kivity
2008-05-14  5:21           ` Marcelo Tosatti
2008-05-14  7:55             ` Avi Kivity

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=48246935.50603@qumranet.com \
    --to=avi@qumranet.com \
    --cc=kvm-devel@lists.sourceforge.net \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox