From: Ryan Harper <ryanh@us.ibm.com>
To: kvm-devel@lists.sourceforge.net
Cc: Avi Kivity <avi@qumranet.com>
Subject: Re: [PATCH] Fix QEMU vcpu thread race with apic_reset
Date: Sat, 26 Apr 2008 00:33:13 -0500 [thread overview]
Message-ID: <20080426053313.GT17938@us.ibm.com> (raw)
In-Reply-To: <1209187574-21081-1-git-send-email-ryanh@us.ibm.com>
* Ryan Harper <ryanh@us.ibm.com> [2008-04-26 00:27]:
> There is a race between when the vcpu thread issues a create ioctl and when
> apic_reset() gets called resulting in getting a badfd error.
>
> main thread vcpu thread
guilt refresh clipped my text short.
main thread vcpu thread
----------- -----------
qemu/hw/pc.c:pc_new_cpu()
cpu_init()
cpu_x86_init()
kvm_init_new_ap() ap_main_loop()
*blocks*
usleep()
apic_init()
kvm_set_lapic()
kvm_ioctl with unitilized context
badfd
To fix this, ensure we create the vcpu in the vcpu thread before returning from
kvm_init_new_ap. Synchronize on a new mutux, vcpu_mutex, and wait for the
vcpuup condition before signaling to ensure the main thread is waiting before we
send the signal.
With this patch, I can launch 64 kvm guests, 1 second apart and not see any Bad
File descriptor errors.
Signed-off-by: Ryan Harper <ryanh@us.ibm.com>
--
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
next prev parent reply other threads:[~2008-04-26 5:33 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-04-26 5:26 [PATCH] Fix QEMU vcpu thread race with apic_reset Ryan Harper
2008-04-26 5:33 ` Ryan Harper [this message]
2008-04-26 7:16 ` Avi Kivity
2008-04-28 16:26 ` Ryan Harper
2008-04-28 20:02 ` Anthony Liguori
2008-04-29 0:46 ` Ulrich Drepper
2008-04-26 16:58 ` Ulrich Drepper
2008-04-26 17:04 ` Ulrich Drepper
2008-04-26 17:56 ` Anthony Liguori
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=20080426053313.GT17938@us.ibm.com \
--to=ryanh@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