From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44481) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZDaqe-00078i-D0 for qemu-devel@nongnu.org; Fri, 10 Jul 2015 12:08:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZDaqd-000887-8t for qemu-devel@nongnu.org; Fri, 10 Jul 2015 12:08:24 -0400 Received: from greensocs.com ([193.104.36.180]:38887) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZDaqc-00087d-UV for qemu-devel@nongnu.org; Fri, 10 Jul 2015 12:08:23 -0400 From: fred.konrad@greensocs.com Date: Fri, 10 Jul 2015 18:08:05 +0200 Message-Id: <1436544486-31169-3-git-send-email-fred.konrad@greensocs.com> In-Reply-To: <1436544486-31169-1-git-send-email-fred.konrad@greensocs.com> References: <1436544486-31169-1-git-send-email-fred.konrad@greensocs.com> Subject: [Qemu-devel] [RFC PATCH V2 2/3] cpus: add a tcg_executing flag. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org, mttcg@listserver.greensocs.com Cc: mark.burton@greensocs.com, a.rigo@virtualopensystems.com, guillaume.delbergue@greensocs.com, pbonzini@redhat.com, alex.bennee@linaro.org, fred.konrad@greensocs.com From: KONRAD Frederic This flag indicates if the VCPU is currently executing TCG code. Signed-off-by: KONRAD Frederic Changes V1 -> V2: * do both tcg_executing = 0 or 1 in cpu_exec(). --- cpu-exec.c | 2 ++ include/qom/cpu.h | 3 +++ qom/cpu.c | 1 + 3 files changed, 6 insertions(+) diff --git a/cpu-exec.c b/cpu-exec.c index 75694f3..2fdf89d 100644 --- a/cpu-exec.c +++ b/cpu-exec.c @@ -371,6 +371,7 @@ int cpu_exec(CPUState *cpu) cpu->halted = 0; } + cpu->tcg_executing = 1; current_cpu = cpu; /* As long as current_cpu is null, up to the assignment just above, @@ -583,5 +584,6 @@ int cpu_exec(CPUState *cpu) /* fail safe : never use current_cpu outside cpu_exec() */ current_cpu = NULL; + cpu->tcg_executing = 0; return ret; } diff --git a/include/qom/cpu.h b/include/qom/cpu.h index efa9624..a2de536 100644 --- a/include/qom/cpu.h +++ b/include/qom/cpu.h @@ -226,6 +226,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. @@ -322,6 +323,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 4e12598..62663e5 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