[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v4 01/30] accel/tcg: Restrict cpu_handle_halt() to sysemu
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH v4 01/30] accel/tcg: Restrict cpu_handle_halt() to sysemu |
Date: |
Sun, 12 Sep 2021 19:27:02 +0200 |
Commit 372579427a5 ("tcg: enable thread-per-vCPU") added the following
comment describing EXCP_HALTED in qemu_tcg_cpu_thread_fn():
case EXCP_HALTED:
/* during start-up the vCPU is reset and the thread is
* kicked several times. If we don't ensure we go back
* to sleep in the halted state we won't cleanly
* start-up when the vCPU is enabled.
*
* cpu->halted should ensure we sleep in wait_io_event
*/
g_assert(cpu->halted);
break;
qemu_wait_io_event() is sysemu-specific, so we can restrict the
cpu_handle_halt() call in cpu_exec() to system emulation.
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
v4: Reduce ifdef'ry to cpu_handle_halt (rth)
---
accel/tcg/cpu-exec.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c
index 75dbc1e4e33..5fd1ed34222 100644
--- a/accel/tcg/cpu-exec.c
+++ b/accel/tcg/cpu-exec.c
@@ -588,8 +588,9 @@ static inline void tb_add_jump(TranslationBlock *tb, int n,
static inline bool cpu_handle_halt(CPUState *cpu)
{
+#ifndef CONFIG_USER_ONLY
if (cpu->halted) {
-#if defined(TARGET_I386) && !defined(CONFIG_USER_ONLY)
+#if defined(TARGET_I386)
if (cpu->interrupt_request & CPU_INTERRUPT_POLL) {
X86CPU *x86_cpu = X86_CPU(cpu);
qemu_mutex_lock_iothread();
@@ -597,13 +598,14 @@ static inline bool cpu_handle_halt(CPUState *cpu)
cpu_reset_interrupt(cpu, CPU_INTERRUPT_POLL);
qemu_mutex_unlock_iothread();
}
-#endif
+#endif /* TARGET_I386 */
if (!cpu_has_work(cpu)) {
return true;
}
cpu->halted = 0;
}
+#endif /* !CONFIG_USER_ONLY */
return false;
}
--
2.31.1
- [PATCH v4 00/30] accel: Move has_work() from SysemuCPUOps to AccelOpsClass, Philippe Mathieu-Daudé, 2021/09/12
- [PATCH v4 01/30] accel/tcg: Restrict cpu_handle_halt() to sysemu,
Philippe Mathieu-Daudé <=
- [PATCH v4 02/30] hw/core: Restrict cpu_has_work() to sysemu, Philippe Mathieu-Daudé, 2021/09/12
- [PATCH v4 03/30] hw/core: Un-inline cpu_has_work(), Philippe Mathieu-Daudé, 2021/09/12
- [PATCH v4 04/30] sysemu: Introduce AccelOpsClass::has_work(), Philippe Mathieu-Daudé, 2021/09/12
- [PATCH v4 05/30] accel/kvm: Implement AccelOpsClass::has_work(), Philippe Mathieu-Daudé, 2021/09/12
- [PATCH v4 07/30] accel/tcg: Implement AccelOpsClass::has_work() as stub, Philippe Mathieu-Daudé, 2021/09/12
- [PATCH v4 06/30] accel/whpx: Implement AccelOpsClass::has_work(), Philippe Mathieu-Daudé, 2021/09/12
- [PATCH v4 08/30] target/alpha: Restrict has_work() handler to sysemu, Philippe Mathieu-Daudé, 2021/09/12
- [PATCH v4 09/30] target/arm: Restrict has_work() handler to sysemu and TCG, Philippe Mathieu-Daudé, 2021/09/12
- [PATCH v4 10/30] target/avr: Restrict has_work() handler to sysemu, Philippe Mathieu-Daudé, 2021/09/12