[hyperv] hvinfo: command line tool to get the HyperV enlightements status from within the guest

Hi all, lately I've been involved again in hyperv support. I was tasked to help improve the testability of the hyperv guest configuration. Hyperv support is a set of optimizations that libvirt/qemu offer to improve the runtime behaviour (stability, performance) of Windows guets. See for example: https://libvirt.org/formatdomain.html#elementsFeatures oVirt does support them (see for example https://github.com/oVirt/vdsm/blob/master/lib/vdsm/virt/libvirtxml.py#L243) and will keep supporting them because they are a key feature for windows guests. Up until now the easiest (only?) way to check if a hyperv optmization was really enabled was to inspect the libvirt XML and/or the QEMU command line flags But we wanted to have another check. Enter hvinfo: https://github.com/fromanirh/hvinfo hvinfo is a simple tool that decodes CPUID informations according to the publicly-available HyperV specs (https://github.com/MicrosoftDocs/Virtualization-Documentation/tree/live/tlfs) and report what the guest sees. It takes no arguments - just run it!-, it requires no special privileges and emits easy to consume JSON. It is designed to help and integrate into fully automated CI/QA. Being a commandline tool, is hard to give a "screenshot", so let me just report sample output (admin privileges not actually required) Windows PowerShell Copyright (C) Microsoft Corporation. All rights reserved. PS C:\Users\admin> cd .\Downloads\ PS C:\Users\admin\Downloads> .\hvinfo.exe { "HyperVsupport": true, "Features": { "GuestDebugging": false, "PerformanceMonitor": false, "PCPUDynamicPartitioningEvents": true, "HypercallInputParamsXMM": false, "VirtualGuestIdleState": false, "HypervisorSleepState": false, "NUMADistanceQuery": false, "TimerFrequenciesQuery": false, "SytheticMCEInjection": false, "GuestCrashMSR": false, "DebugMSR": false, "NPIEP": false, "DisableHypervisorAvailable": false, "ExtendedGvaRangesForFlushVirtualAddressList": false, "HypercallOutputReturnXMM": false, "SintPollingMode": false, "HypercallMsrLock": false, "UseDirectSyntheticTimers": false }, "Recommendations": { "HypercallAddressSpaceSwitch": false, "HypercallLocalTLBFlush": false, "HypercallRemoteTLBFlush": false, "MSRAPICRegisters": true, "MSRSystemReset": false, "RelaxedTiming": true, "DMARemapping": false, "InterruptRemapping": false, "X2APICMSR": false, "DeprecatingAutoEOI": false, "SyntheticClusterIPI": false, "ExProcessorMasks": false, "Nested": false, "INTForMBECSyscalls": false, "NestedEVMCS": false, "SyncedTimeline": false, "DirectLocalFlushEntire": false, "NoNonArchitecturalCoreSharing": false, "SpinlockRetries": 8191 } } PS C:\Users\admin\Downloads> Caveat: the name of the features are the same of the spec, so we need mappings for oVirt flags, libvirt flags and so on. For example libvirt xml domain.features.hyperv.relaxed[state="on"] maps to hvinfo json Features.Recommendations.RelaxedTiming=true Feel free to test it and report any issue Bests, -- Francesco Romani Senior SW Eng., Virtualization R&D Red Hat IRC: fromani github: @fromanirh

I wonder if it makes sense to add this to qemu/ga, actually? It takes time, but ultimately it’s the one common tool for guest side stuff. At least worth asking if there is any interest, I guess Thanks, michal
On 12 Mar 2019, at 13:30, Francesco Romani <fromani@redhat.com> wrote:
Hi all,
lately I've been involved again in hyperv support. I was tasked to help improve the testability of the hyperv guest configuration.
Hyperv support is a set of optimizations that libvirt/qemu offer to improve the runtime behaviour (stability, performance) of Windows guets.
See for example: https://libvirt.org/formatdomain.html#elementsFeatures
oVirt does support them (see for example https://github.com/oVirt/vdsm/blob/master/lib/vdsm/virt/libvirtxml.py#L243) and will keep supporting them
because they are a key feature for windows guests.
Up until now the easiest (only?) way to check if a hyperv optmization was really enabled was to inspect the libvirt XML and/or the QEMU command line flags
But we wanted to have another check.
Enter hvinfo: https://github.com/fromanirh/hvinfo
hvinfo is a simple tool that decodes CPUID informations according to the publicly-available HyperV specs (https://github.com/MicrosoftDocs/Virtualization-Documentation/tree/live/tlfs) and report what the guest sees.
It takes no arguments - just run it!-, it requires no special privileges and emits easy to consume JSON. It is designed to help and integrate into fully automated CI/QA.
Being a commandline tool, is hard to give a "screenshot", so let me just report sample output (admin privileges not actually required)
Windows PowerShell Copyright (C) Microsoft Corporation. All rights reserved.
PS C:\Users\admin> cd .\Downloads\ PS C:\Users\admin\Downloads> .\hvinfo.exe { "HyperVsupport": true, "Features": { "GuestDebugging": false, "PerformanceMonitor": false, "PCPUDynamicPartitioningEvents": true, "HypercallInputParamsXMM": false, "VirtualGuestIdleState": false, "HypervisorSleepState": false, "NUMADistanceQuery": false, "TimerFrequenciesQuery": false, "SytheticMCEInjection": false, "GuestCrashMSR": false, "DebugMSR": false, "NPIEP": false, "DisableHypervisorAvailable": false, "ExtendedGvaRangesForFlushVirtualAddressList": false, "HypercallOutputReturnXMM": false, "SintPollingMode": false, "HypercallMsrLock": false, "UseDirectSyntheticTimers": false }, "Recommendations": { "HypercallAddressSpaceSwitch": false, "HypercallLocalTLBFlush": false, "HypercallRemoteTLBFlush": false, "MSRAPICRegisters": true, "MSRSystemReset": false, "RelaxedTiming": true, "DMARemapping": false, "InterruptRemapping": false, "X2APICMSR": false, "DeprecatingAutoEOI": false, "SyntheticClusterIPI": false, "ExProcessorMasks": false, "Nested": false, "INTForMBECSyscalls": false, "NestedEVMCS": false, "SyncedTimeline": false, "DirectLocalFlushEntire": false, "NoNonArchitecturalCoreSharing": false, "SpinlockRetries": 8191 } } PS C:\Users\admin\Downloads>
Caveat: the name of the features are the same of the spec, so we need mappings for oVirt flags, libvirt flags and so on.
For example
libvirt xml
domain.features.hyperv.relaxed[state="on"]
maps to hvinfo json
Features.Recommendations.RelaxedTiming=true
Feel free to test it and report any issue
Bests,
-- Francesco Romani Senior SW Eng., Virtualization R&D Red Hat IRC: fromani github: @fromanirh _______________________________________________ Devel mailing list -- devel@ovirt.org To unsubscribe send an email to devel-leave@ovirt.org Privacy Statement: https://www.ovirt.org/site/privacy-policy/ oVirt Code of Conduct: https://www.ovirt.org/community/about/community-guidelines/ List Archives: https://lists.ovirt.org/archives/list/devel@ovirt.org/message/Z6OSC4RLC3TXIN...
participants (2)
-
Francesco Romani
-
Michal Skrivanek