[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: QEMU Clock record and replay

From: Arnabjyoti Kalita
Subject: Re: QEMU Clock record and replay
Date: Fri, 26 Feb 2021 09:05:45 +0530

Thank you Alex for such a detailed answer. It explains a lot of aspects about the QEMU timer and icount features.

Let's say we start a guest in KVM mode, save its state and then allow the guest to continue. Now, let's say we load the 'saved' guest in TCG mode. I am looking for a way to ensure that the timer activity is synchronized with the KVM mode, when I load the guest in TCG mode. Will this be possible to achieve ?

Thank you very much again.

Best Regards,

On Thu, Feb 25, 2021 at 10:30 PM Alex Bennée <alex.bennee@linaro.org> wrote:

Arnabjyoti Kalita <akalita@cs.stonybrook.edu> writes:

> Hello all,
> I am trying to understand how the clock values are recorded and replayed in
> QEMU (when it runs in TCG mode). I have been specifically following the
> document that has been provided here -
> https://github.com/qemu/qemu/blob/master/docs/replay.txt
> I have the following 4 questions to ask-
> - Why are clock values being replayed off a cache and not directly off the
> file as seen here -
> https://github.com/qemu/qemu/blob/stable-5.0/replay/replay-time.c#L45?
> - I have a requirement to record and replay host clock values. Can it so
> happen that if incorrect values of the host clock are replayed, then the
> timers in the guest start expiring incorrectly, during replay?

Host clock values would be meaningless in the context of record/replay.
"time" is simply a function of the number of instruction executed. As
all asynchronous events (e.g. HW timers expiring) are a function of this
executed instruction count you get determinism as no external events
influence the behaviour of the run. This is then paired with recording
other hardware events like blocks and packets against this time to get
your full record/replay experience.

The underlying icount is explained in a bit more detail at:


> - Let's say we record the clock values when the guest starts in KVM mode,
> and we replay the clock values when the guest starts in TCG mode. Does the
> record-replay functionality change a lot?
> - Also, I couldn't understand the specific purpose of replaying the
> 'virtual real time clock' ? Do I still need to record and replay the
> 'virtual real time clock' if we record the clock values in KVM mode, and
> replay the clock values in TCG mode?

It won't work. You can only ever record when running in TCG icount mode
because having that stable and deterministic behaviour is a

Alex Bennée

reply via email to

[Prev in Thread] Current Thread [Next in Thread]