[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [RFC PATCH V6 09/18] cpu: add a tcg_executing flag.
From: |
fred . konrad |
Subject: |
[Qemu-devel] [RFC PATCH V6 09/18] cpu: add a tcg_executing flag. |
Date: |
Fri, 26 Jun 2015 16:47:24 +0200 |
From: KONRAD Frederic <address@hidden>
We need to know whether any other VCPU is executing code or not it's possible
with this flag.
Signed-off-by: KONRAD Frederic <address@hidden>
---
cpu-exec.c | 1 +
cpus.c | 1 +
include/qom/cpu.h | 3 +++
qom/cpu.c | 1 +
4 files changed, 6 insertions(+)
diff --git a/cpu-exec.c b/cpu-exec.c
index 0644383..de256d6 100644
--- a/cpu-exec.c
+++ b/cpu-exec.c
@@ -390,6 +390,7 @@ int cpu_exec(CPUArchState *env)
cpu->halted = 0;
}
+ cpu->tcg_executing = 1;
current_cpu = cpu;
rcu_read_lock();
diff --git a/cpus.c b/cpus.c
index 2541c56..0291620 100644
--- a/cpus.c
+++ b/cpus.c
@@ -1377,6 +1377,7 @@ static int tcg_cpu_exec(CPUArchState *env)
}
qemu_mutex_unlock_iothread();
ret = cpu_exec(env);
+ cpu->tcg_executing = 0;
qemu_mutex_lock_iothread();
#ifdef CONFIG_PROFILER
tcg_time += profile_getclock() - ti;
diff --git a/include/qom/cpu.h b/include/qom/cpu.h
index af3c9e4..1464afa 100644
--- a/include/qom/cpu.h
+++ b/include/qom/cpu.h
@@ -222,6 +222,7 @@ struct kvm_run;
* @stopped: Indicates the CPU has been artificially stopped.
* @tcg_exit_req: Set to force TCG to stop executing linked TBs for this
* CPU and return to its top level loop.
+ * @tcg_executing: This TCG thread is in cpu_exec().
* @singlestep_enabled: Flags for single-stepping.
* @icount_extra: Instructions until next timer event.
* @icount_decr: Number of cycles left, with interrupt flag in high bit.
@@ -315,6 +316,8 @@ struct CPUState {
(absolute value) offset as small as possible. This reduces code
size, especially for hosts without large memory offsets. */
volatile sig_atomic_t tcg_exit_req;
+
+ volatile int tcg_executing;
};
QTAILQ_HEAD(CPUTailQ, CPUState);
diff --git a/qom/cpu.c b/qom/cpu.c
index 108bfa2..ff41a4c 100644
--- a/qom/cpu.c
+++ b/qom/cpu.c
@@ -249,6 +249,7 @@ static void cpu_common_reset(CPUState *cpu)
cpu->icount_decr.u32 = 0;
cpu->can_do_io = 0;
cpu->exception_index = -1;
+ cpu->tcg_executing = 0;
memset(cpu->tb_jmp_cache, 0, TB_JMP_CACHE_SIZE * sizeof(void *));
}
--
1.9.0
- [Qemu-devel] [RFC PATCH V6 06/18] tcg: remove tcg_halt_cond global variable., (continued)
- [Qemu-devel] [RFC PATCH V6 08/18] cpu: remove exit_request global., fred . konrad, 2015/06/26
- [Qemu-devel] [RFC PATCH V6 09/18] cpu: add a tcg_executing flag.,
fred . konrad <=
- [Qemu-devel] [RFC PATCH V6 10/18] tcg: switch on multithread., fred . konrad, 2015/06/26
- [Qemu-devel] [RFC PATCH V6 11/18] cpus: make qemu_cpu_kick_thread public., fred . konrad, 2015/06/26
- [Qemu-devel] [RFC PATCH V6 07/18] Drop global lock during TCG code execution, fred . konrad, 2015/06/26
[Qemu-devel] [RFC PATCH V6 12/18] Use atomic cmpxchg to atomically check the exclusive value in a STREX, fred . konrad, 2015/06/26
[Qemu-devel] [RFC PATCH V6 14/18] add a callback when tb_invalidate is called., fred . konrad, 2015/06/26