Received: from eggs.gnu.org ([2001:4830:134:3::10]:54190) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XuJj0-0007IP-Fy for qemu-devel@nongnu.org; Fri, 28 Nov 2014 06:28:40 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XuJiu-0007uJ-D0 for qemu-devel@nongnu.org; Fri, 28 Nov 2014 06:28:34 -0500 Received: from mail.ispras.ru ([83.149.199.45]:55454) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XuJiu-0007u9-6Y for qemu-devel@nongnu.org; Fri, 28 Nov 2014 06:28:28 -0500 From: "Pavel Dovgaluk" References: <20141126103841.7772.11864.stgit@PASHA-ISP> <20141126104049.7772.3594.stgit@PASHA-ISP> <5475B3AB.1040402@redhat.com> In-Reply-To: <5475B3AB.1040402@redhat.com> Date: Fri, 28 Nov 2014 14:28:32 +0300 Message-ID: <002b01d00afe$71142160$533c6420$@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 v5 22/31] timer: introduce new QEMU_CLOCK_VIRTUAL_RT clock 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 26/11/2014 11:40, Pavel Dovgalyuk wrote: > > This patch introduces new QEMU_CLOCK_VIRTUAL_RT clock, which > > should be used for icount warping. Separate timer is needed > > for replaying the execution, because warping callbacks should > > be deterministic. We cannot make realtime clock deterministic > > because it is used for screen updates and other simulator-specific > > actions. That is why we added new clock which is recorded and > > replayed when needed. > > > > Signed-off-by: Pavel Dovgalyuk > > --- > > include/qemu/timer.h | 7 +++++++ > > qemu-timer.c | 2 ++ > > replay/replay.h | 4 +++- > > 3 files changed, 12 insertions(+), 1 deletions(-) > > > > diff --git a/include/qemu/timer.h b/include/qemu/timer.h > > index 7b43331..df27157 100644 > > --- a/include/qemu/timer.h > > +++ b/include/qemu/timer.h > > @@ -37,12 +37,19 @@ > > * is suspended, and it will reflect system time changes the host may > > * undergo (e.g. due to NTP). The host clock has the same precision as > > * the virtual clock. > > + * > > + * @QEMU_CLOCK_VIRTUAL_RT: realtime clock used for icount warp > > + * > > + * This clock runs as a realtime clock, but is used for icount warp > > + * and thus should be traced with record/replay to make warp function > > + * behave deterministically. > > */ > > I think it should also stop/restart across "stop" and "cont" commands, > similar to QEMU_CLOCK_VIRTUAL. This is as simple as changing > get_clock() to cpu_get_clock(). Not so easy :) cpu_get_clock() checks vm_clock_seqlock which is locked in icount_warp_rt(). And after locking it requests the value of QEMU_CLOCK_VIRTUAL_RT: seqlock_write_lock(&timers_state.vm_clock_seqlock); if (runstate_is_running()) { int64_t clock = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL_RT); Pavel Dovgalyuk