[PATCH 00/17] accel/tcg: Use IntervalTree for breakpoints and watchpoints

Richard Henderson posted 17 patches 3 weeks, 4 days ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20260701030443.1382447-1-richard.henderson@linaro.org
Maintainers: Richard Henderson <richard.henderson@linaro.org>, Paolo Bonzini <pbonzini@redhat.com>, "Philippe Mathieu-Daudé" <philmd@mailo.com>, "Alex Bennée" <alex.bennee@linaro.org>, Zhao Liu <zhao1.liu@intel.com>, Laurent Vivier <laurent@vivier.eu>, Helge Deller <deller@gmx.de>, Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>, Peter Maydell <peter.maydell@linaro.org>, Marcelo Tosatti <mtosatti@redhat.com>, Nicholas Piggin <npiggin@gmail.com>, Chinmay Rath <rathc@linux.ibm.com>, Glenn Miles <milesg@linux.ibm.com>, Harsh Prateek Bora <harshpb@linux.ibm.com>, Palmer Dabbelt <palmer@dabbelt.com>, Alistair Francis <alistair.francis@wdc.com>, Weiwei Li <liwei1518@gmail.com>, Daniel Henrique Barboza <daniel.barboza@oss.qualcomm.com>, Liu Zhiwei <zhiwei_liu@linux.alibaba.com>, Chao Liu <chao.liu.zevorn@gmail.com>, Max Filippov <jcmvbkbc@gmail.com>
There is a newer version of this series
include/accel/tcg/cpu-ops.h         |   4 +-
include/exec/breakpoint.h           |  39 ++++++++--
include/hw/core/cpu.h               |  39 +---------
include/qemu/typedefs.h             |   2 +
target/arm/internals.h              |   4 +-
target/ppc/internal.h               |   4 +-
target/riscv/debug.h                |   4 +-
target/xtensa/cpu.h                 |   2 +-
accel/tcg/cpu-exec.c                |  48 ++++++------
accel/tcg/tcg-accel-ops.c           |   1 +
cpu-common.c                        |  54 ++++++++-----
gdbstub/system.c                    |   1 +
gdbstub/user.c                      |   1 +
hw/core/cpu-common.c                |   1 -
linux-user/main.c                   |  13 +++-
system/watchpoint.c                 |   1 +
target/arm/tcg/debug.c              |  76 ++++--------------
target/i386/cpu.c                   |   1 +
target/i386/kvm/kvm.c               |   1 +
target/i386/machine.c               |   1 +
target/i386/tcg/system/bpt_helper.c |   1 +
target/i386/tcg/tcg-cpu.c           |   2 +-
target/ppc/cpu.c                    |   1 +
target/ppc/tcg-excp_helper.c        |   4 +-
target/riscv/debug.c                | 116 ++++++----------------------
target/xtensa/dbg_helper.c          |  19 ++---
target/xtensa/helper.c              |   1 +
27 files changed, 174 insertions(+), 267 deletions(-)
[PATCH 00/17] accel/tcg: Use IntervalTree for breakpoints and watchpoints
Posted by Richard Henderson 3 weeks, 4 days ago
Follow-up to 20260630171555.114844-1-shivangu@linux.ibm.com
("[RFC PATCH 0/2] change cpu->breakpoints to a GTree")

Beyond using interval-tree for breakpoints:

  - Pass the matching breakpoint to the target debug hook,
  - Allow the target to record an id/index for each BP or WP
    so that the target doesn't have to search for which item
    triggered, so that the target doesn't have to search again.
  - Convert both BP and WP to IntervalTree.


r~


Richard Henderson (17):
  accel/tcg: Pass CPUBreakpoint to debug_check_breakpoint
  accel/tcg: Constify CPUWatchpoint for debug_check_watchpoint
  cpu: Move cpu_breakpoint_test out of line
  exec/breakpoint: Move BP declarations from hw/core/cpu.h
  qemu/typedefs: Declare CPUBreakpoint and CPUWatchpoint globally
  *: Add missing include of exec/breakpoint.h
  hw/core/cpu: Remove exec/breakpoint.h include
  exec/breakpoint: Introduce BP_CPU_ID_SHIFT
  target/arm: Split is_wp out of bp_wp_matches
  target/arm: Set ID for watchpoints and breakpoints
  target/arm: Use bp argument in arm_debug_check_breakpoint
  target/arm: Use wp argument in arm_debug_check_watchpoint
  target/riscv: Set ID for watchpoints and breakpoints
  target/riscv: Use bp argument in riscv_cpu_debug_check_breakpoint
  target/riscv: Use bp argument in riscv_cpu_debug_check_watchpoint
  target/xtensa: Use BP_CPU_ID_SHIFT
  cpu: Use interval-tree for CPUBreakpoint

 include/accel/tcg/cpu-ops.h         |   4 +-
 include/exec/breakpoint.h           |  39 ++++++++--
 include/hw/core/cpu.h               |  39 +---------
 include/qemu/typedefs.h             |   2 +
 target/arm/internals.h              |   4 +-
 target/ppc/internal.h               |   4 +-
 target/riscv/debug.h                |   4 +-
 target/xtensa/cpu.h                 |   2 +-
 accel/tcg/cpu-exec.c                |  48 ++++++------
 accel/tcg/tcg-accel-ops.c           |   1 +
 cpu-common.c                        |  54 ++++++++-----
 gdbstub/system.c                    |   1 +
 gdbstub/user.c                      |   1 +
 hw/core/cpu-common.c                |   1 -
 linux-user/main.c                   |  13 +++-
 system/watchpoint.c                 |   1 +
 target/arm/tcg/debug.c              |  76 ++++--------------
 target/i386/cpu.c                   |   1 +
 target/i386/kvm/kvm.c               |   1 +
 target/i386/machine.c               |   1 +
 target/i386/tcg/system/bpt_helper.c |   1 +
 target/i386/tcg/tcg-cpu.c           |   2 +-
 target/ppc/cpu.c                    |   1 +
 target/ppc/tcg-excp_helper.c        |   4 +-
 target/riscv/debug.c                | 116 ++++++----------------------
 target/xtensa/dbg_helper.c          |  19 ++---
 target/xtensa/helper.c              |   1 +
 27 files changed, 174 insertions(+), 267 deletions(-)

-- 
2.43.0
Re: [PATCH 00/17] accel/tcg: Use IntervalTree for breakpoints and watchpoints
Posted by Richard Henderson 3 weeks, 4 days ago
On 6/30/26 20:04, Richard Henderson wrote:
> Follow-up to 20260630171555.114844-1-shivangu@linux.ibm.com
> ("[RFC PATCH 0/2] change cpu->breakpoints to a GTree")
> 
> Beyond using interval-tree for breakpoints:
> 
>    - Pass the matching breakpoint to the target debug hook,
>    - Allow the target to record an id/index for each BP or WP
>      so that the target doesn't have to search for which item
>      triggered, so that the target doesn't have to search again.
>    - Convert both BP and WP to IntervalTree.
> 
> 
> r~

Bah.  I was mid-rebase for this, and it's missing the CPUWatchpoint work.
I'll send a v2 tommorrow.


r~

> 
> 
> Richard Henderson (17):
>    accel/tcg: Pass CPUBreakpoint to debug_check_breakpoint
>    accel/tcg: Constify CPUWatchpoint for debug_check_watchpoint
>    cpu: Move cpu_breakpoint_test out of line
>    exec/breakpoint: Move BP declarations from hw/core/cpu.h
>    qemu/typedefs: Declare CPUBreakpoint and CPUWatchpoint globally
>    *: Add missing include of exec/breakpoint.h
>    hw/core/cpu: Remove exec/breakpoint.h include
>    exec/breakpoint: Introduce BP_CPU_ID_SHIFT
>    target/arm: Split is_wp out of bp_wp_matches
>    target/arm: Set ID for watchpoints and breakpoints
>    target/arm: Use bp argument in arm_debug_check_breakpoint
>    target/arm: Use wp argument in arm_debug_check_watchpoint
>    target/riscv: Set ID for watchpoints and breakpoints
>    target/riscv: Use bp argument in riscv_cpu_debug_check_breakpoint
>    target/riscv: Use bp argument in riscv_cpu_debug_check_watchpoint
>    target/xtensa: Use BP_CPU_ID_SHIFT
>    cpu: Use interval-tree for CPUBreakpoint
> 
>   include/accel/tcg/cpu-ops.h         |   4 +-
>   include/exec/breakpoint.h           |  39 ++++++++--
>   include/hw/core/cpu.h               |  39 +---------
>   include/qemu/typedefs.h             |   2 +
>   target/arm/internals.h              |   4 +-
>   target/ppc/internal.h               |   4 +-
>   target/riscv/debug.h                |   4 +-
>   target/xtensa/cpu.h                 |   2 +-
>   accel/tcg/cpu-exec.c                |  48 ++++++------
>   accel/tcg/tcg-accel-ops.c           |   1 +
>   cpu-common.c                        |  54 ++++++++-----
>   gdbstub/system.c                    |   1 +
>   gdbstub/user.c                      |   1 +
>   hw/core/cpu-common.c                |   1 -
>   linux-user/main.c                   |  13 +++-
>   system/watchpoint.c                 |   1 +
>   target/arm/tcg/debug.c              |  76 ++++--------------
>   target/i386/cpu.c                   |   1 +
>   target/i386/kvm/kvm.c               |   1 +
>   target/i386/machine.c               |   1 +
>   target/i386/tcg/system/bpt_helper.c |   1 +
>   target/i386/tcg/tcg-cpu.c           |   2 +-
>   target/ppc/cpu.c                    |   1 +
>   target/ppc/tcg-excp_helper.c        |   4 +-
>   target/riscv/debug.c                | 116 ++++++----------------------
>   target/xtensa/dbg_helper.c          |  19 ++---
>   target/xtensa/helper.c              |   1 +
>   27 files changed, 174 insertions(+), 267 deletions(-)
>