public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* HvExtCallQueryCapabilities and HvExtCallGetBootZeroedMemory implementation in KVM for Windows guest
@ 2022-10-04 22:15 Vipin Sharma
  2022-10-06  8:49 ` Vitaly Kuznetsov
  0 siblings, 1 reply; 3+ messages in thread
From: Vipin Sharma @ 2022-10-04 22:15 UTC (permalink / raw)
  To: Vitaly Kuznetsov, yury.norov@gmail.com, sunilmut, tianyu.lan
  Cc: KVM, David Matlack, Shujun Xue

Hi Vitaly, Yury, Sunil, Tianyu

Before I work on a patch series and send it out to the KVM mailing
list, I wanted to check with you a potential Windows VM optimization
and see if you have worked on it or if you know about some obvious
known blockers regarding this feature.

Hypervisor Top-Level Functional Specification v6.0b mentions a hypercall:

    HvExtCallGetBootZeroedMemory
    Call Code = 0x8002

This hypercall can be used by Windows guest to know which pages are
already zeroed and then guest can avoid zeroing them again during the
boot, resulting in Windows VM faster boot time and less memory usage.

KVM currently doesn't implement this feature. I am thinking of
implementing it, here is a rough code flow:
1. KVM will set bit 20 in EBX of CPUID leaf 0x40000003 to let the
Windows guest know that it can use the extended hypercall interface.
2. Guest during the boot will use hypercall HvExtCallQueryCapabilities
(Call Code = 0x8001) to see which extended calls are available.
3. KVM will respond to guest that the hypercall
HvExtCallGetBootZeroedMemory is available.
4. Guest will issue the hypercall HvExtCallGetBootZeroedMemory to know
which pages are zeroed.
5. KVM or userspace VMM will respond with GPA and page count to guest.
6. Guest will skip zeroing these pages, resulting in faster boot and
less memory utilization of guest.

This seems like a very easy win for KVM to increase Windows guest boot
performance but I am not sure if I am overlooking something. If you
are aware of any potential side effects of enabling these hypercalls
or some other issue I am not thinking about please let me know,
otherwise, I can start working on this feature and send RFC patches to
the mailing list.

Thanks
Vipin

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

end of thread, other threads:[~2022-10-06 17:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-04 22:15 HvExtCallQueryCapabilities and HvExtCallGetBootZeroedMemory implementation in KVM for Windows guest Vipin Sharma
2022-10-06  8:49 ` Vitaly Kuznetsov
2022-10-06 17:26   ` Vipin Sharma

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox