qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/2] control guest time using a dilation factor
@ 2025-06-28  0:24 Pierrick Bouvier
  2025-06-28  0:24 ` [PATCH v2 1/2] qemu/timer: introduce time " Pierrick Bouvier
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Pierrick Bouvier @ 2025-06-28  0:24 UTC (permalink / raw)
  To: qemu-devel
  Cc: berrange, richard.henderson, Paolo Bonzini, Alex Bennée,
	Thomas Huth, peter.maydell, philmd, Pierrick Bouvier

Depending on host cpu speed, and QEMU optimization level, it may sometimes be
needed to slow or accelerate time guest is perceiving. A common scenario is
hitting a timeout during a boot process, because some operations were not
finished on time.

An existing solution for that is -icount shift=X, with low values, which will
roughly map virtual time to how many instructions were executed.

This series introduces another approach, based on faking host time returned to
the guest, by applying a time-dilation factor. Time will go slower/faster for
the guest, without impacting QEMU emulation speed.

It may eventually be used to fix some of the timeouts we hit in CI, by slowing
down time in VM, to be less sensitive to varying cpu performance.

v2
--

In review, Paolo mentioned timers deadline should redilated in the other
direction. After going through this part, it seems that arrival is always based
on one of the clocks we have (which is dilated already), so I don't think we
should redilate that, as this would create a discordance between time set, and
real time when this happen. Feel free to correct me if this is wrong.

- keep start time per clock and apply accordingly
- apply time dilation for cpu_get_host_ticks as well
- use a default factor of 1.0
- rename cli option to -rtc speed-factor
- forbid to use option with kvm, as time is not provided by QEMU for guest

Pierrick Bouvier (2):
  qemu/timer: introduce time dilation factor
  system/rtc: introduce -rtc speed-factor option

 include/qemu/timer.h     | 60 ++++++++++++++++++++++++++++------------
 system/rtc.c             | 11 ++++++++
 system/vl.c              |  9 ++++++
 util/qemu-timer-common.c |  7 +++++
 qemu-options.hx          |  7 ++++-
 5 files changed, 75 insertions(+), 19 deletions(-)

-- 
2.47.2



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2025-08-04 18:26 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-28  0:24 [PATCH v2 0/2] control guest time using a dilation factor Pierrick Bouvier
2025-06-28  0:24 ` [PATCH v2 1/2] qemu/timer: introduce time " Pierrick Bouvier
2025-06-28  0:24 ` [PATCH v2 2/2] system/rtc: introduce -rtc speed-factor option Pierrick Bouvier
2025-07-08 17:43 ` [PATCH v2 0/2] control guest time using a dilation factor Pierrick Bouvier
2025-07-21 16:42 ` Pierrick Bouvier
2025-08-04 16:19 ` Pierrick Bouvier

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).