aboutsummaryrefslogtreecommitdiff
path: root/cpus.c
diff options
context:
space:
mode:
authorJan Kiszka <jan.kiszka@siemens.com>2011-03-15 12:26:31 +0100
committerMarcelo Tosatti <mtosatti@redhat.com>2011-03-16 17:11:07 -0300
commitdc7a09cfe47679d89289101cc9eb387c45e48fe7 (patch)
treeb55b3021443336fdb313dc41efe287355e3f21ea /cpus.c
parentf2574737f6a1218b4f4809ad6c8aba935126d90f (diff)
downloadqemu-dc7a09cfe47679d89289101cc9eb387c45e48fe7.zip
qemu-dc7a09cfe47679d89289101cc9eb387c45e48fe7.tar.gz
qemu-dc7a09cfe47679d89289101cc9eb387c45e48fe7.tar.bz2
Expose thread_id in info cpus
Based on patch by Glauber Costa: To allow management applications like libvirt to apply CPU affinities to the VCPU threads, expose their ID via info cpus. This patch provides the pre-existing and used interface from qemu-kvm. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Diffstat (limited to 'cpus.c')
-rw-r--r--cpus.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/cpus.c b/cpus.c
index d310b7e..28c2da2 100644
--- a/cpus.c
+++ b/cpus.c
@@ -776,6 +776,7 @@ static void *qemu_kvm_cpu_thread_fn(void *arg)
qemu_mutex_lock(&qemu_global_mutex);
qemu_thread_get_self(env->thread);
+ env->thread_id = qemu_get_thread_id();
r = kvm_init_vcpu(env);
if (r < 0) {
@@ -817,6 +818,7 @@ static void *qemu_tcg_cpu_thread_fn(void *arg)
/* signal CPU creation */
qemu_mutex_lock(&qemu_global_mutex);
for (env = first_cpu; env != NULL; env = env->next_cpu) {
+ env->thread_id = qemu_get_thread_id();
env->created = 1;
}
qemu_cond_signal(&qemu_cpu_cond);