From: fred.konrad@greensocs.com
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
Subject: [Qemu-devel] [RFC PATCH V2 2/3] cpus: add a tcg_executing flag.
Date: Fri, 10 Jul 2015 18:08:05 +0200 [thread overview]
Message-ID: <1436544486-31169-3-git-send-email-fred.konrad@greensocs.com> (raw)
In-Reply-To: <1436544486-31169-1-git-send-email-fred.konrad@greensocs.com>
From: KONRAD Frederic <fred.konrad@greensocs.com>
This flag indicates if the VCPU is currently executing TCG code.
Signed-off-by: KONRAD Frederic <fred.konrad@greensocs.com>
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
next prev parent reply other threads:[~2015-07-10 16:08 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-10 16:08 [Qemu-devel] [RFC PATCH V2 0/3] Multithread TCG async_safe_work part fred.konrad
2015-07-10 16:08 ` [Qemu-devel] [RFC PATCH V2 1/3] cpus: protect queued_work_* with work_mutex fred.konrad
2015-07-10 16:08 ` fred.konrad [this message]
2015-07-13 15:56 ` [Qemu-devel] [RFC PATCH V2 2/3] cpus: add a tcg_executing flag Alex Bennée
2015-07-13 16:10 ` Peter Maydell
2015-07-13 16:15 ` Paolo Bonzini
2015-07-13 16:36 ` Alex Bennée
2015-07-15 8:40 ` Frederic Konrad
2015-07-10 16:08 ` [Qemu-devel] [RFC PATCH V2 3/3] cpus: introduce async_run_safe_work_on_cpu fred.konrad
2015-07-13 16:20 ` Alex Bennée
2015-07-13 22:56 ` Paolo Bonzini
2015-07-13 11:53 ` [Qemu-devel] [RFC PATCH V2 0/3] Multithread TCG async_safe_work part Paolo Bonzini
2015-07-13 15:50 ` Alex Bennée
2015-07-15 7:44 ` Frederic Konrad
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1436544486-31169-3-git-send-email-fred.konrad@greensocs.com \
--to=fred.konrad@greensocs.com \
--cc=a.rigo@virtualopensystems.com \
--cc=alex.bennee@linaro.org \
--cc=guillaume.delbergue@greensocs.com \
--cc=mark.burton@greensocs.com \
--cc=mttcg@listserver.greensocs.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).