From: Anthony Liguori <anthony@codemonkey.ws>
To: Glauber Costa <glommer@redhat.com>
Cc: aliguori@us.ibm.com, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 1/2] unlock iothread mutex before running kvm ioctl
Date: Wed, 30 Sep 2009 15:02:12 -0500 [thread overview]
Message-ID: <4AC3B944.2060708@codemonkey.ws> (raw)
In-Reply-To: <1254162464-20089-2-git-send-email-glommer@redhat.com>
Glauber Costa wrote:
> From: Glauber Costa <glommer@mothafucka.localdomain>
>
> Without this, kvm will hold the mutex while it issues its run ioctl,
> and never be able to step out of it, causing a deadlock.
>
> Signed-off-by: Glauber Costa <glommer@mothafucka.localdomain>
>
Breaks the build when !CONFIG_IOTHREAD and needs a new SoB.
> ---
> kvm-all.c | 2 ++
> qemu-common.h | 3 +++
> vl.c | 4 ++--
> 3 files changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/kvm-all.c b/kvm-all.c
> index 7dcc553..11f4414 100644
> --- a/kvm-all.c
> +++ b/kvm-all.c
> @@ -605,7 +605,9 @@ int kvm_cpu_exec(CPUState *env)
> }
>
> kvm_arch_pre_run(env, run);
> + qemu_mutex_unlock_iothread();
> ret = kvm_vcpu_ioctl(env, KVM_RUN, 0);
> + qemu_mutex_lock_iothread();
> kvm_arch_post_run(env, run);
>
> if (ret == -EINTR || ret == -EAGAIN) {
> diff --git a/qemu-common.h b/qemu-common.h
> index 12e7dd0..820dd37 100644
> --- a/qemu-common.h
> +++ b/qemu-common.h
> @@ -146,6 +146,9 @@ char *qemu_strndup(const char *str, size_t size);
> void *get_mmap_addr(unsigned long size);
>
>
> +void qemu_mutex_lock_iothread(void);
> +void qemu_mutex_unlock_iothread(void);
> +
> /* Error handling. */
>
> void QEMU_NORETURN hw_error(const char *fmt, ...)
> diff --git a/vl.c b/vl.c
> index eb01da7..f24a260 100644
> --- a/vl.c
> +++ b/vl.c
> @@ -3640,7 +3640,7 @@ static void qemu_signal_lock(unsigned int msecs)
> qemu_mutex_unlock(&qemu_fair_mutex);
> }
>
> -static void qemu_mutex_lock_iothread(void)
> +void qemu_mutex_lock_iothread(void)
> {
> if (kvm_enabled()) {
> qemu_mutex_lock(&qemu_fair_mutex);
> @@ -3650,7 +3650,7 @@ static void qemu_mutex_lock_iothread(void)
> qemu_signal_lock(100);
> }
>
> -static void qemu_mutex_unlock_iothread(void)
> +void qemu_mutex_unlock_iothread(void)
> {
> qemu_mutex_unlock(&qemu_global_mutex);
> }
>
next prev parent reply other threads:[~2009-09-30 20:02 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-28 18:27 [Qemu-devel] [PATCH 0/2] Resend: fixes for io-thread Glauber Costa
2009-09-28 18:27 ` [Qemu-devel] [PATCH 1/2] unlock iothread mutex before running kvm ioctl Glauber Costa
2009-09-28 18:27 ` [Qemu-devel] [PATCH 2/2] do proper cpu_self check Glauber Costa
2009-09-28 18:58 ` malc
2009-09-30 20:02 ` Anthony Liguori [this message]
-- strict thread matches above, loose matches on Subject: below --
2009-10-07 18:49 [Qemu-devel] [PATCH 0/2] IO-thread fixes again Glauber Costa
2009-10-07 18:49 ` [Qemu-devel] [PATCH 1/2] unlock iothread mutex before running kvm ioctl Glauber Costa
2009-10-07 19:38 [Qemu-devel] [PATCH 0/2] IO-thread fixes Glauber Costa
2009-10-07 19:38 ` [Qemu-devel] [PATCH 1/2] unlock iothread mutex before running kvm ioctl Glauber Costa
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=4AC3B944.2060708@codemonkey.ws \
--to=anthony@codemonkey.ws \
--cc=aliguori@us.ibm.com \
--cc=glommer@redhat.com \
--cc=qemu-devel@nongnu.org \
/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;
as well as URLs for NNTP newsgroup(s).