From: Glauber Costa <glommer@redhat.com>
To: qemu-devel@nongnu.org
Cc: Glauber Costa <glommer@mothafucka.localdomain>, aliguori@us.ibm.com
Subject: [Qemu-devel] [PATCH 2/2] do proper cpu_self check
Date: Mon, 28 Sep 2009 15:27:44 -0300 [thread overview]
Message-ID: <1254162464-20089-3-git-send-email-glommer@redhat.com> (raw)
In-Reply-To: <1254162464-20089-2-git-send-email-glommer@redhat.com>
From: Glauber Costa <glommer@mothafucka.localdomain>
Currently, our check for qemu_cpu_self only checks if there is a cpu
currently in execution (represented by cpu_single_env being set). While
this might be okay for tcg, it is certainly not okay for kvm, since multiple
cpus might be executing.
Instead, I propose we use pthread primitives to test if the caller thread is
the same as env->thread.
For tcg, it will have the same semantics as before, since all CPUStates will
point to the same thread, and we'll only have one in execution at a time.
Signed-off-by: Glauber Costa <glommer@mothafucka.localdomain>
---
vl.c | 9 +++++++--
1 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/vl.c b/vl.c
index f24a260..9448190 100644
--- a/vl.c
+++ b/vl.c
@@ -3582,9 +3582,14 @@ void qemu_cpu_kick(void *_env)
qemu_thread_signal(env->thread, SIGUSR1);
}
-int qemu_cpu_self(void *env)
+int qemu_cpu_self(void *_env)
{
- return (cpu_single_env != NULL);
+ CPUState *env = _env;
+ QemuThread this;
+
+ qemu_thread_self(&this);
+
+ return qemu_thread_equal(&this, env->thread);
}
static void cpu_signal(int sig)
--
1.6.2.5
next prev parent reply other threads:[~2009-09-28 18:27 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 ` Glauber Costa [this message]
2009-09-28 18:58 ` [Qemu-devel] [PATCH 2/2] do proper cpu_self check malc
2009-09-30 20:02 ` [Qemu-devel] [PATCH 1/2] unlock iothread mutex before running kvm ioctl Anthony Liguori
-- 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 18:49 ` [Qemu-devel] [PATCH 2/2] do proper cpu_self check 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
2009-10-07 19:38 ` [Qemu-devel] [PATCH 2/2] do proper cpu_self check 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=1254162464-20089-3-git-send-email-glommer@redhat.com \
--to=glommer@redhat.com \
--cc=aliguori@us.ibm.com \
--cc=glommer@mothafucka.localdomain \
--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).