You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
qemu/util
Ilya Leoshkevich f098c32db4 target/s390x: Fix infinite loop during replay
Replaying even trivial s390x kernels hangs, because:

- cpu_post_load() fires the TOD timer immediately.

- s390_tod_load() schedules work for firing the TOD timer.

- If rr loop sees work and then timer, we get one timer expiration.

- If rr loop sees timer and then work, we get two timer expirations.

- Record and replay may diverge due to this race.

- In this particular case divergence makes replay loop spin: it sees that
  TOD timer has expired, but cannot invoke its callback, because there
  is no recorded CHECKPOINT_CLOCK_VIRTUAL.

- The order in which rr loop sees work and timer depends on whether
  and when rr loop wakes up during load_snapshot().

- rr loop may wake up after the main thread kicks the CPU and drops
  the BQL, which may happen if it calls, e.g., qemu_cond_wait_bql().

Firing TOD timer twice is duplicate work, but it was introduced
intentionally in commit 7c12f710ba ("s390x/tcg: rearm the CKC timer
during migration") in order to avoid dependency on migration order.

The key culprits here are timers that are armed ready expired. They
break the ordering between timers and CPU work, because they are not
constrained by instruction execution, thus introducing non-determinism
and record-replay divergence.

Fix by converting such timer callbacks to CPU work. Also add TOD clock
updates to the save path, mirroring the load path, in order to have the
same CHECKPOINT_CLOCK_VIRTUAL during recording and replaying.

Link: https://lore.kernel.org/qemu-devel/20251128133949.181828-1-thuth@redhat.com/
Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
Tested-by: Thomas Huth <thuth@redhat.com>
Message-ID: <20251201215514.1751994-1-iii@linux.ibm.com>
[thuth: Add SPDX license identifiers to the new stubs files]
Signed-off-by: Thomas Huth <thuth@redhat.com>
2 days ago
..
aio-posix.c aio-posix: add aio_add_sqe() API for user-defined io_uring requests 2 months ago
aio-posix.h block: rename block/aio.h to qemu/aio.h 3 weeks ago
aio-wait.c block: rename block/aio-wait.h to qemu/aio-wait.h 3 weeks ago
aio-win32.c aio: add errp argument to aio_context_setup() 2 months ago
aiocb.c block: extract include/qemu/aiocb.h out of include/block/aio.h 3 weeks ago
async.c block: rename block/aio.h to qemu/aio.h 3 weeks ago
atomic64.c osdep: Move memalign-related functions to their own header 4 years ago
base64.c
bitmap.c migration: Use non-atomic ops for clear log bitmap 3 years ago
bitops.c replace TABs with spaces 3 years ago
block-helpers.c block: Adjust check_block_size() signature 1 year ago
block-helpers.h block: Adjust check_block_size() signature 1 year ago
buffer.c
bufferiszero.c util/bufferiszero: Split out host include files 2 years ago
cacheflush.c buildsys: Remove support for 32-bit PPC hosts 3 months ago
chardev_open.c util/char_dev: Add open_cdev() 2 years ago
compatfd.c util: replace pipe()+cloexec with g_unix_open_pipe() 4 years ago
coroutine-sigaltstack.c osdep: set _FORTIFY_SOURCE=2 when optimization is enabled 2 years ago
coroutine-ucontext.c coroutine-ucontext: Save fake stack for pooled coroutine 2 years ago
coroutine-wasm.c util: Add coroutine backend for emscripten 8 months ago
coroutine-windows.c build: move coroutine backend selection to meson 3 years ago
cpuinfo-aarch64.c util/cpuinfo: Make use of elf_aux_info(3) on OpenBSD 1 year ago
cpuinfo-i386.c cpuinfo/i386: Detect GFNI as an AVX extension 4 months ago
cpuinfo-loongarch.c util/loongarch64: Detect LASX vector support 2 years ago
cpuinfo-ppc.c util/cpuinfo: Make use of elf_aux_info(3) on OpenBSD 1 year ago
cpuinfo-riscv.c util/cpuinfo-riscv: Detect Zbs 1 year ago
crc-ccitt.c
crc32c.c igb: Implement Rx SCTP CSO 3 years ago
cutils.c util/cutils: Remove unused qemu_get_exec_dir 1 year ago
dbus.c
defer-call.c util/defer-call: move defer_call() to util/ 2 years ago
drm.c
envlist.c envlist: Remove unused envlist_parse 1 year ago
error-report.c Remove glib compatibility code that is not required anymore 2 years ago
error.c error: Kill @error_warn 4 months ago
event.c qemu-thread: Use futex for QemuEvent on Windows 7 months ago
event_notifier-posix.c treewide: use qemu_set_blocking instead of g_unix_set_fd_nonblocking 4 months ago
event_notifier-win32.c Remove qemu-common.h include from most units 4 years ago
fdmon-epoll.c aio-posix: integrate fdmon into glib event loop 2 months ago
fdmon-io_uring.c aio-posix: add aio_add_sqe() API for user-defined io_uring requests 2 months ago
fdmon-poll.c aio-posix: integrate fdmon into glib event loop 2 months ago
fifo8.c fifo8: introduce fifo8_peek() function 1 year ago
filemonitor-inotify.c util/filemonitor-inotify.c: spelling fix: kenel 2 years ago
filemonitor-stub.c
getauxval.c util/cpuinfo: Make use of elf_aux_info(3) on OpenBSD 1 year ago
guest-random.c util/guest-random: Clean up global variable shadowing 2 years ago
hbitmap.c qapi/crypto: Rename QCryptoHashAlgorithm to *Algo, and drop prefix 1 year ago
hexdump.c util/hexdump: fix QEMU_HEXDUMP_LINE_WIDTH logic 2 months ago
host-utils.c host-utils: Implemented signed 256-by-128 division 4 years ago
id.c
int128.c include/qemu/int128: Use Int128 structure for TCI 3 years ago
interval-tree.c util/interval-tree: Check root for null in interval_tree_iter_first 2 years ago
iov.c util/iov: Do not assert offset is in iov 10 months ago
iova-tree.c vhost-iova-tree, svq: Implement GPA->IOVA & partial IOVA->HVA trees 11 months ago
keyval.c qapi: Move include/qapi/qmp/ to include/qobject/ 11 months ago
lockcnt.c qemu-thread: Use futex if available for QemuLockCnt 7 months ago
log.c Fix const qualifier build errors with recent glibc 1 month ago
main-loop.c block: rename block/aio.h to qemu/aio.h 3 weeks ago
memalign.c osdep: Move memalign-related functions to their own header 4 years ago
memfd.c physmem: fd-based shared memory 12 months ago
meson.build qemu-thread: Use futex for QemuEvent on Windows 7 months ago
mmap-alloc.c util/mmap-alloc: qemu_fd_getfs() 3 years ago
module.c overall: Remove unnecessary g_strdup_printf() calls 11 months ago
notify.c notify: pass error to notifier with return 2 years ago
nvdimm-utils.c
osdep.c migration: Add direct-io parameter 2 years ago
oslib-posix.c oslib: qemu_clear_cloexec 3 months ago
oslib-win32.c util: Move qemu_ftruncate64 from block/file-win32.c to oslib-win32.c 2 weeks ago
path.c
qdist.c util: spelling fixes 2 years ago
qemu-co-shared-resource.c util/co-shared-resource: Remove unused co_try_get_from_shres 1 year ago
qemu-co-timeout.c block: rename block/aio.h to qemu/aio.h 3 weeks ago
qemu-config.c qapi: Move include/qapi/qmp/ to include/qobject/ 11 months ago
qemu-coroutine-io.c aio: remove aio_disable_external() API 3 years ago
qemu-coroutine-lock.c block: rename block/aio.h to qemu/aio.h 3 weeks ago
qemu-coroutine-sleep.c block: rename block/aio.h to qemu/aio.h 3 weeks ago
qemu-coroutine.c block: rename block/aio.h to qemu/aio.h 3 weeks ago
qemu-option.c qapi: Move include/qapi/qmp/ to include/qobject/ 11 months ago
qemu-print.c
qemu-progress.c include: move progress API to qemu-progress.h 4 years ago
qemu-sockets.c util/qemu-sockets: Introduce inet socket options controlling TCP keep-alive 8 months ago
qemu-thread-common.h bql: Fix bql_locked status with condvar APIs 2 months ago
qemu-thread-posix.c qemu-thread: Use futex for QemuEvent on Windows 7 months ago
qemu-thread-win32.c qemu-thread: Use futex for QemuEvent on Windows 7 months ago
qemu-timer-common.c
qemu-timer.c target/s390x: Fix infinite loop during replay 2 days ago
qht.c cleanup: Drop pointless return at end of function 9 months ago
qsp.c system/cpus: rename qemu_mutex_lock_iothread() to bql_lock() 2 years ago
qtree.c tcg: use QTree instead of GTree 3 years ago
range.c util/range.c: spelling fix: inbetween 2 years ago
rcu.c rcu: Unify force quiescent state 3 months ago
readline.c util/readline: Add C-u shortcut 2 years ago
reserved-region.c util/reserved-region: Add new ReservedRegion helpers 2 years ago
s390x_pci_mmio.c util: Add functions for s390x mmio read/write 8 months ago
selfmap.c util/selfmap: Use dev_t and ino_t in MapInfo 2 years ago
stats64.c stat64: Add stat64_set() operation 3 years ago
sys_membarrier.c
systemd.c systemd: Also clear LISTEN_FDNAMES during systemd socket activation 3 years ago
thread-context.c qom: Make InterfaceInfo[] uses const 9 months ago
thread-pool.c thread-pool: Fix thread race 3 weeks ago
throttle.c block: rename block/aio.h to qemu/aio.h 3 weeks ago
timed-average.c license: Simplify GPL-2.0-or-later license descriptions 1 year ago
trace-events aio-posix: add aio_add_sqe() API for user-defined io_uring requests 2 months ago
trace.h
transactions.c transactions: Invoke clean() after everything else 4 years ago
unicode.c
userfaultfd.c util/userfaultfd: Remove unused uffd_poll_events 1 year ago
uuid.c util/uuid: Add UUID_STR_LEN definition 2 years ago
vfio-helpers.c error: Use error_setg_file_open() for simplicity and consistency 1 week ago
vhost-user-server.c block: rename block/aio-wait.h to qemu/aio-wait.h 3 weeks ago
yank.c qapi: Fix dangling references to docs/devel/qapi-code-gen.txt 2 years ago