From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Ml26a-0005xU-H0 for qemu-devel@nongnu.org; Tue, 08 Sep 2009 10:55:36 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Ml26V-0005v6-CT for qemu-devel@nongnu.org; Tue, 08 Sep 2009 10:55:35 -0400 Received: from [199.232.76.173] (port=34899 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ml26V-0005ux-5k for qemu-devel@nongnu.org; Tue, 08 Sep 2009 10:55:31 -0400 Received: from mx1.redhat.com ([209.132.183.28]:54858) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Ml26U-0001TY-LM for qemu-devel@nongnu.org; Tue, 08 Sep 2009 10:55:30 -0400 Message-ID: <4AA67060.8030804@redhat.com> Date: Tue, 08 Sep 2009 17:55:28 +0300 From: Dor Laor MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH] re-set rtc date on reset handler References: <1251822154-5423-1-git-send-email-glommer@redhat.com> <5d6222a80909011600l264f1f3cpb0b8d503dac9a26a@mail.gmail.com> In-Reply-To: <5d6222a80909011600l264f1f3cpb0b8d503dac9a26a@mail.gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Reply-To: dlaor@redhat.com List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Glauber Costa Cc: Blue Swirl , Glauber Costa , aliguori@us.ibm.com, qemu-devel@nongnu.org On 09/02/2009 02:00 AM, Glauber Costa wrote: > On Tue, Sep 1, 2009 at 1:56 PM, Blue Swirl wrote: >> On Tue, Sep 1, 2009 at 7:22 PM, Glauber Costa wrote: >>> 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. >> >> A different approach is used in m48t59.c: the guest clock is generated >> directly from host clock without any timers and only a fixed offset > You mean at every ioport read? I actually thought about that, but was > too lazy... > > You also need to handle the -startdate flag of qemu. In this case you need to keep the offset and not read the host time.