mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2 00/15] KVM: x86: VMX: Fix MSR namespacing
@ 2020-09-23 18:03 Sean Christopherson
  2020-09-23 18:03 ` [PATCH v2 01/15] KVM: x86: Rename "shared_msrs" to "user_return_msrs" Sean Christopherson
                   ` (14 more replies)
  0 siblings, 15 replies; 17+ messages in thread
From: Sean Christopherson @ 2020-09-23 18:03 UTC (permalink / raw)
  To: Paolo Bonzini
  Cc: Sean Christopherson, Vitaly Kuznetsov, Wanpeng Li, Jim Mattson,
	Joerg Roedel, kvm, linux-kernel

This series attempts to clean up VMX's MSR namespacing, which is in
unimitigated disaster (keeping things PG).

There are a variety of ways VMX saves and restores guest MSRs, all with
unique properties and mechanisms, but with haphazard namespacing (assuming
there is any namespacing at all).  Some fun collisions:

  __find_msr_index(), find_msr_entry() and vmx_find_msr_index()

  vmx_set_guest_msr() and vmx_set_msr()

  structs vmx_msrs, vmx_msr_entry, shared_msr_entry, kvm_shared_msrs and
  kvm_shared_msrs_values

  vcpu_vmx fields guest_msrs, msr_autoload.guest and msr_autostore.guest

Probably the most infurating/confusing nomenclature is "index", which can
mean MSR's ECX index, index into one of several VMX arrays, or index into
a common x86 array.  __find_msr_index() even manages to mix at least three
different meanings in about as many lines of code.

The biggest change is to rename the "shared MSRs" mechanism to "user
return MSRs" (details in patch 1), most everything else is either derived
from that rename or is fairly straightforward cleanup.

No true functional changes, although the update_transition_efer() change
in patch 10 dances pretty close to being a functional change.

v2:
  - Rebased to kvm/queue, commit e1ba1a15af73 ("KVM: SVM: Enable INVPCID
    feature on AMD").

Sean Christopherson (15):
  KVM: x86: Rename "shared_msrs" to "user_return_msrs"
  KVM: VMX: Prepend "MAX_" to MSR array size defines
  KVM: VMX: Rename "vmx_find_msr_index" to "vmx_find_loadstore_msr_slot"
  KVM: VMX: Rename the "shared_msr_entry" struct to "vmx_uret_msr"
  KVM: VMX: Rename vcpu_vmx's "nmsrs" to "nr_uret_msrs"
  KVM: VMX: Rename vcpu_vmx's "save_nmsrs" to "nr_active_uret_msrs"
  KVM: VMX: Rename vcpu_vmx's "guest_msrs_ready" to
    "guest_uret_msrs_loaded"
  KVM: VMX: Rename "__find_msr_index" to "__vmx_find_uret_msr"
  KVM: VMX: Check guest support for RDTSCP before processing MSR_TSC_AUX
  KVM: VMX: Move uret MSR lookup into update_transition_efer()
  KVM: VMX: Add vmx_setup_uret_msr() to handle lookup and swap
  KVM: VMX: Rename "find_msr_entry" to "vmx_find_uret_msr"
  KVM: VMX: Rename "vmx_set_guest_msr" to "vmx_set_guest_uret_msr"
  KVM: VMX: Rename "vmx_msr_index" to "vmx_uret_msrs_list"
  KVM: VMX: Rename vmx_uret_msr's "index" to "slot"

 arch/x86/include/asm/kvm_host.h |   4 +-
 arch/x86/kvm/vmx/nested.c       |  22 ++--
 arch/x86/kvm/vmx/vmx.c          | 184 ++++++++++++++++----------------
 arch/x86/kvm/vmx/vmx.h          |  24 ++---
 arch/x86/kvm/x86.c              | 101 +++++++++---------
 5 files changed, 168 insertions(+), 167 deletions(-)

-- 
2.28.0


^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2020-09-25 22:04 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-23 18:03 [PATCH v2 00/15] KVM: x86: VMX: Fix MSR namespacing Sean Christopherson
2020-09-23 18:03 ` [PATCH v2 01/15] KVM: x86: Rename "shared_msrs" to "user_return_msrs" Sean Christopherson
2020-09-23 18:03 ` [PATCH v2 02/15] KVM: VMX: Prepend "MAX_" to MSR array size defines Sean Christopherson
2020-09-23 18:03 ` [PATCH v2 03/15] KVM: VMX: Rename "vmx_find_msr_index" to "vmx_find_loadstore_msr_slot" Sean Christopherson
2020-09-25 22:04   ` Paolo Bonzini
2020-09-23 18:03 ` [PATCH v2 04/15] KVM: VMX: Rename the "shared_msr_entry" struct to "vmx_uret_msr" Sean Christopherson
2020-09-23 18:03 ` [PATCH v2 05/15] KVM: VMX: Rename vcpu_vmx's "nmsrs" to "nr_uret_msrs" Sean Christopherson
2020-09-23 18:04 ` [PATCH v2 06/15] KVM: VMX: Rename vcpu_vmx's "save_nmsrs" to "nr_active_uret_msrs" Sean Christopherson
2020-09-23 18:04 ` [PATCH v2 07/15] KVM: VMX: Rename vcpu_vmx's "guest_msrs_ready" to "guest_uret_msrs_loaded" Sean Christopherson
2020-09-23 18:04 ` [PATCH v2 08/15] KVM: VMX: Rename "__find_msr_index" to "__vmx_find_uret_msr" Sean Christopherson
2020-09-23 18:04 ` [PATCH v2 09/15] KVM: VMX: Check guest support for RDTSCP before processing MSR_TSC_AUX Sean Christopherson
2020-09-23 18:04 ` [PATCH v2 10/15] KVM: VMX: Move uret MSR lookup into update_transition_efer() Sean Christopherson
2020-09-23 18:04 ` [PATCH v2 11/15] KVM: VMX: Add vmx_setup_uret_msr() to handle lookup and swap Sean Christopherson
2020-09-23 18:04 ` [PATCH v2 12/15] KVM: VMX: Rename "find_msr_entry" to "vmx_find_uret_msr" Sean Christopherson
2020-09-23 18:04 ` [PATCH v2 13/15] KVM: VMX: Rename "vmx_set_guest_msr" to "vmx_set_guest_uret_msr" Sean Christopherson
2020-09-23 18:04 ` [PATCH v2 14/15] KVM: VMX: Rename "vmx_msr_index" to "vmx_uret_msrs_list" Sean Christopherson
2020-09-23 18:04 ` [PATCH v2 15/15] KVM: VMX: Rename vmx_uret_msr's "index" to "slot" Sean Christopherson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®