mirror of https://gitee.com/openkylin/qemu.git
cpus: Use qemu_for_each_cpu() in TCG thread
Replaces an open-coded loop and hides unused CPUArchState. Signed-off-by: Igor Mammedov <imammedo@redhat.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
This commit is contained in:
parent
d6b9e0d60c
commit
a37677c32b
13
cpus.c
13
cpus.c
|
@ -812,6 +812,12 @@ static void *qemu_dummy_cpu_thread_fn(void *arg)
|
||||||
|
|
||||||
static void tcg_exec_all(void);
|
static void tcg_exec_all(void);
|
||||||
|
|
||||||
|
static void tcg_signal_cpu_creation(CPUState *cpu, void *data)
|
||||||
|
{
|
||||||
|
cpu->thread_id = qemu_get_thread_id();
|
||||||
|
cpu->created = true;
|
||||||
|
}
|
||||||
|
|
||||||
static void *qemu_tcg_cpu_thread_fn(void *arg)
|
static void *qemu_tcg_cpu_thread_fn(void *arg)
|
||||||
{
|
{
|
||||||
CPUState *cpu = arg;
|
CPUState *cpu = arg;
|
||||||
|
@ -820,13 +826,8 @@ static void *qemu_tcg_cpu_thread_fn(void *arg)
|
||||||
qemu_tcg_init_cpu_signals();
|
qemu_tcg_init_cpu_signals();
|
||||||
qemu_thread_get_self(cpu->thread);
|
qemu_thread_get_self(cpu->thread);
|
||||||
|
|
||||||
/* signal CPU creation */
|
|
||||||
qemu_mutex_lock(&qemu_global_mutex);
|
qemu_mutex_lock(&qemu_global_mutex);
|
||||||
for (env = first_cpu; env != NULL; env = env->next_cpu) {
|
qemu_for_each_cpu(tcg_signal_cpu_creation, NULL);
|
||||||
cpu = ENV_GET_CPU(env);
|
|
||||||
cpu->thread_id = qemu_get_thread_id();
|
|
||||||
cpu->created = true;
|
|
||||||
}
|
|
||||||
qemu_cond_signal(&qemu_cpu_cond);
|
qemu_cond_signal(&qemu_cpu_cond);
|
||||||
|
|
||||||
/* wait for initial kick-off after machine start */
|
/* wait for initial kick-off after machine start */
|
||||||
|
|
Loading…
Reference in New Issue