summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Henderson2020-08-06 01:06:26 +0200
committerRichard Henderson2020-09-03 22:13:58 +0200
commit4ca3d09cd9b2046984966ef430cca4572ae0a925 (patch)
treef276bd1088a74e1b1c1a6d016d7fb69e9449e560
parenttcg: Fix tcg gen for vectorized absolute value (diff)
downloadqemu-4ca3d09cd9b2046984966ef430cca4572ae0a925.tar.gz
qemu-4ca3d09cd9b2046984966ef430cca4572ae0a925.tar.xz
qemu-4ca3d09cd9b2046984966ef430cca4572ae0a925.zip
softmmu/cpus: Only set parallel_cpus for SMP
Do not set parallel_cpus if there is only one cpu instantiated. This will allow tcg to use serial code to implement atomics. Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
-rw-r--r--softmmu/cpus.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/softmmu/cpus.c b/softmmu/cpus.c
index a802e899ab..e3b98065c9 100644
--- a/softmmu/cpus.c
+++ b/softmmu/cpus.c
@@ -1895,6 +1895,16 @@ static void qemu_tcg_init_vcpu(CPUState *cpu)
if (!tcg_region_inited) {
tcg_region_inited = 1;
tcg_region_init();
+ /*
+ * If MTTCG, and we will create multiple cpus,
+ * then we will have cpus running in parallel.
+ */
+ if (qemu_tcg_mttcg_enabled()) {
+ MachineState *ms = MACHINE(qdev_get_machine());
+ if (ms->smp.max_cpus > 1) {
+ parallel_cpus = true;
+ }
+ }
}
if (qemu_tcg_mttcg_enabled() || !single_tcg_cpu_thread) {
@@ -1904,7 +1914,6 @@ static void qemu_tcg_init_vcpu(CPUState *cpu)
if (qemu_tcg_mttcg_enabled()) {
/* create a thread per vCPU with TCG (MTTCG) */
- parallel_cpus = true;
snprintf(thread_name, VCPU_THREAD_NAME_SIZE, "CPU %d/TCG",
cpu->cpu_index);