Hypervisor detector for Windows

David Holmes david.holmes at oracle.com
Mon Jul 27 01:50:28 UTC 2020


On 26/07/2020 1:01 am, Yasumasa Suenaga wrote:
> 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.
> 
>    http://cr.openjdk.java.net/~ysuenaga/hv-detection/

By all means file a JBS issue but I can't comment on the correctness of 
the fix.

Cheers,
David

> 
> Thanks,
> 
> Yasumasa
> 
> 
>> 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