virtio-win / kvm-guest-drivers-windows

Windows paravirtualized drivers for QEMU\KVM
https://www.linux-kvm.org/page/WindowsGuestDrivers
BSD 3-Clause "New" or "Revised" License
1.91k stars 377 forks source link

[virtio-block] Request support for multi-stage resume of Windows to speed up hibernate/resume #1099

Open zkq opened 1 month ago

zkq commented 1 month ago

I have a Windows11 guest booted with QEMU and Virtio-blk device, it hibernates very slow (about several minutes) and the resume phase is single-stage(so resume time is longer). After I change the block device to nvme, it hibernates very fast(about several seconds) and the resume phase is two-stages(resume is very fast).

I don't know why virtio-block does not support the multi-stage resume, we'd better support it to have a much better user experience.

FYI: 1) the multi-stage resume of Windows: https://learn.microsoft.com/en-us/windows-hardware/test/weg/delivering-a-great-startup-and-shutdown-experience#resume-phase 2) To see whether multi-stage resume is enabled, we can go to Windows registry path: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Power, if the NoMultiStageResumeReason item is 0, then multi-stage resume is enabled.

vivianQizhu commented 1 month ago

@zkq Thanks for reporting the issue. Please kindly notice that S3 and S4 is not officially supported by qemu [1], So I am afraid this also won't be virtio-win drivers' priority. [1] https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/9/html/configuring_and_managing_virtualization/assembly_feature-support-and-limitations-in-rhel-9-virtualization_configuring-and-managing-virtualization#unsupported-features-in-rhel-9-virtualization_feature-support-and-limitations-in-rhel-9-virtualization,

vrozenfe commented 1 month ago

@vivianQizhu There are still some users who are running virtio-blk driver on top of different VMMs and even FPGA implemented virtio HBA(s). This feature can be nice to have, in addition to the other stuff like v3 DMA support etc.

Cheers, Vadim.

zkq commented 1 month ago

@vrozenfe Agree. This feature is very valuable, @vivianQizhu please consider to add it into development plan.

vivianQizhu commented 1 month ago

@vrozenfe @zkq Thanks, sure it is nice to have, I mean it won't be on high priority list. Cheers.

zkq commented 1 month ago

@vivianQizhu @vrozenfe

Hi, A good news that I have written some demo code and the vio-block driver supports MultiPhaseResume now. But the boot time is still very slow:

  1. Before MultiPhaseResume is supported, the first resume phase (executed by single vCPU) consumes about 10 seconds, then it enters windows desktop quickly.
  2. After MultiPhaseResume is supported, the first resume phase (executed by single vCPU) consumes less about 1 second, then the second resume phase (executed by all vCPUs) still consumes much time. This is abnormal.

And another issue of vio-block driver is about hibernate. When I start hibernate, all vCPUs run 100% for 1~2 minutes before windows writes hibernate file into disk. As I can see with NVME virtual device, the hibernate and resume process both are very fast. I guess the issue of vio-block for hibernate and resume are same as the problem looks similar.

Do you have any idea how to solve these issues?