From: Ilya Leoshkevich <iii@linux.ibm.com>
To: "Richard Henderson" <richard.henderson@linaro.org>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Alex Bennée" <alex.bennee@linaro.org>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>
Cc: qemu-devel@nongnu.org, Ilya Leoshkevich <iii@linux.ibm.com>
Subject: [PATCH 00/18] Stop all qemu-cpu threads on a breakpoint
Date: Mon, 23 Sep 2024 18:12:55 +0200 [thread overview]
Message-ID: <20240923162208.90745-1-iii@linux.ibm.com> (raw)
Hi,
On reporting a breakpoint in a non-non-stop mode, GDB remotes must stop
all threads. Currently qemu-user doesn't do that, breaking the
debugging session for at least two reasons: concurrent access to the
GDB socket, and an assertion within GDB [1].
This series fixes this by importing pause_all_vcpus() from qemu-system.
This in turn requires introducing BQL and a few stubs to qemu-user.
Best regards,
Ilya
[1] https://gitlab.com/qemu-project/qemu/-/issues/2465
Ilya Leoshkevich (18):
gdbstub: Make gdb_get_char() static
gdbstub: Move phy_memory_mode to GDBSystemState
gdbstub: Move gdb_syscall_mode to GDBSyscallState
gdbstub: Factor out gdb_try_stop()
accel/tcg: Factor out cpu_exec_user()
qemu-thread: Introduce QEMU_MUTEX_INITIALIZER
qemu-thread: Introduce QEMU_COND_INITIALIZER
replay: Add replay_mutex_{lock,unlock}() stubs for qemu-user
qemu-timer: Provide qemu_clock_enable() stub for qemu-user
cpu: Use BQL in qemu-user
accel/tcg: Unify user implementations of qemu_cpu_kick()
cpu: Track CPUs executing syscalls
cpu: Implement cpu_thread_is_idle() for qemu-user
cpu: Introduce cpu_is_paused()
cpu: Set current_cpu early in qemu-user
cpu: Allow pausing and resuming CPUs in qemu-user
gdbstub: Pause all CPUs before sending stop replies
tests/tcg: Stress test thread breakpoints
accel/tcg/user-exec-stub.c | 4 -
accel/tcg/user-exec.c | 55 ++++++
bsd-user/aarch64/target_arch_cpu.h | 6 +-
bsd-user/arm/target_arch_cpu.h | 5 +-
bsd-user/freebsd/os-syscall.c | 10 +
bsd-user/i386/target_arch_cpu.h | 5 +-
bsd-user/main.c | 8 +-
bsd-user/x86_64/target_arch_cpu.h | 5 +-
cpu-common.c | 179 ++++++++++++++++++
gdbstub/gdbstub.c | 17 +-
gdbstub/internals.h | 4 +-
gdbstub/syscalls.c | 20 +-
gdbstub/system.c | 18 +-
gdbstub/user.c | 28 ++-
include/exec/cpu-common.h | 15 ++
include/exec/replay-core.h | 13 ++
include/hw/core/cpu.h | 1 +
include/qemu/thread-posix.h | 8 +
include/qemu/thread-win32.h | 8 +
include/sysemu/cpus.h | 6 -
include/sysemu/replay.h | 13 --
linux-user/aarch64/cpu_loop.c | 5 +-
linux-user/alpha/cpu_loop.c | 5 +-
linux-user/arm/cpu_loop.c | 5 +-
linux-user/hexagon/cpu_loop.c | 5 +-
linux-user/hppa/cpu_loop.c | 5 +-
linux-user/i386/cpu_loop.c | 5 +-
linux-user/loongarch64/cpu_loop.c | 5 +-
linux-user/m68k/cpu_loop.c | 5 +-
linux-user/main.c | 9 +-
linux-user/microblaze/cpu_loop.c | 5 +-
linux-user/mips/cpu_loop.c | 5 +-
linux-user/openrisc/cpu_loop.c | 5 +-
linux-user/ppc/cpu_loop.c | 5 +-
linux-user/riscv/cpu_loop.c | 5 +-
linux-user/s390x/cpu_loop.c | 5 +-
linux-user/sh4/cpu_loop.c | 5 +-
linux-user/sparc/cpu_loop.c | 5 +-
linux-user/syscall.c | 12 ++
linux-user/xtensa/cpu_loop.c | 5 +-
replay/stubs-system.c | 8 +
stubs/meson.build | 8 +
stubs/qemu-timer.c | 6 +
stubs/replay-mutex.c | 10 +
stubs/replay-tools.c | 8 -
system/cpus.c | 172 +----------------
tests/tcg/multiarch/Makefile.target | 13 +-
.../gdbstub/test-thread-breakpoint-stress.py | 28 +++
.../tcg/multiarch/thread-breakpoint-stress.c | 92 +++++++++
49 files changed, 552 insertions(+), 327 deletions(-)
create mode 100644 stubs/qemu-timer.c
create mode 100644 stubs/replay-mutex.c
create mode 100644 tests/tcg/multiarch/gdbstub/test-thread-breakpoint-stress.py
create mode 100644 tests/tcg/multiarch/thread-breakpoint-stress.c
--
2.46.0
next reply other threads:[~2024-09-23 16:25 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-23 16:12 Ilya Leoshkevich [this message]
2024-09-23 16:12 ` [PATCH 01/18] gdbstub: Make gdb_get_char() static Ilya Leoshkevich
2024-10-05 19:20 ` Richard Henderson
2024-09-23 16:12 ` [PATCH 02/18] gdbstub: Move phy_memory_mode to GDBSystemState Ilya Leoshkevich
2024-10-05 19:21 ` Richard Henderson
2024-09-23 16:12 ` [PATCH 03/18] gdbstub: Move gdb_syscall_mode to GDBSyscallState Ilya Leoshkevich
2024-10-05 19:22 ` Richard Henderson
2024-09-23 16:12 ` [PATCH 04/18] gdbstub: Factor out gdb_try_stop() Ilya Leoshkevich
2024-10-05 19:26 ` Richard Henderson
2024-09-23 16:13 ` [PATCH 05/18] accel/tcg: Factor out cpu_exec_user() Ilya Leoshkevich
2024-10-05 19:29 ` Richard Henderson
2024-09-23 16:13 ` [PATCH 06/18] qemu-thread: Introduce QEMU_MUTEX_INITIALIZER Ilya Leoshkevich
2024-10-05 19:30 ` Richard Henderson
2024-09-23 16:13 ` [PATCH 07/18] qemu-thread: Introduce QEMU_COND_INITIALIZER Ilya Leoshkevich
2024-10-05 19:30 ` Richard Henderson
2024-09-23 16:13 ` [PATCH 08/18] replay: Add replay_mutex_{lock, unlock}() stubs for qemu-user Ilya Leoshkevich
2024-09-23 16:13 ` [PATCH 09/18] qemu-timer: Provide qemu_clock_enable() stub " Ilya Leoshkevich
2024-09-23 16:13 ` [PATCH 10/18] cpu: Use BQL in qemu-user Ilya Leoshkevich
2024-09-23 16:13 ` [PATCH 11/18] accel/tcg: Unify user implementations of qemu_cpu_kick() Ilya Leoshkevich
2024-10-05 19:31 ` Richard Henderson
2024-09-23 16:13 ` [PATCH 12/18] cpu: Track CPUs executing syscalls Ilya Leoshkevich
2024-09-23 16:13 ` [PATCH 13/18] cpu: Implement cpu_thread_is_idle() for qemu-user Ilya Leoshkevich
2024-09-23 16:13 ` [PATCH 14/18] cpu: Introduce cpu_is_paused() Ilya Leoshkevich
2024-09-23 16:13 ` [PATCH 15/18] cpu: Set current_cpu early in qemu-user Ilya Leoshkevich
2024-09-23 16:13 ` [PATCH 16/18] cpu: Allow pausing and resuming CPUs " Ilya Leoshkevich
2024-09-23 16:13 ` [PATCH 17/18] gdbstub: Pause all CPUs before sending stop replies Ilya Leoshkevich
2024-09-23 16:13 ` [PATCH 18/18] tests/tcg: Stress test thread breakpoints Ilya Leoshkevich
2024-09-23 16:37 ` [PATCH 00/18] Stop all qemu-cpu threads on a breakpoint Ilya Leoshkevich
2024-09-24 11:46 ` Richard Henderson
2024-09-25 7:43 ` Ilya Leoshkevich
2024-10-05 19:51 ` Richard Henderson
2024-10-05 20:26 ` Ilya Leoshkevich
2024-10-05 20:35 ` Ilya Leoshkevich
2024-10-08 18:17 ` Richard Henderson
2024-10-09 22:01 ` Ilya Leoshkevich
2025-01-08 15:56 ` Alex Bennée
2025-01-08 16:20 ` Ilya Leoshkevich
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=20240923162208.90745-1-iii@linux.ibm.com \
--to=iii@linux.ibm.com \
--cc=alex.bennee@linaro.org \
--cc=pbonzini@redhat.com \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.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).