[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 13/15] mc146818rtc: Reset the periodic timer on load
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PULL 13/15] mc146818rtc: Reset the periodic timer on load |
Date: |
Fri, 19 Jun 2015 09:45:34 +0200 |
From: Paul Donohue <address@hidden>
When loading a VM from a snapshot or migration, clock changes can cause
the periodic timer to stall or loop rapidly.
qemu-timer has a reset notifier mechanism that is used to avoid timer
stalls or loops if the host clock changes while the VM is running when
using QEMU_CLOCK_HOST. However, when loading a snapshot or migration,
qemu-timer is initialized and fires the reset notifier before
mc146818rtc is initialized and has registered its reset handler. In
addition, this mechanism isn't used when using QEMU_CLOCK_REALTIME,
which might also change when loading a snapshot or migration.
To correct that problem, this commit resets the periodic timer after
loading from a snapshot or migration if the clock has either jumped
backward or has jumped forward by more than the clock jump limit that
is used by the reset notifier code in qemu-timer.
Signed-off-by: Paul Donohue <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
---
hw/timer/mc146818rtc.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/hw/timer/mc146818rtc.c b/hw/timer/mc146818rtc.c
index 3204825..2e3ffc8 100644
--- a/hw/timer/mc146818rtc.c
+++ b/hw/timer/mc146818rtc.c
@@ -723,6 +723,12 @@ static int rtc_post_load(void *opaque, int version_id)
check_update_timer(s);
}
+ uint64_t now = qemu_clock_get_ns(rtc_clock);
+ if (now < s->next_periodic_time ||
+ now > (s->next_periodic_time + get_max_clock_jump())) {
+ periodic_timer_update(s, qemu_clock_get_ns(rtc_clock));
+ }
+
#ifdef TARGET_I386
if (version_id >= 2) {
if (s->lost_tick_policy == LOST_TICK_POLICY_SLEW) {
--
2.4.3
- [Qemu-devel] [PULL 04/15] qemu-ga: Introduce Windows MSI script, (continued)
- [Qemu-devel] [PULL 04/15] qemu-ga: Introduce Windows MSI script, Paolo Bonzini, 2015/06/19
- [Qemu-devel] [PULL 02/15] qemu-ga: adding vss-[un]install options, Paolo Bonzini, 2015/06/19
- [Qemu-devel] [PULL 06/15] i8254: fix out-of-bounds memory access in pit_ioport_read(), Paolo Bonzini, 2015/06/19
- [Qemu-devel] [PULL 05/15] qemu-ga: Building Windows MSI installation with configure/Makefile, Paolo Bonzini, 2015/06/19
- [Qemu-devel] [PULL 07/15] tests: Link libqos virtio object to virtio-scsi-test, Paolo Bonzini, 2015/06/19
- [Qemu-devel] [PULL 08/15] libqos: Allow calling guest_free on NULL pointer, Paolo Bonzini, 2015/06/19
- [Qemu-devel] [PULL 09/15] libqos: Complete virtio device ID definition list, Paolo Bonzini, 2015/06/19
- [Qemu-devel] [PULL 10/15] tests: virtio-scsi: Move start/stop to individual test functions, Paolo Bonzini, 2015/06/19
- [Qemu-devel] [PULL 11/15] tests: virtio-scsi: Add test for unaligned WRITE SAME, Paolo Bonzini, 2015/06/19
- [Qemu-devel] [PULL 12/15] qemu-timer: Call clock reset notifiers on forward jumps, Paolo Bonzini, 2015/06/19
- [Qemu-devel] [PULL 13/15] mc146818rtc: Reset the periodic timer on load,
Paolo Bonzini <=
- [Qemu-devel] [PULL 14/15] exec: do not clamp accesses to MMIO regions, Paolo Bonzini, 2015/06/19
- [Qemu-devel] [PULL 15/15] exec: clamp accesses against the MemoryRegionSection, Paolo Bonzini, 2015/06/19
- Re: [Qemu-devel] [PULL 00/15] Timer, virtio-scsi-test, build, memory changes for 2015-06-19, Peter Maydell, 2015/06/19