[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 14/18] cpu: Introduce cpu_is_paused()
From: |
Ilya Leoshkevich |
Subject: |
[PATCH 14/18] cpu: Introduce cpu_is_paused() |
Date: |
Mon, 23 Sep 2024 18:13:09 +0200 |
A qemu-system CPU is considered paused as a result of an external
request. A qemu-user CPU, in addition to that, should be considered
paused when it's executing a syscall.
Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
---
accel/tcg/user-exec.c | 5 +++++
include/exec/cpu-common.h | 1 +
system/cpus.c | 7 ++++++-
3 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/accel/tcg/user-exec.c b/accel/tcg/user-exec.c
index 57a13c81fc4..de4753cded7 100644
--- a/accel/tcg/user-exec.c
+++ b/accel/tcg/user-exec.c
@@ -1329,3 +1329,8 @@ bool cpu_thread_is_idle(CPUState *cpu)
return ret == -1 ? true : ret;
}
+
+bool cpu_is_paused(CPUState *cpu)
+{
+ return cpu->stopped || cpu->in_syscall;
+}
diff --git a/include/exec/cpu-common.h b/include/exec/cpu-common.h
index d7fc24bc13d..e8b530ed889 100644
--- a/include/exec/cpu-common.h
+++ b/include/exec/cpu-common.h
@@ -233,6 +233,7 @@ void cpu_exit_syscall(CPUState *cs);
int cpu_thread_is_idle_common(CPUState *cpu);
bool cpu_thread_is_idle(CPUState *cpu);
+bool cpu_is_paused(CPUState *cpu);
/**
* env_archcpu(env)
diff --git a/system/cpus.c b/system/cpus.c
index 13072be26fa..407140c41f6 100644
--- a/system/cpus.c
+++ b/system/cpus.c
@@ -530,12 +530,17 @@ void cpu_resume(CPUState *cpu)
qemu_cpu_kick(cpu);
}
+bool cpu_is_paused(CPUState *cpu)
+{
+ return cpu->stopped;
+}
+
static bool all_vcpus_paused(void)
{
CPUState *cpu;
CPU_FOREACH(cpu) {
- if (!cpu->stopped) {
+ if (!cpu_is_paused(cpu)) {
return false;
}
}
--
2.46.0
- [PATCH 00/18] Stop all qemu-cpu threads on a breakpoint, Ilya Leoshkevich, 2024/09/23
- [PATCH 03/18] gdbstub: Move gdb_syscall_mode to GDBSyscallState, Ilya Leoshkevich, 2024/09/23
- [PATCH 02/18] gdbstub: Move phy_memory_mode to GDBSystemState, Ilya Leoshkevich, 2024/09/23
- [PATCH 04/18] gdbstub: Factor out gdb_try_stop(), Ilya Leoshkevich, 2024/09/23
- [PATCH 08/18] replay: Add replay_mutex_{lock, unlock}() stubs for qemu-user, Ilya Leoshkevich, 2024/09/23
- [PATCH 10/18] cpu: Use BQL in qemu-user, Ilya Leoshkevich, 2024/09/23
- [PATCH 16/18] cpu: Allow pausing and resuming CPUs in qemu-user, Ilya Leoshkevich, 2024/09/23
- [PATCH 05/18] accel/tcg: Factor out cpu_exec_user(), Ilya Leoshkevich, 2024/09/23
- [PATCH 15/18] cpu: Set current_cpu early in qemu-user, Ilya Leoshkevich, 2024/09/23
- [PATCH 14/18] cpu: Introduce cpu_is_paused(),
Ilya Leoshkevich <=
- [PATCH 12/18] cpu: Track CPUs executing syscalls, Ilya Leoshkevich, 2024/09/23
- [PATCH 01/18] gdbstub: Make gdb_get_char() static, Ilya Leoshkevich, 2024/09/23
- [PATCH 09/18] qemu-timer: Provide qemu_clock_enable() stub for qemu-user, Ilya Leoshkevich, 2024/09/23
- [PATCH 06/18] qemu-thread: Introduce QEMU_MUTEX_INITIALIZER, Ilya Leoshkevich, 2024/09/23
- [PATCH 18/18] tests/tcg: Stress test thread breakpoints, Ilya Leoshkevich, 2024/09/23
- [PATCH 13/18] cpu: Implement cpu_thread_is_idle() for qemu-user, Ilya Leoshkevich, 2024/09/23
- [PATCH 07/18] qemu-thread: Introduce QEMU_COND_INITIALIZER, Ilya Leoshkevich, 2024/09/23
- [PATCH 11/18] accel/tcg: Unify user implementations of qemu_cpu_kick(), Ilya Leoshkevich, 2024/09/23
- [PATCH 17/18] gdbstub: Pause all CPUs before sending stop replies, Ilya Leoshkevich, 2024/09/23
- Re: [PATCH 00/18] Stop all qemu-cpu threads on a breakpoint, Ilya Leoshkevich, 2024/09/23