Increasing the speed of qemu clock
Asked Answered
P

3

6

I'm trying to increase the speed at which qemu runs, so for example one tick of the real CPU will correspond to two ticks of the virtual time of qemu. Is this possible and if so does anyone have any pointers on how to go about doing this?

Parodic answered 24/7, 2014 at 14:45 Comment(0)
S
6

You can't do this. QEMU is not made for such thing.

QEMU does not simulate timing of execution. It doesn't know anything about CPU caches etc., so it can't be accurate even if it is desirable. It simply executes guest code, as fast as it can. No acceleration or deceleration.

At least do not seek solution this way.

Sun answered 21/1, 2015 at 15:46 Comment(2)
It's possible to increase QEMU clock at least in full system emulation mode (using CPU emulation). See "-icount" option. I'm looking for the same thing as OP, but for KVM-enabled emulation, and still no success.Yankeeism
Are you sure it does so as fast as it can? I have a VM in Qemu and when it boots up it says the CPU frequency is 10 MHz.Lied
B
3

There are qemu options which can alter the advance of time as seen by the guest.

The args I used (with qemu v4.2.0) are:

qemu-system-x86_64 -rtc base=localtime,clock=vm -icount shift=7,align=off,sleep=off ...

Note that icount is not compatible with hardware acceleration. Also note that a shift value too high may cause the guest OS to misbehave. For example, when I tried a value of 10, the linux kernel kept complaining of tasks stalled >120s.

Of possible interest: comments on https://github.com/zephyrproject-rtos/zephyr/issues/14173 and the linked issues/PRs.

Bilection answered 18/6, 2020 at 0:12 Comment(0)
P
2

Maybe you should give a look at tickpolicy options from libvirt https://docs.fedoraproject.org/en-US/Fedora_Draft_Documentation/0.1/html/Virtualization_Deployment_and_Administration_Guide/sect-Virtualization-Tips_and_tricks-Libvirt_Managed_Timers.html.

It's able to 'catchup' host time. The effect is that the guest seems accelerated.

The option is translated from libvirt to qemu as -rtc ,driftfix=slew

Note that it won't change how fast code will be executed.

Padraig answered 3/8, 2018 at 13:50 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.