From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56457) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z5DuR-0006T3-DR for qemu-devel@nongnu.org; Wed, 17 Jun 2015 10:01:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z5DuM-0008CF-2g for qemu-devel@nongnu.org; Wed, 17 Jun 2015 10:01:43 -0400 Received: from mx1.redhat.com ([209.132.183.28]:45329) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z5DuL-0008C9-Dl for qemu-devel@nongnu.org; Wed, 17 Jun 2015 10:01:38 -0400 Message-ID: <55817DBD.1050502@redhat.com> Date: Wed, 17 Jun 2015 16:01:33 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <20150612141013.GE2749@TopQuark.net> In-Reply-To: <20150612141013.GE2749@TopQuark.net> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 2/2] mc146818rtc: Reset the periodic timer on load List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paul Donohue , qemu-devel@nongnu.org On 12/06/2015 16:10, Paul Donohue wrote: > 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 > --- > hw/timer/mc146818rtc.c | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/hw/timer/mc146818rtc.c b/hw/timer/mc146818rtc.c > index f2b77fa..68cf1f0 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 - get_ticks_per_sec()) || What is the reason for the "- get_ticks_per_sec()" adjustment? Can I just remove it? Paolo > + now > (s->next_periodic_time + get_max_clock_jump())) {