From: Glauber Costa <gcosta@redhat.com>
To: kvm-devel@lists.sourceforge.net
Cc: qemu-devel@nongnu.org, avi@qumranet.com,
Glauber Costa <gcosta@redhat.com>,
chrisw@sous-sol.org
Subject: [PATCH] KVM: use actual thread id for vcpus
Date: Wed, 5 Mar 2008 17:01:11 -0300 [thread overview]
Message-ID: <12047472873617-git-send-email-gcosta@redhat.com> (raw)
In-Reply-To: <12047472823266-git-send-email-gcosta@redhat.com>
At kvm ap creation, update CPUState with the actual thread id.
For us, they are actually different
Signed-off-by: Glauber Costa <gcosta@redhat.com>
---
qemu/qemu-kvm.c | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/qemu/qemu-kvm.c b/qemu/qemu-kvm.c
index 051946e..45fddd3 100644
--- a/qemu/qemu-kvm.c
+++ b/qemu/qemu-kvm.c
@@ -19,6 +19,7 @@ int kvm_irqchip = 1;
#include <libkvm.h>
#include <pthread.h>
#include <sys/utsname.h>
+#include <sys/syscall.h>
extern void perror(const char *s);
@@ -49,6 +50,11 @@ struct vcpu_info {
int stopped;
} vcpu_info[256];
+static inline unsigned long kvm_get_thread_id(void)
+{
+ return syscall(SYS_gettid);
+}
+
CPUState *qemu_kvm_cpu_env(int index)
{
return vcpu_info[index].env;
@@ -328,6 +334,7 @@ static void *ap_main_loop(void *_env)
vcpu = &vcpu_info[env->cpu_index];
vcpu->env = env;
+ vcpu->env->thread_id = kvm_get_thread_id();
sigfillset(&signals);
//sigdelset(&signals, SIG_IPI);
sigprocmask(SIG_BLOCK, &signals, NULL);
@@ -374,6 +381,7 @@ int kvm_init_ap(void)
vcpu = &vcpu_info[0];
vcpu->env = first_cpu;
+ vcpu->env->thread_id = kvm_get_thread_id();
signal(SIG_IPI, sig_ipi_handler);
for (i = 1; i < smp_cpus; ++i) {
kvm_init_new_ap(i, env);
--
1.5.0.6
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
WARNING: multiple messages have this Message-ID (diff)
From: Glauber Costa <gcosta@redhat.com>
To: kvm-devel@lists.sourceforge.net
Cc: glommer@gmail.com, qemu-devel@nongnu.org,
Glauber Costa <gcosta@redhat.com>,
chrisw@sous-sol.org
Subject: [Qemu-devel] [PATCH] KVM: use actual thread id for vcpus
Date: Wed, 5 Mar 2008 17:01:11 -0300 [thread overview]
Message-ID: <12047472873617-git-send-email-gcosta@redhat.com> (raw)
In-Reply-To: <12047472823266-git-send-email-gcosta@redhat.com>
At kvm ap creation, update CPUState with the actual thread id.
For us, they are actually different
Signed-off-by: Glauber Costa <gcosta@redhat.com>
---
qemu/qemu-kvm.c | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/qemu/qemu-kvm.c b/qemu/qemu-kvm.c
index 051946e..45fddd3 100644
--- a/qemu/qemu-kvm.c
+++ b/qemu/qemu-kvm.c
@@ -19,6 +19,7 @@ int kvm_irqchip = 1;
#include <libkvm.h>
#include <pthread.h>
#include <sys/utsname.h>
+#include <sys/syscall.h>
extern void perror(const char *s);
@@ -49,6 +50,11 @@ struct vcpu_info {
int stopped;
} vcpu_info[256];
+static inline unsigned long kvm_get_thread_id(void)
+{
+ return syscall(SYS_gettid);
+}
+
CPUState *qemu_kvm_cpu_env(int index)
{
return vcpu_info[index].env;
@@ -328,6 +334,7 @@ static void *ap_main_loop(void *_env)
vcpu = &vcpu_info[env->cpu_index];
vcpu->env = env;
+ vcpu->env->thread_id = kvm_get_thread_id();
sigfillset(&signals);
//sigdelset(&signals, SIG_IPI);
sigprocmask(SIG_BLOCK, &signals, NULL);
@@ -374,6 +381,7 @@ int kvm_init_ap(void)
vcpu = &vcpu_info[0];
vcpu->env = first_cpu;
+ vcpu->env->thread_id = kvm_get_thread_id();
signal(SIG_IPI, sig_ipi_handler);
for (i = 1; i < smp_cpus; ++i) {
kvm_init_new_ap(i, env);
--
1.5.0.6
next prev parent reply other threads:[~2008-03-05 20:01 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-03-05 20:01 [PATCH 0/3] Expose thread id through info cpus Glauber Costa
2008-03-05 20:01 ` [Qemu-devel] " Glauber Costa
2008-03-05 20:01 ` [PATCH] use a thread id variable Glauber Costa
2008-03-05 20:01 ` [Qemu-devel] " Glauber Costa
2008-03-05 20:01 ` [PATCH] augment info cpus Glauber Costa
2008-03-05 20:01 ` [Qemu-devel] " Glauber Costa
2008-03-05 20:01 ` Glauber Costa [this message]
2008-03-05 20:01 ` [Qemu-devel] [PATCH] KVM: use actual thread id for vcpus Glauber Costa
2008-03-09 9:26 ` [Qemu-devel] [PATCH] use a thread id variable Gilad Ben-Yossef
2008-03-09 9:26 ` Gilad Ben-Yossef
2008-03-09 11:58 ` Jamie Lokier
2008-03-09 11:58 ` Jamie Lokier
2008-03-09 14:52 ` Gilad Ben-Yossef
2008-03-09 14:52 ` Gilad Ben-Yossef
2008-03-09 16:12 ` M. Warner Losh
2008-03-09 16:12 ` M. Warner Losh
2008-03-17 17:55 ` Glauber Costa
2008-03-17 17:55 ` Glauber Costa
2008-03-09 16:09 ` M. Warner Losh
2008-03-09 16:09 ` M. Warner Losh
2008-03-09 20:01 ` Jamie Lokier
2008-03-09 20:01 ` Jamie Lokier
2008-03-09 16:23 ` Daniel P. Berrange
2008-03-09 16:23 ` [kvm-devel] " Daniel P. Berrange
2008-03-05 20:07 ` [PATCH 0/3] Expose thread id through info cpus Glauber Costa
2008-03-05 20:07 ` [Qemu-devel] " Glauber Costa
2008-03-06 6:55 ` Avi Kivity
2008-03-06 6:55 ` [Qemu-devel] " 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=12047472873617-git-send-email-gcosta@redhat.com \
--to=gcosta@redhat.com \
--cc=avi@qumranet.com \
--cc=chrisw@sous-sol.org \
--cc=kvm-devel@lists.sourceforge.net \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.