qemu/tests
Peter Maydell 8d37a1425b target/arm: Handle overflow in calculation of next timer tick
In commit edac4d8a16 back in 2015 when we added support for
the virtual timer offset CNTVOFF_EL2, we didn't correctly update
the timer-recalculation code that figures out when the timer
interrupt is next going to change state. We got it wrong in
two ways:
 * for the 0->1 transition, we didn't notice that gt->cval + offset
   can overflow a uint64_t
 * for the 1->0 transition, we didn't notice that the transition
   might now happen before the count rolls over, if offset > count

In the former case, we end up trying to set the next interrupt
for a time in the past, which results in QEMU hanging as the
timer fires continuously.

In the latter case, we would fail to update the interrupt
status when we are supposed to.

Fix the calculations in both cases.

The test case is Alex Bennée's from the bug report, and tests
the 0->1 transition overflow case.

Fixes: edac4d8a16 ("target-arm: Add CNTVOFF_EL2")
Cc: qemu-stable@nongnu.org
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/60
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20231120173506.3729884-1-peter.maydell@linaro.org
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
2023-11-27 15:27:36 +00:00
..
avocado Revert "tests/avocado: Enable reverse_debugging.py tests in gitlab CI" 2023-11-21 10:28:55 -05:00
bench
data tests/data/qobject/qdict.txt: Avoid non-inclusive words 2023-11-15 11:09:17 +03:00
decode tests/: spelling fixes 2023-09-08 13:08:52 +03:00
docker tests/docker: merge debian-native with debian-amd64 2023-11-23 14:10:04 +00:00
fp
guest-debug
image-fuzzer
include
keys
lcitool tests/docker: merge debian-native with debian-amd64 2023-11-23 14:10:04 +00:00
migration tests/migration: Introduce dirty-limit into guestperf 2023-11-03 07:48:25 +01:00
multiboot
perf/block/qcow2
plugin plugins: fix win plugin tests on cross compile 2023-11-23 14:10:04 +00:00
qapi-schema tests/qapi-schema: Tidy up pylint warnings and advice 2023-11-13 10:36:51 +01:00
qemu-iotests iotests: Test two stream jobs in a single iothread 2023-11-21 12:45:21 +01:00
qtest tests/qtest/ufs-test.c: spelling fix: tranfer 2023-11-15 12:06:05 +03:00
rocker
tcg target/arm: Handle overflow in calculation of next timer tick 2023-11-27 15:27:36 +00:00
tsan tests/tsan: Rename the file with the entries that should be ignored 2023-11-13 11:35:47 +01:00
uefi-test-tools tests/: spelling fixes 2023-09-08 13:08:52 +03:00
unit block: Fix deadlocks in bdrv_graph_wrunlock() 2023-11-21 12:45:21 +01:00
vm tests/vm/netbsd: Use Python v3.11 2023-11-13 11:35:47 +01:00
vmstate-static-checker-data
dbus-vmstate-daemon.sh
Makefile.include Makefile: build plugins before running TCG tests 2023-10-02 18:04:39 +02:00
meson.build Makefile: build plugins before running TCG tests 2023-10-02 18:04:39 +02:00
test-qht-par.c
vhost-user-bridge.c