Re: [PATCH 1/2] kvm: vmx: Use basic exit reason to check if it's the specific VM EXIT

From: Krish Sadhukhan
Date: Tue Feb 25 2020 - 13:29:36 EST



On 2/25/20 5:11 AM, Vitaly Kuznetsov wrote:
Krish Sadhukhan <krish.sadhukhan@xxxxxxxxxx> writes:

We have a macro for bit 31,

ÂÂÂ VMX_EXIT_REASONS_FAILED_VMENTRYÂÂÂ ÂÂÂ ÂÂÂ ÂÂÂ 0x80000000


Does it make sense to define a macro like that instead ? Say,

ÂÂÂ VMX_BASIC_EXIT_REASONÂÂÂ ÂÂÂ 0x0000ffff

0xffffU ?

and then we do,

ÂÂÂ u32 exit_reason = vmx->exit_reason;
ÂÂÂ u16 basic_exit_reason = exit_reason & VMX_BASIC_EXIT_REASON;

Just a naming suggestion: if we decide to go down this road, let's name
it e.g. VMX_BASIC_EXIT_REASON_MASK to make it clear this is *not* an
exit reason.


VMX_BASIC_EXIT_REASON_MASKÂ works.