qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH] re-set rtc date on reset handler


From: Glauber Costa
Subject: [Qemu-devel] [PATCH] re-set rtc date on reset handler
Date: Tue, 1 Sep 2009 12:22:34 -0400

guests without a stable timesource such as kvm-clock will grab the wallclock
from our rtc chip. However, we only sync the date when we first launch qemu.
If a guest goes through a series of reboot cycles, it will slowly see time
getting far behind the host.

The proposal of this patch is to set the date to host clock again in the reset
handler. With this patch, I see a Fedora guest keeping its clock in sync upon
an ulimited number of reboots.

Signed-off-by: Glauber Costa <address@hidden>
---
 hw/mc146818rtc.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/hw/mc146818rtc.c b/hw/mc146818rtc.c
index 5c8676e..e71a9da 100644
--- a/hw/mc146818rtc.c
+++ b/hw/mc146818rtc.c
@@ -586,6 +586,8 @@ static void rtc_reset(void *opaque)
     if (rtc_td_hack)
            s->irq_coalesced = 0;
 #endif
+
+    rtc_set_date_from_host(s);
 }
 
 RTCState *rtc_init_sqw(int base, qemu_irq irq, qemu_irq sqw_irq, int base_year)
-- 
1.6.2.2





reply via email to

[Prev in Thread] Current Thread [Next in Thread]