[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH qom-next 47/59] cpu: Move thread_id to CPUState
From: |
Andreas Färber |
Subject: |
[Qemu-devel] [PATCH qom-next 47/59] cpu: Move thread_id to CPUState |
Date: |
Wed, 23 May 2012 05:08:10 +0200 |
Signed-off-by: Andreas Färber <address@hidden>
---
cpu-defs.h | 1 -
cpus.c | 11 ++++++-----
exec.c | 5 ++++-
include/qemu/cpu.h | 1 +
4 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/cpu-defs.h b/cpu-defs.h
index 54807f5..d846674 100644
--- a/cpu-defs.h
+++ b/cpu-defs.h
@@ -201,7 +201,6 @@ typedef struct CPUWatchpoint {
int nr_cores; /* number of cores within this CPU package */ \
int nr_threads;/* number of threads within this CPU */ \
int running; /* Nonzero if cpu is currently running(usermode). */ \
- int thread_id; \
/* user data */ \
void *opaque; \
\
diff --git a/cpus.c b/cpus.c
index 06743e4..a403629 100644
--- a/cpus.c
+++ b/cpus.c
@@ -739,7 +739,7 @@ static void *qemu_kvm_cpu_thread_fn(void *arg)
qemu_mutex_lock(&qemu_global_mutex);
qemu_thread_get_self(cpu->thread);
- env->thread_id = qemu_get_thread_id();
+ cpu->thread_id = qemu_get_thread_id();
cpu_single_env = env;
r = kvm_init_vcpu(env);
@@ -780,7 +780,7 @@ static void *qemu_dummy_cpu_thread_fn(void *arg)
qemu_mutex_lock_iothread();
qemu_thread_get_self(cpu->thread);
- env->thread_id = qemu_get_thread_id();
+ cpu->thread_id = qemu_get_thread_id();
sigemptyset(&waitset);
sigaddset(&waitset, SIG_IPI);
@@ -824,7 +824,7 @@ static void *qemu_tcg_cpu_thread_fn(void *arg)
qemu_mutex_lock(&qemu_global_mutex);
for (env = first_cpu; env != NULL; env = env->next_cpu) {
cpu = ENV_GET_CPU(env);
- env->thread_id = qemu_get_thread_id();
+ cpu->thread_id = qemu_get_thread_id();
cpu->created = true;
}
qemu_cond_signal(&qemu_cpu_cond);
@@ -1204,7 +1204,8 @@ CpuInfoList *qmp_query_cpus(Error **errp)
CpuInfoList *head = NULL, *cur_item = NULL;
CPUArchState *env;
- for(env = first_cpu; env != NULL; env = env->next_cpu) {
+ for (env = first_cpu; env != NULL; env = env->next_cpu) {
+ CPUState *cpu = ENV_GET_CPU(env);
CpuInfoList *info;
cpu_synchronize_state(env);
@@ -1214,7 +1215,7 @@ CpuInfoList *qmp_query_cpus(Error **errp)
info->value->CPU = env->cpu_index;
info->value->current = (env == first_cpu);
info->value->halted = env->halted;
- info->value->thread_id = env->thread_id;
+ info->value->thread_id = cpu->thread_id;
#if defined(TARGET_I386)
info->value->has_pc = true;
info->value->pc = env->eip + env->segs[R_CS].base;
diff --git a/exec.c b/exec.c
index 6e5ac67..8d2fa7a 100644
--- a/exec.c
+++ b/exec.c
@@ -693,6 +693,9 @@ CPUArchState *qemu_get_cpu(int cpu)
void cpu_exec_init(CPUArchState *env)
{
+#ifndef CONFIG_USER_ONLY
+ CPUState *cpu = ENV_GET_CPU(env);
+#endif
CPUArchState **penv;
int cpu_index;
@@ -711,7 +714,7 @@ void cpu_exec_init(CPUArchState *env)
QTAILQ_INIT(&env->breakpoints);
QTAILQ_INIT(&env->watchpoints);
#ifndef CONFIG_USER_ONLY
- env->thread_id = qemu_get_thread_id();
+ cpu->thread_id = qemu_get_thread_id();
#endif
*penv = env;
#if defined(CONFIG_USER_ONLY)
diff --git a/include/qemu/cpu.h b/include/qemu/cpu.h
index 33f01d9..61b7698 100644
--- a/include/qemu/cpu.h
+++ b/include/qemu/cpu.h
@@ -69,6 +69,7 @@ struct CPUState {
#ifdef _WIN32
HANDLE hThread;
#endif
+ int thread_id;
struct QemuCond *halt_cond;
struct qemu_work_item *queued_work_first, *queued_work_last;
bool thread_kicked;
--
1.7.7
- [Qemu-devel] [PATCH qom-next 43/59] cpus: Pass CPUState to [qemu_]cpu_has_work(), (continued)
- [Qemu-devel] [PATCH qom-next 43/59] cpus: Pass CPUState to [qemu_]cpu_has_work(), Andreas Färber, 2012/05/22
- [Qemu-devel] [PATCH qom-next 54/59] target-mips: Pass MIPSCPU to mips_tc_sleep(), Andreas Färber, 2012/05/22
- [Qemu-devel] [PATCH qom-next 44/59] target-i386: Pass X86CPU to kvm_mce_inject(), Andreas Färber, 2012/05/22
- [Qemu-devel] [PATCH qom-next 57/59] cpu: Introduce mandatory tlb_flush callback, Andreas Färber, 2012/05/22
- [Qemu-devel] [PATCH qom-next 55/59] target-mips: Pass MIPSCPU to mips_vpe_sleep(), Andreas Färber, 2012/05/22
- [Qemu-devel] [PATCH qom-next 45/59] target-i386: Pass X86CPU to cpu_x86_inject_mce(), Andreas Färber, 2012/05/23
- [Qemu-devel] [PATCH qom-next 40/59] spapr: Pass PowerPCCPU to spapr_hypercall(), Andreas Färber, 2012/05/23
- [Qemu-devel] [PATCH qom-next 41/59] spapr: Pass PowerPCCPU to hypercalls, Andreas Färber, 2012/05/23
- [Qemu-devel] [PATCH qom-next 49/59] target-i386: Drop version 5 CPU VMState support, Andreas Färber, 2012/05/23
- [Qemu-devel] [PATCH qom-next 47/59] cpu: Move thread_id to CPUState,
Andreas Färber <=
- [Qemu-devel] [PATCH qom-next 53/59] target-mips: Pass MIPSCPU to mips_vpe_is_wfi(), Andreas Färber, 2012/05/23
- [Qemu-devel] [PATCH qom-next 48/59] target-i386: Pass X86CPU to cpu_x86_load_seg_cache_sipi(), Andreas Färber, 2012/05/23
- [Qemu-devel] [PATCH qom-next 46/59] cpus: Pass CPUState to run_on_cpu(), Andreas Färber, 2012/05/23
- [Qemu-devel] [PATCH qom-next 59/59] cpu: Move halted and interrupt_request to CPUState, Andreas Färber, 2012/05/23
- [Qemu-devel] [PATCH qom-next 52/59] target-mips: Pass MIPSCPU to mips_tc_wake(), Andreas Färber, 2012/05/23
- [Qemu-devel] [PATCH qom-next 56/59] sun4u: Pass SPARCCPU to cpu_set_ivec_irq(), Andreas Färber, 2012/05/23
- [Qemu-devel] [PATCH qom-next 51/59] target-i386: Pass X86CPU to kvm_handle_halt(), Andreas Färber, 2012/05/23
- Re: [Qemu-devel] [PATCH qom-next 00/59] QOM CPUState, part 4: CPU_COMMON, Stefano Stabellini, 2012/05/23
- Re: [Qemu-devel] [PATCH qom-next 00/59] QOM CPUState, part 4: CPU_COMMON, Andreas Färber, 2012/05/23