From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MiViX-0004We-SD for qemu-devel@nongnu.org; Tue, 01 Sep 2009 11:56:21 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MiViT-0004U7-FD for qemu-devel@nongnu.org; Tue, 01 Sep 2009 11:56:21 -0400 Received: from [199.232.76.173] (port=41465 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MiViT-0004Tt-1f for qemu-devel@nongnu.org; Tue, 01 Sep 2009 11:56:17 -0400 Received: from mx1.redhat.com ([209.132.183.28]:4888) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MiViS-00007t-CR for qemu-devel@nongnu.org; Tue, 01 Sep 2009 11:56:16 -0400 From: Glauber Costa Date: Tue, 1 Sep 2009 12:22:34 -0400 Message-Id: <1251822154-5423-1-git-send-email-glommer@redhat.com> Subject: [Qemu-devel] [PATCH] re-set rtc date on reset handler List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: aliguori@us.ibm.com 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 --- 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