Re: [PATCH v7 4/5] KVM: x86: Untag address when LAM applicable

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

 




On 4/6/2023 9:20 PM, Huang, Kai wrote:
On Tue, 2023-04-04 at 21:09 +0800, Binbin Wu wrote:
  	case VMX_VPID_EXTENT_INDIVIDUAL_ADDR:
+		/* invvpid is not valid in compatibility mode */
+		if (is_long_mode(vcpu))
+			operand.gla = vmx_untag_addr(vcpu, operand.gla, 0);
This comment doesn't make sense.  The code does nothing to distinguish the
compatibility mode and the 64-bit mode.

I was also hesitant when added the comment.



Now although we are all clear that here is_long_mode() basically equals to
is_64_bit_mode(), but I do think we need a comment or WARN() _SOMEWHERE_ to
indicate that compatibility mode is not possible when handling VMEXIT for VMX
instructions (except VMCALL).  Not everyone will be able to notice this small
thing in the SDM.

If the WARN() is preferred, IMO, it can be added to nested_vmx_check_permission() because
it is called by all handlers "need" the check except for handle_vmxon().
handle_vmxon() can be added separately.



Then you can just delete this comment here.

Alternatively, for better readability actually I am thinking maybe we should
just use is_64_bit_mode(), because those segments are cached by KVM anyway so I
don't think there's measurable performance difference between is_long_mode() and
is_64_bit_mode().

Agree.



Sean, any comments?



[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