Re: [PATCH 10/10] KVM: VMX: Convert vcpu_vmx.exit_reason to a union

From: Paolo Bonzini
Date: Tue Mar 17 2020 - 13:51:17 EST


On 17/03/20 06:28, Sean Christopherson wrote:
>>>
>>> +union vmx_exit_reason {
>>> + struct {
>>> + u32 basic : 16;
>>> + u32 reserved16 : 1;
>>> + u32 reserved17 : 1;
>>> + u32 reserved18 : 1;
>>> + u32 reserved19 : 1;
>>> + u32 reserved20 : 1;
>>> + u32 reserved21 : 1;
>>> + u32 reserved22 : 1;
>>> + u32 reserved23 : 1;
>>> + u32 reserved24 : 1;
>>> + u32 reserved25 : 1;
>>> + u32 reserved26 : 1;
>>> + u32 enclave_mode : 1;
>>> + u32 smi_pending_mtf : 1;
>>> + u32 smi_from_vmx_root : 1;
>>> + u32 reserved30 : 1;
>>> + u32 failed_vmentry : 1;
>> Just wondering, is there any particular benefit in using 'u32' instead
>> of 'u16' here?
> Not that I know of. Paranoia that the compiler will do something weird?

Since we have an "u32 full" it makes sense to have u32 here too, it
documents that we're matching an u32 field in the other side of the union.

Paolo