[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 37/43] cpus: remove tcg_halt_cond and tcg_cpu_thread
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PULL 37/43] cpus: remove tcg_halt_cond and tcg_cpu_thread globals |
Date: |
Wed, 9 Sep 2015 15:50:07 +0200 |
From: KONRAD Frederic <address@hidden>
This hides the tcg_halt_cond and tcg_cpu_thread global variables
inside qemu_tcg_init_vcpu. Multi-threaded TCG will need one
QemuCond and one QemuThread per virtual cpu, so it's preferrable
to use cpu->halt_cond and cpu->thread.
Signed-off-by: KONRAD Frederic <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
---
cpus.c | 15 ++++++---------
1 file changed, 6 insertions(+), 9 deletions(-)
diff --git a/cpus.c b/cpus.c
index ea3ffdb..dddd056 100644
--- a/cpus.c
+++ b/cpus.c
@@ -786,9 +786,6 @@ static unsigned iothread_requesting_mutex;
static QemuThread io_thread;
-static QemuThread *tcg_cpu_thread;
-static QemuCond *tcg_halt_cond;
-
/* cpu creation */
static QemuCond qemu_cpu_cond;
/* system init */
@@ -907,15 +904,13 @@ static void qemu_wait_io_event_common(CPUState *cpu)
cpu->thread_kicked = false;
}
-static void qemu_tcg_wait_io_event(void)
+static void qemu_tcg_wait_io_event(CPUState *cpu)
{
- CPUState *cpu;
-
while (all_cpu_threads_idle()) {
/* Start accounting real time to the virtual clock if the CPUs
are idle. */
qemu_clock_warp(QEMU_CLOCK_VIRTUAL);
- qemu_cond_wait(tcg_halt_cond, &qemu_global_mutex);
+ qemu_cond_wait(cpu->halt_cond, &qemu_global_mutex);
}
while (iothread_requesting_mutex) {
@@ -1040,7 +1035,7 @@ static void *qemu_tcg_cpu_thread_fn(void *arg)
/* wait for initial kick-off after machine start */
while (first_cpu->stopped) {
- qemu_cond_wait(tcg_halt_cond, &qemu_global_mutex);
+ qemu_cond_wait(first_cpu->halt_cond, &qemu_global_mutex);
/* process any pending work */
CPU_FOREACH(cpu) {
@@ -1061,7 +1056,7 @@ static void *qemu_tcg_cpu_thread_fn(void *arg)
qemu_clock_notify(QEMU_CLOCK_VIRTUAL);
}
}
- qemu_tcg_wait_io_event();
+ qemu_tcg_wait_io_event(QTAILQ_FIRST(&cpus));
}
return NULL;
@@ -1224,6 +1219,8 @@ void resume_all_vcpus(void)
static void qemu_tcg_init_vcpu(CPUState *cpu)
{
char thread_name[VCPU_THREAD_NAME_SIZE];
+ static QemuCond *tcg_halt_cond;
+ static QemuThread *tcg_cpu_thread;
tcg_cpu_address_space_init(cpu, cpu->as);
--
2.4.3
- [Qemu-devel] [PULL 24/43] cutils: Add qemu_strtoul() wrapper, (continued)
- [Qemu-devel] [PULL 24/43] cutils: Add qemu_strtoul() wrapper, Paolo Bonzini, 2015/09/09
- [Qemu-devel] [PULL 27/43] qmp: Add example usage of strto*l() qemu wrapper, Paolo Bonzini, 2015/09/09
- [Qemu-devel] [PULL 25/43] cutils: Add qemu_strtoll() wrapper, Paolo Bonzini, 2015/09/09
- [Qemu-devel] [PULL 29/43] checkpatch: adapt some tests to QEMU, Paolo Bonzini, 2015/09/09
- [Qemu-devel] [PULL 30/43] checkpatch: remove tests that are not relevant outside the kernel, Paolo Bonzini, 2015/09/09
- [Qemu-devel] [PULL 31/43] vhost-scsi: fix wrong vhost-scsi firmware path, Paolo Bonzini, 2015/09/09
- [Qemu-devel] [PULL 32/43] configure: factor out adding disas configure, Paolo Bonzini, 2015/09/09
- [Qemu-devel] [PULL 34/43] configure: Add support for jemalloc, Paolo Bonzini, 2015/09/09
- [Qemu-devel] [PULL 35/43] scripts/dump-guest-memory.py: fix after RAMBlock change, Paolo Bonzini, 2015/09/09
- [Qemu-devel] [PULL 33/43] add macro file for coccinelle, Paolo Bonzini, 2015/09/09
- [Qemu-devel] [PULL 37/43] cpus: remove tcg_halt_cond and tcg_cpu_thread globals,
Paolo Bonzini <=
- [Qemu-devel] [PULL 36/43] cpus: protect work list with work_mutex, Paolo Bonzini, 2015/09/09
- [Qemu-devel] [PULL 41/43] tcg: comment on which functions have to be called with mmap_lock held, Paolo Bonzini, 2015/09/09
- [Qemu-devel] [PULL 39/43] remove unused spinlock., Paolo Bonzini, 2015/09/09
- [Qemu-devel] [PULL 40/43] tcg: add memory barriers in page_find_alloc accesses, Paolo Bonzini, 2015/09/09
- [Qemu-devel] [PULL 42/43] exec: make mmap_lock/mmap_unlock globally available, Paolo Bonzini, 2015/09/09
- [Qemu-devel] [PULL 38/43] replace spinlock by QemuMutex., Paolo Bonzini, 2015/09/09
- [Qemu-devel] [PULL 43/43] cpu-exec: fix lock hierarchy for user-mode emulation, Paolo Bonzini, 2015/09/09
- Re: [Qemu-devel] [PULL 00/43] First batch of misc changes for 2.5 (2015-09-09), Peter Maydell, 2015/09/09