[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [RFC PATCH v5 22/31] timer: introduce new QEMU_CLOCK_VI
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] [RFC PATCH v5 22/31] timer: introduce new QEMU_CLOCK_VIRTUAL_RT clock |
Date: |
Wed, 26 Nov 2014 12:04:11 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 |
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 <address@hidden>
> ---
> 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().
This way, QEMU_CLOCK_VIRTUAL_RT is "what QEMU_CLOCK_VIRTUAL does without
-icount". This makes a lot of sense and can be merged in 2.3
independent of the rest of the series.
Paolo
> 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;
>
- [Qemu-devel] [RFC PATCH v5 16/31] cpu-exec: invalidate nocache translation if they are interrupted, (continued)
- [Qemu-devel] [RFC PATCH v5 16/31] cpu-exec: invalidate nocache translation if they are interrupted, Pavel Dovgalyuk, 2014/11/26
- [Qemu-devel] [RFC PATCH v5 17/31] replay: interrupts and exceptions, Pavel Dovgalyuk, 2014/11/26
- [Qemu-devel] [RFC PATCH v5 18/31] replay: asynchronous events infrastructure, Pavel Dovgalyuk, 2014/11/26
- [Qemu-devel] [RFC PATCH v5 19/31] cpu: replay instructions sequence, Pavel Dovgalyuk, 2014/11/26
- [Qemu-devel] [RFC PATCH v5 20/31] replay: recording and replaying clock ticks, Pavel Dovgalyuk, 2014/11/26
- [Qemu-devel] [RFC PATCH v5 21/31] replay: recording and replaying different timers, Pavel Dovgalyuk, 2014/11/26
- [Qemu-devel] [RFC PATCH v5 22/31] timer: introduce new QEMU_CLOCK_VIRTUAL_RT clock, Pavel Dovgalyuk, 2014/11/26
- Re: [Qemu-devel] [RFC PATCH v5 22/31] timer: introduce new QEMU_CLOCK_VIRTUAL_RT clock,
Paolo Bonzini <=
- Re: [Qemu-devel] [RFC PATCH v5 22/31] timer: introduce new QEMU_CLOCK_VIRTUAL_RT clock, Pavel Dovgaluk, 2014/11/28
- Re: [Qemu-devel] [RFC PATCH v5 22/31] timer: introduce new QEMU_CLOCK_VIRTUAL_RT clock, Paolo Bonzini, 2014/11/28
[Qemu-devel] [RFC PATCH v5 23/31] cpus: make icount warp deterministic in replay mode, Pavel Dovgalyuk, 2014/11/26
[Qemu-devel] [RFC PATCH v5 24/31] replay: shutdown event, Pavel Dovgalyuk, 2014/11/26
[Qemu-devel] [RFC PATCH v5 25/31] replay: checkpoints, Pavel Dovgalyuk, 2014/11/26