Skip to content

qemu-timer/mc146818rtc: fix timer issues related to clock changes

Paul Donohue qemu-devel 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 5 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2qemu-timer: Call clock reset notifiers on forward jumpsinclude/qemu/timer.h qemu-timer.c+9 -13 replies
2/2mc146818rtc: Reset the periodic timer on loadhw/timer/mc146818rtc.c+6 -02 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [Qemu-devel] [PATCH 0/2] qemu-timer/mc146818rtc: fix timer issues related to clock changes

If the host clock jumps forward or backward without resetting the mc146818rtc's periodic timer, the periodic timer interrupts will either fire rapidly (consuming host CPU and blocking operation of the VM) until the timer catches up to the new host clock, or will stall until the host clock catches up with the prior date used by the periodic timer.

A "reset notifier" mechanism was introduced a while back that resets the mc146818rtc's periodic timer if the host clock jumps backward while the VM is running. However, the timer is not reset if the host clock jumps forward while the VM is running, or if the clock jumps either forward or backward when loading a snapshot or migration.

In one test case, when loading a 3 week old snapshot, the timer loop consumed CPU and blocked the VM for nearly 90 seconds.

The following patches fix this issue by resetting the timer in these cases.

Paul Donohue (2):
qemu-timer: Call clock reset notifiers on large forward jumps
mc146818rtc: Reset the periodic timer on resume from snapshot

 hw/timer/mc146818rtc.c | 6 ++++++
 include/qemu/timer.h   | 9 +++++++++
 qemu-timer.c           | 2 +-
 3 files changed, 16 insertions(+), 1 deletion(-)