Skip to content

Stop all qemu-cpu threads on a breakpoint

Ilya Leoshkevich qemu-devel 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest18 patches 18 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/18gdbstub: Make gdb_get_char() staticgdbstub/internals.h gdbstub/user.c+1 -31 reply
2/18gdbstub: Move phy_memory_mode to GDBSystemStategdbstub/system.c+6 -61 reply
3/18gdbstub: Move gdb_syscall_mode to GDBSyscallStategdbstub/syscalls.c+10 -101 reply
4/18gdbstub: Factor out gdb_try_stop()gdbstub/gdbstub.c gdbstub/internals.h gdbstub/system.c +1 more+19 -151 reply
5/18accel/tcg: Factor out cpu_exec_user()accel/tcg/user-exec.c bsd-user/aarch64/target_arch_cpu.h bsd-user/arm/target_arch_cpu.h +20 more+35 -851 reply
6/18qemu-thread: Introduce QEMU_MUTEX_INITIALIZERinclude/qemu/thread-posix.h include/qemu/thread-win32.h+12 -01 reply
7/18qemu-thread: Introduce QEMU_COND_INITIALIZERinclude/qemu/thread-posix.h include/qemu/thread-win32.h+4 -01 reply
8/18replay: Add replay_mutex_{lock, unlock}() stubs for qemu-userinclude/exec/replay-core.h include/sysemu/replay.h replay/stubs-system.c +3 more+35 -210 replies
9/18qemu-timer: Provide qemu_clock_enable() stub for qemu-userstubs/meson.build stubs/qemu-timer.c+10 -00 replies
10/18cpu: Use BQL in qemu-useraccel/tcg/user-exec.c bsd-user/freebsd/os-syscall.c bsd-user/main.c +5 more+72 -490 replies
11/18accel/tcg: Unify user implementations of qemu_cpu_kick()accel/tcg/user-exec.c bsd-user/main.c linux-user/main.c+5 -101 reply
12/18cpu: Track CPUs executing syscallsaccel/tcg/user-exec.c bsd-user/freebsd/os-syscall.c include/exec/cpu-common.h +2 more+22 -00 replies
13/18cpu: Implement cpu_thread_is_idle() for qemu-useraccel/tcg/user-exec.c cpu-common.c include/exec/cpu-common.h +2 more+38 -140 replies
14/18cpu: Introduce cpu_is_paused()accel/tcg/user-exec.c include/exec/cpu-common.h system/cpus.c+12 -10 replies
15/18cpu: Set current_cpu early in qemu-userbsd-user/main.c linux-user/main.c linux-user/syscall.c+3 -00 replies
16/18cpu: Allow pausing and resuming CPUs in qemu-useraccel/tcg/user-exec-stub.c accel/tcg/user-exec.c cpu-common.c +3 more+132 -1180 replies
17/18gdbstub: Pause all CPUs before sending stop repliesgdbstub/gdbstub.c gdbstub/user.c+11 -10 replies
18/18tests/tcg: Stress test thread breakpointstests/tcg/multiarch/Makefile.target tests/tcg/multiarch/gdbstub/test-thread-breakpoint-stress.py tests/tcg/multiarch/thread-breakpoint-stress.c+132 -10 replies

Reviews trailers per patch

8 of 18 patches have a Reviewed-by or Acked-by.

PatchRichard Henderson
1/18R-b
2/18R-b
3/18R-b
4/18R-b
5/18R-b
6/18R-b
7/18R-b
8/18
9/18
10/18
11/18R-b
12/18
13/18
14/18
15/18
16/18
17/18
18/18

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 00/18] Stop all qemu-cpu threads on a breakpoint

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
Signature · 1 line
2.46.0