[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [RFC PATCH V6 09/18] cpu: add a tcg_executing flag.
From: |
Alex Bennée |
Subject: |
Re: [Qemu-devel] [RFC PATCH V6 09/18] cpu: add a tcg_executing flag. |
Date: |
Tue, 07 Jul 2015 14:23:00 +0100 |
address@hidden writes:
> From: KONRAD Frederic <address@hidden>
>
> We need to know whether any other VCPU is executing code or not it's possible
> with this flag.
Reword: "This flag indicates if the vCPU is currently executing TCG code"?
>
> 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;
This is an odd pairing, having the set in cpu_exec but the clear in the
outer call to it. Any particular reason it is unbalanced?
> 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 *));
> }
--
Alex Bennée
- Re: [Qemu-devel] [RFC PATCH V6 09/18] cpu: add a tcg_executing flag.,
Alex Bennée <=