[v2,0/3] KVM: VMX: MSR intercept/passthrough cleanup and simplification

Message ID 20240223202104.3330974-1-seanjc@google.com
Headers
Series KVM: VMX: MSR intercept/passthrough cleanup and simplification |

Message

Sean Christopherson Feb. 23, 2024, 8:21 p.m. UTC
  Clean up VMX's MSR passthrough code, in particular the portion that deals with
userspace MSR filters (KVM needs to force interception if userspace wants to
intercept even if KVM wants to passthrough).  As pointed out by Dongli, KVM
does a linear walk twice in quick succession, which is wasteful, confuing, and
unnecessarily brittle.

Same exact idea as Dongli's v1[*], just a different approach to cleaning up the
API for dealing with MSR filters.

v2: Combine "check and get" into a single API instead of adding an out param.
 
Dongli Zhang (2):
  KVM: VMX: fix comment to add LBR to passthrough MSRs
  KVM: VMX: return early if msr_bitmap is not supported

Sean Christopherson (1):
  KVM: VMX: Combine "check" and "get" APIs for passthrough MSR lookups

 arch/x86/kvm/vmx/vmx.c | 68 ++++++++++++++++++------------------------
 1 file changed, 29 insertions(+), 39 deletions(-)


base-commit: ec1e3d33557babed2c2c2c7da6e84293c2f56f58
  

Comments

Sean Christopherson Feb. 27, 2024, 9:28 p.m. UTC | #1
On Fri, 23 Feb 2024 12:21:01 -0800, Sean Christopherson wrote:
> Clean up VMX's MSR passthrough code, in particular the portion that deals with
> userspace MSR filters (KVM needs to force interception if userspace wants to
> intercept even if KVM wants to passthrough).  As pointed out by Dongli, KVM
> does a linear walk twice in quick succession, which is wasteful, confuing, and
> unnecessarily brittle.
> 
> Same exact idea as Dongli's v1[*], just a different approach to cleaning up the
> API for dealing with MSR filters.
> 
> [...]

Applied to kvm-x86 vmx, with Dongli's suggested comment indentation fixup.

Thanks!

[1/3] KVM: VMX: fix comment to add LBR to passthrough MSRs
      https://github.com/kvm-x86/linux/commit/8e24eeedfda3
[2/3] KVM: VMX: return early if msr_bitmap is not supported
      https://github.com/kvm-x86/linux/commit/bab22040d7fd
[3/3] KVM: VMX: Combine "check" and "get" APIs for passthrough MSR lookups
      https://github.com/kvm-x86/linux/commit/259720c37d51
--
https://github.com/kvm-x86/linux/tree/next