[lkml]   [2019]   [Jun]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH v2] KVM: x86: Modify struct kvm_nested_state to have explicit fields for data

> On 19 Jun 2019, at 13:45, Paolo Bonzini <> wrote:
> On 19/06/19 00:36, Liran Alon wrote:
>>> On 18 Jun 2019, at 19:24, Paolo Bonzini <> wrote:
>>> From: Liran Alon <>
>>> Improve the KVM_{GET,SET}_NESTED_STATE structs by detailing the format
>>> of VMX nested state data in a struct.
>>> In order to avoid changing the ioctl values of
>>> KVM_{GET,SET}_NESTED_STATE, there is a need to preserve
>>> sizeof(struct kvm_nested_state). This is done by defining the data
>>> struct as "data.vmx[0]". It was the most elegant way I found to
>>> preserve struct size while still keeping struct readable and easy to
>>> maintain. It does have a misfortunate side-effect that now it has to be
>>> accessed as "data.vmx[0]" rather than just "data.vmx".
>>> Because we are already modifying these structs, I also modified the
>>> following:
>>> * Define the "format" field values as macros.
>>> * Rename vmcs_pa to vmcs12_pa for better readability.
>>> Signed-off-by: Liran Alon <>
>>> [Remove SVM stubs, add KVM_STATE_NESTED_VMX_VMCS12_SIZE. - Paolo]
>> 1) Why should we remove SVM stubs? I think it makes the interface intention more clear.
>> Do you see any disadvantage of having them?
> In its current state I think it would not require any state apart from
> the global flags, because MSRs can be extracted independent of
> KVM_GET_NESTED_STATE; this may change as things are cleaned up, but if
> that remains the case there would be no need for SVM structs at all.

Hmm yes I see your point. Ok I agree.

>> 2) What is the advantage of defining a separate KVM_STATE_NESTED_VMX_VMCS12_SIZE
>> rather than just moving VMCS12_SIZE to userspace header?
> It's just for namespace cleanliness. I'm keeping VMCS12_SIZE for the
> arch/x86/kvm/vmx/ code because it's shorter and we're used to it, but
> userspace headers should use a more specific name.

Ok then.
I will submit my next version of QEMU patches according to this version of the headers.

Reviewed-by: Liran Alon <>

> Paolo

 \ /
  Last update: 2019-06-19 13:13    [W:0.036 / U:8.720 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site