From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58799) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YIe6l-0002yS-UN for qemu-devel@nongnu.org; Tue, 03 Feb 2015 09:05:41 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YIe6i-00030w-A3 for qemu-devel@nongnu.org; Tue, 03 Feb 2015 09:05:39 -0500 Received: from mail.ispras.ru ([83.149.199.45]:44629) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YIe6h-00030W-R4 for qemu-devel@nongnu.org; Tue, 03 Feb 2015 09:05:36 -0500 From: "Pavel Dovgaluk" References: <20150122085127.5276.53895.stgit@PASHA-ISP.def.inno> <20150122085238.5276.4455.stgit@PASHA-ISP.def.inno> <54CA095B.8040100@redhat.com> In-Reply-To: <54CA095B.8040100@redhat.com> Date: Tue, 3 Feb 2015 17:05:34 +0300 Message-ID: <000b01d03fba$7ad8cd40$708a67c0$@Dovgaluk@ispras.ru> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Language: ru Subject: Re: [Qemu-devel] [RFC PATCH v8 12/21] replay: recording and replaying different timers List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: 'Paolo Bonzini' , qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, peter.crosthwaite@xilinx.com, alex.bennee@linaro.org, mark.burton@greensocs.com, real@ispras.ru, batuzovk@ispras.ru, maria.klimushenkova@ispras.ru, afaerber@suse.de, fred.konrad@greensocs.com > From: Paolo Bonzini [mailto:pbonzini@redhat.com] > On 22/01/2015 09:52, Pavel Dovgalyuk wrote: > > This patch introduces functions for recording and replaying realtime sources, > > that do not use qemu-clock interface. These include return value of time() > > function in time_t and struct tm forms. Patch also adds warning to > > get_timedate function to prevent its usage in recording mode, because it may > > lead to non-determinism. > > > > Signed-off-by: Pavel Dovgalyuk > > --- > > hw/timer/mc146818rtc.c | 3 + > > hw/timer/pl031.c | 3 + > > include/qemu-common.h | 1 > > replay/replay-internal.h | 4 + > > replay/replay-time.c | 132 ++++++++++++++++++++++++++++++++++++++++++++++ > > replay/replay.h | 8 +++ > > vl.c | 17 +++++- > > 7 files changed, 163 insertions(+), 5 deletions(-) > > > > diff --git a/hw/timer/mc146818rtc.c b/hw/timer/mc146818rtc.c > > index f18d128..92295fb 100644 > > --- a/hw/timer/mc146818rtc.c > > +++ b/hw/timer/mc146818rtc.c > > @@ -28,6 +28,7 @@ > > #include "qapi/visitor.h" > > #include "qapi-event.h" > > #include "qmp-commands.h" > > +#include "replay/replay.h" > > > > #ifdef TARGET_I386 > > #include "hw/i386/apic.h" > > @@ -703,7 +704,7 @@ static void rtc_set_date_from_host(ISADevice *dev) > > RTCState *s = MC146818_RTC(dev); > > struct tm tm; > > > > - qemu_get_timedate(&tm, 0); > > What about just making qemu_get_timedate use > qemu_clock_get_ns(QEMU_CLOCK_HOST) instead of time()? This would just > work using the infrastructure of the previous patch. I can get rid of these calls, but localtime() function used in qemu_get_timedate() will not work deterministically. Should we save its' result then? Pavel Dovgalyuk