At kvm ap creation, update CPUState with the actual thread id. For us, they are actually different
Signed-off-by: Glauber Costa <[EMAIL PROTECTED]> --- 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