From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51792) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xta1n-0006IH-5n for qemu-devel@nongnu.org; Wed, 26 Nov 2014 05:41:01 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Xta1g-0000en-7E for qemu-devel@nongnu.org; Wed, 26 Nov 2014 05:40:54 -0500 Received: from mail.ispras.ru ([83.149.199.45]:35006) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xta1f-0000eP-8J for qemu-devel@nongnu.org; Wed, 26 Nov 2014 05:40:47 -0500 From: Pavel Dovgalyuk Date: Wed, 26 Nov 2014 13:40:50 +0300 Message-ID: <20141126104049.7772.3594.stgit@PASHA-ISP> In-Reply-To: <20141126103841.7772.11864.stgit@PASHA-ISP> References: <20141126103841.7772.11864.stgit@PASHA-ISP> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Subject: [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: 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, pavel.dovgaluk@ispras.ru, pbonzini@redhat.com, afaerber@suse.de, fred.konrad@greensocs.com 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. */ typedef enum { QEMU_CLOCK_REALTIME = 0, QEMU_CLOCK_VIRTUAL = 1, QEMU_CLOCK_HOST = 2, + QEMU_CLOCK_VIRTUAL_RT = 3, QEMU_CLOCK_MAX } QEMUClockType; diff --git a/qemu-timer.c b/qemu-timer.c index 8307913..3f99af5 100644 --- a/qemu-timer.c +++ b/qemu-timer.c @@ -567,6 +567,8 @@ int64_t qemu_clock_get_ns(QEMUClockType type) notifier_list_notify(&clock->reset_notifiers, &now); } return now; + case QEMU_CLOCK_VIRTUAL_RT: + return REPLAY_CLOCK(REPLAY_CLOCK_VIRTUAL_RT, get_clock()); } } diff --git a/replay/replay.h b/replay/replay.h index 143fe85..0c02e03 100755 --- a/replay/replay.h +++ b/replay/replay.h @@ -22,8 +22,10 @@ #define REPLAY_CLOCK_REAL_TICKS 0 /* host_clock */ #define REPLAY_CLOCK_HOST 1 +/* virtual_rt_clock */ +#define REPLAY_CLOCK_VIRTUAL_RT 2 -#define REPLAY_CLOCK_COUNT 2 +#define REPLAY_CLOCK_COUNT 3 extern ReplayMode replay_mode; extern char *replay_image_suffix;