Hypervisor detector for Windows

Baesken, Matthias matthias.baesken at sap.com
Mon Jul 27 06:59:49 UTC 2020

Hi  Yasumasa , I'll  put  your  patch  into our build/test  queue  and check the outcome.

And thanks for filing the JBS issue too .
Regarding ...

> Does not support x86 (32bit) platform

Yes , I think 32bit is not very important any more in current OpenJDK .
But if your patch addresses it too , then  it's not a bad thing for sure !

Best regards, Matthias

-----Original Message-----
From: Yasumasa Suenaga <suenaga at oss.nttdata.com> 
Sent: Samstag, 25. Juli 2020 17:02
To: David Holmes <david.holmes at oracle.com>; hotspot-runtime-dev at openjdk.java.net; Baesken, Matthias <matthias.baesken at sap.com>
Subject: Re: Hypervisor detector for Windows

Thanks David!

On 2020/07/25 21:13, David Holmes wrote:
> Hi Yasumasa,
> My recollection from reviewing this was that it was all based on vendor strings. Best to ask Matthias (cc'd) if you need more details.

I think we can fix like following webrev. It works fine on Windows 10 (host), Windows 10 (guest) on Hyper-V, and Fedora 32 on Hyper-V.
Matthias, what do you think? If this webrev seems good, I will file it to JBS and will send review request.




> Cheers,
> David
> On 25/07/2020 3:51 pm, Yasumasa Suenaga wrote:
>> Hi all,
>> When I got hs_err log on Windows, I saw "HyperV virtualization detected" in it in spite of running on host OS.
>> I tried to file it to JBS and to fix it, but I have some questions for this.
>> (This feature has been introduced in JDK-8219241)
>>    - According to [1] (it is mentioned in the source code), we need to check bit 31 in ECX when CPUID is called with EAX = 1h. Why it would not do so?
>>    - Why would VM_Version::check_virtualizations() call CPUID with 40000000h to 4000FF00h? 40000000h should be used if we want to get vendor ID.
>>    - Why VM_Version::check_virt_cpuid() is separated for GNU C (GAS) and MacroAssembler? I guess we can use MacroAssembler for x86 / x86_64.
>>    - In case of Hyper-V, host OS is treated as root partition [2], so we cannot use this CPUID solution for Hyper-V. I guess we need to check it with other solutions like [3].
>> Thanks,
>> Yasumasa
>> [1] https://kb.vmware.com/s/article/1009458
>> [2] https://docs.microsoft.com/virtualization/hyper-v-on-windows/reference/hyper-v-architecture
>> [3] https://stackoverflow.com/questions/10544498/detect-the-virtualization-layer-from-a-guest-instancevm-vpc-or-hyper-v-in-c

More information about the hotspot-runtime-dev mailing list