-
Notifications
You must be signed in to change notification settings - Fork 65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Monotonic timer issues when pausing vCPUs #139
Comments
Guest system need some kind of resume after sleep handling to function properly. For example reset RTC clock to value from NTP server on resume. |
RTC clock always reports correct wall clock & date. However Linux guests (and I imagine some other systems) read RTC only once per boot, and then add monotonic time since boot to it to provide current date instead of repeatedly reading the RTC. I have not yet found a way to notify the guest "hey go read the RTC", nor a device spec which even has such feature. Some other VMs like VirtualBox are implementing guest wall clock winding via guest additions (literally VM-specific drivers & software running in guest). But no generic device with an existing driver to do that. |
I think it is good idea to introduce some "guest control device" that will handle VM-specific tasks. It can for example send interrupt and message when VM is resumed. It can also be used for graceful shutdown handling by VM window close button. |
If we're running additional software in guests then we may use existing software to sync from NTP or RTC device. This is not exactly a new problem (affects QEMU, virt too) and people are using See: https://serverfault.com/questions/334698/how-to-keep-time-on-resumed-kvm-guest-with-libvirt In QEMU om emulation side they internally just allow switching between the two variants of behavior that already are experienced with RVVM ( |
Please implement shutdown handling in Haiku on I'll note that this behavior in general is not implemented in QEMU and such, and the guests are expected to have some power resilience implemented in their FS. I've never had an Linux VM with ext4 corrupt due to abrupt RVVM window closing. |
If |
Is it already implemented on RVVM side? For me it is fine that window close button will act as shutdown button and if it is required to force VM termination (guest frozen etc.), VM process can be killed by some external method (process manager etc.).
Problem is not a FS corruption, but a loss of unsaved data and state. |
I want the second exit button click to kill the VM. However maybe some kind of timeout may be established there. |
Since 0666655, RVVM should behave on Windows hosts in suspend the same way it does on Linux (Monotonic clocksource skips time in suspend). Some other systems may need a similar fix. MacOS |
Fixed clocksource jumps after suspend on MacOS and OpenBSD too. Now all that's left is to pause clocksource when RVVM machine is explicitly paused, etc. |
https://lwn.net/Articles/429925/ might help a bit |
The dilemma
riscv_clocksource
) running when stopping the guest vCPUs results in guest software going mad and believing some kind of hang occured, watchdogs going off, etcdate
reports wall clock from the past). This is caused due to guests using monotonic clock to offset boot date timestamp, instead of querying the RTC reliably. Might break SSL at some point, especially if we consider VM snapshots.CLOCK_MONOTONIC
reports time that the system actually was running, but on Windows,QueryPerformanceCounter
keeps running in suspend leading to pt. 1Steps to reproduce
date
in guest, observe wall clock time being 20 minutes into the pastWorkarounds
Suggested fix (Needs guest assistance)
The text was updated successfully, but these errors were encountered: