[PATCH 0/2] target/arm: Read generic timer counters without the BQL

Philippe Mathieu-Daudé posted 2 patches 1 day, 2 hours ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20261126223959.62899-1-philmd@oss.qualcomm.com
Maintainers: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>, Peter Maydell <peter.maydell@linaro.org>
docs/devel/multi-thread-tcg.rst |  8 +++++---
target/arm/cpregs.h             | 11 ++++++++++-
target/arm/helper.c             | 24 ++++++++++++------------
target/arm/tcg/op_helper.c      |  8 ++++----
target/arm/tcg/translate-a64.c  |  2 +-
target/arm/tcg/translate.c      |  2 +-
6 files changed, 33 insertions(+), 22 deletions(-)
[PATCH 0/2] target/arm: Read generic timer counters without the BQL
Posted by Philippe Mathieu-Daudé 1 day, 2 hours ago
ARM_CP_IO both ends the TB and takes the BQL around the hooks.

Split it into ARM_CP_IO_ENDTB and ARM_CP_IO_BQL (ARM_CP_IO is
their union, so existing registers are unchanged), then mark
CNTPCT/CNTVCT and their SS variants ENDTB only: they are
read-only and only use per-CPU state and QEMU_CLOCK_VIRTUAL,
read through the timers_state seqlock.

Under MTTCG, counter reads are no longer serialized on the
BQL; with icount this relies on the qemu_icount series
based-on below.

Note, RISC-V cycle and instret CSR reads reach icount_get()
and icount_get_raw() without holding the BQL. Call path:

  helper_csrr()
    riscv_csrr()
      read_hpmcounter()
        riscv_pmu_ctr_get_fixed_counters_val()
          cycle = icount_get()
          instret = icount_get_raw()

Based-on: <20261126222530.62175-1-philmd@oss.qualcomm.com>
"accel/tcg: Do not write qemu_icount from seqlock readers"

Philippe Mathieu-Daudé (2):
  target/arm: Split ARM_CP_IO as ARM_CP_IO_ENDTB + ARM_CP_IO_BQL
  target/arm: Read generic timer counters without the BQL

 docs/devel/multi-thread-tcg.rst |  8 +++++---
 target/arm/cpregs.h             | 11 ++++++++++-
 target/arm/helper.c             | 24 ++++++++++++------------
 target/arm/tcg/op_helper.c      |  8 ++++----
 target/arm/tcg/translate-a64.c  |  2 +-
 target/arm/tcg/translate.c      |  2 +-
 6 files changed, 33 insertions(+), 22 deletions(-)

-- 
2.55.0