Re: Question regarding VMCS launch state

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 09.04.2018 09:26, Jidong Xiao wrote:
> On Mon, Apr 9, 2018 at 1:21 AM, David Hildenbrand <david@xxxxxxxxxx> wrote:
>> On 09.04.2018 09:17, Jidong Xiao wrote:
>>> On Mon, Apr 9, 2018 at 1:10 AM, David Hildenbrand <david@xxxxxxxxxx> wrote:
>>>> On 09.04.2018 06:21, Jidong Xiao wrote:
>>>>> Hi,
>>>>>
>>>>> The Intel SDM says:
>>>>>
>>>>> "The launch state of a VMCS determines which VM-entry instruction
>>>>> should be used with that VMCS: the
>>>>> VMLAUNCH instruction requires a VMCS whose launch state is “clear”;
>>>>> the VMRESUME instruction requires a VMCS
>>>>> whose launch state is “launched”. A logical processor maintains a
>>>>> VMCS’s launch state in the corresponding VMCS
>>>>> region."
>>>>>
>>>>> "There are no other ways to modify the launch state of a VMCS (it
>>>>> cannot be modified using VMWRITE) and there
>>>>> is no direct way to discover it (it cannot be read using VMREAD).'
>>>>>
>>>>> According to the above description, the launch state is stored in the
>>>>> VMCS region, but it seems the SDM doesn't say where exactly the launch
>>>>> state is stored in the VMCS. For example, the VMCS data is organized
>>>>> into six logic groups: Guest-state area, Host-state area, VM-execution
>>>>> control fields, VM-exit control fields, VM-entry control fields,
>>>>> VM-exit information fields. However, I can't find the "launch state"
>>>>> in any of these fields.
>>>>>
>>>>> If it's in the VMCS region, then why can't I find it? and why it can't
>>>>> be discovered by VMREAD?
>>>>
>>>> Why do you assume the launch state has to be stored inside the VMCS region?
>>>>
>>>> It is just being stated that you cannot detect/modify it via
>>>> VMWRITE/VMREAD. Which is perfectly true if the launch state is stored
>>>> outside of the VMCS region.
>>>>
>>>> What the SDM states here simply is that the caller has to remember if a
>>>> VMCS has already been launched. This is what we do with the "launched"
>>>> variable.
>>>>
>>>> And this is also what we use for emulation of VMLAUNCH/VMRESUME in
>>>> nested_vmx_run().
>>>>
>>>>>
>>>>> I saw in the kvm source code a variable called launched is defined,
>>>>> which enables kvm to trace the launch state of the VMCS, but is this
>>>>> launch state really existing in the VMCS region? If so, where exactly
>>>>> is it?
>>>>
>>>> Nope, not in the region, it's glued to struct loaded_vmcs.
>>>>
>>> Oh, okay, thanks David, I see. The reason I assumed it's in the VMCS
>>> region is because the SDM says:
>>>
>>> "A logical processor maintains a VMCS’s launch state in the
>>> corresponding VMCS region."
>>>
>>> Since it's not really in the region, I guess the SDM is inaccurate on this.
>>
>> Guess as the guest has to way to access it via VMREAD/VMWRITE it doesn't
>> make any difference, or do you have something in mind?
>>
> Oh, because the SDM clearly says it's in the region, but then it
> doesn't say where exactly it is in the region; so I was just confused.
> But now I understand. Thanks David!

I can only guess that it is mentioned that it is part of the region,
because real HW has to store that information somewhere. This is in
contrast to virtualization, where we can just save that information
"anywhere" else in memory.

At least that's my thought about it :) Glad I was able to answer your
question!

Cheers!

-- 

Thanks,

David / dhildenb



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux