[PATCH 0/2] accel/tcg: Fix icount accounting on CPU reset

Philippe Mathieu-Daudé posted 2 patches 3 weeks, 5 days ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20261027180713.2386-1-philmd@oss.qualcomm.com
Maintainers: Richard Henderson <richard.henderson@linaro.org>, Paolo Bonzini <pbonzini@redhat.com>, "Philippe Mathieu-Daudé" <philmd@oss.qualcomm.com>, Zhao Liu <zhao1.liu@intel.com>, Fabiano Rosas <farosas@suse.de>, Laurent Vivier <lvivier@redhat.com>
include/exec/icount.h         |   2 +
accel/tcg/icount-common.c     |  16 +++++
hw/core/cpu-common.c          |   4 +-
stubs/icount.c                |   3 +
tests/qtest/icount-x86-test.c | 119 ++++++++++++++++++++++++++++++++++
tests/qtest/meson.build       |   2 +
6 files changed, 144 insertions(+), 2 deletions(-)
create mode 100644 tests/qtest/icount-x86-test.c
[PATCH 0/2] accel/tcg: Fix icount accounting on CPU reset
Posted by Philippe Mathieu-Daudé 3 weeks, 5 days ago
When TCG runs with '-icount', resetting a vCPU from inside
cpu_exec() can advance the virtual clock by the whole unused
part of that vCPU's current instruction budget.

Fix by accounting the instructions executed so far immediately
before the common CPU reset path clears the decrementer. Resets
outside active cpu_exec() remain unchanged.

Philippe Mathieu-Daudé (2):
  accel/tcg: Extract icount_cpu_reset() helper
  accel/tcg: Fix icount accounting on CPU reset

 include/exec/icount.h         |   2 +
 accel/tcg/icount-common.c     |  16 +++++
 hw/core/cpu-common.c          |   4 +-
 stubs/icount.c                |   3 +
 tests/qtest/icount-x86-test.c | 119 ++++++++++++++++++++++++++++++++++
 tests/qtest/meson.build       |   2 +
 6 files changed, 144 insertions(+), 2 deletions(-)
 create mode 100644 tests/qtest/icount-x86-test.c

-- 
2.55.0