From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40931) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xxt9n-0007fu-Ip for qemu-devel@nongnu.org; Mon, 08 Dec 2014 02:55:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Xxt9h-0000x7-Gj for qemu-devel@nongnu.org; Mon, 08 Dec 2014 02:54:59 -0500 Received: from mail.ispras.ru ([83.149.199.45]:58364) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xxt9h-0000ww-A7 for qemu-devel@nongnu.org; Mon, 08 Dec 2014 02:54:53 -0500 From: Pavel Dovgalyuk Date: Mon, 08 Dec 2014 10:54:52 +0300 Message-ID: <20141208075452.7108.92608.stgit@PASHA-ISP> In-Reply-To: <20141208075255.7108.19079.stgit@PASHA-ISP> References: <20141208075255.7108.19079.stgit@PASHA-ISP> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] [RFC PATCH v6 20/32] 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 ++ 2 files changed, 9 insertions(+), 0 deletions(-) diff --git a/include/qemu/timer.h b/include/qemu/timer.h index 3dae414..5948c88 100644 --- a/include/qemu/timer.h +++ b/include/qemu/timer.h @@ -36,12 +36,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 00a5d35..f4b4b6a 100644 --- a/qemu-timer.c +++ b/qemu-timer.c @@ -566,6 +566,8 @@ int64_t qemu_clock_get_ns(QEMUClockType type) notifier_list_notify(&clock->reset_notifiers, &now); } return now; + case QEMU_CLOCK_VIRTUAL_RT: + return cpu_get_clock(); } }