public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Ryan Harper <ryanh@us.ibm.com>
To: Anthony Liguori <aliguori@us.ibm.com>
Cc: kvm-devel@lists.sourceforge.net, Ryan Harper <ryanh@us.ibm.com>,
	Avi Kivity <avi@qumranet.com>
Subject: Re: [PATCH] Don't race while creating a VCPU
Date: Tue, 29 Apr 2008 09:52:38 -0500	[thread overview]
Message-ID: <20080429145238.GB17938@us.ibm.com> (raw)
In-Reply-To: <1209421836-21074-1-git-send-email-aliguori@us.ibm.com>

* Anthony Liguori <aliguori@us.ibm.com> [2008-04-28 17:30]:
> We hold qemu_mutex while machine->init() executes, which issues a VCPU create.
> We need to make sure to not return from the VCPU creation until the VCPU
> file descriptor is valid to ensure that APIC creation succeeds.
> 
> However, we also need to make sure that the VCPU thread doesn't start running
> until the machine->init() is complete.  This is addressed today because the
> VCPU thread tries to grab the qemu_mutex before doing anything interesting.
> If we release qemu_mutex to wait for VCPU creation, then we open a window for
> a race to occur.
> 
> This patch introduces two wait conditions.  The first lets the VCPU create
> code that runs in the IO thread to wait for a VCPU to initialize.  The second
> condition lets the VCPU thread wait for the machine to fully initialize before
> running.
> 
> An added benefit of this patch is it makes the dependencies now explicit.
> 
> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

This patch passed the same tests I used on the other: 64 1VCPU guest
launch, 1 second apart, and a 16-way SMP guest boot.

-- 
Ryan Harper
Software Engineer; Linux Technology Center
IBM Corp., Austin, Tx
(512) 838-9253   T/L: 678-9253
ryanh@us.ibm.com

-------------------------------------------------------------------------
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-04-29 14:52 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-28 22:30 [PATCH] Don't race while creating a VCPU Anthony Liguori
2008-04-29 14:52 ` Ryan Harper [this message]
2008-04-29 23:29 ` 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=20080429145238.GB17938@us.ibm.com \
    --to=ryanh@us.ibm.com \
    --cc=aliguori@us.ibm.com \
    --cc=avi@qumranet.com \
    --cc=kvm-devel@lists.sourceforge.net \
    /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