Re: [PATCH 3/3] KVM: VMX: Use the canonical interface to read CR4.UMIP bit

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

 



On Fri, Mar 10, 2023, Robert Hoo wrote:
> Use kvm_read_cr4_bits() rather than directly read vcpu->arch.cr4, now that
> we have reg cache layer and defined this wrapper.

kvm_read_cr4_bits() predates this code by ~7 years.

> Although, effectively for CR4.UMIP, it's the same, at present, as it's not
> guest owned, in case of future changes, here better to use the canonical
> interface.

Practically speaking, UMIP _can't_ be guest owned without breaking UMIP emulation.
I do like not open coding vcpu->arch.cr4, but I don't particuarly like the changelog.

This would also be a good time to opportunistically convert the WARN_ON() to a
WARN_ON_ONCE() (when it fires, it fires a _lot).

This, with a reworded changelog?

	/*
	 * UMIP emulation relies on intercepting writes to CR4.UMIP, i.e. this
	 * and other code needs to be updated if UMIP can be guest owned.
	 */
	BUILD_BUG_ON(KVM_POSSIBLE_CR4_GUEST_BITS & X86_CR4_UMIP);

	WARN_ON_ONCE(!kvm_read_cr4_bits(vcpu, X86_CR4_UMIP));
	return kvm_emulate_instruction(vcpu, 0);



[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