diff mbox series

[01/11] KVM: vmx: move msr_host_bndcfgs out of struct host_state

Message ID 20180723193250.13555-2-sean.j.christopherson@intel.com
State New, archived
Headers show
Series KVM: vmx: optimize VMWRITEs to host FS/GS fields | expand

Commit Message

Sean Christopherson July 23, 2018, 7:32 p.m. UTC
Future patches will change the semantics of 'struct host_state' from
a straightforward tracker to a means of optimizing away unnecessary
VMWRITEs.  Move msr_host_bndcfgs out of host_state as it won't mesh
with the new semantics, to allow for more proper naming of host_state
and to constrain a likely conflict with another in-flight patch[1] to
this non-functional change.

[1] https://www.spinics.net/lists/kvm/msg171645.html

Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
---
 arch/x86/kvm/vmx.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Peter Shier July 24, 2018, 10:36 p.m. UTC | #1
On Mon, Jul 23, 2018 at 12:33 PM Sean Christopherson
<sean.j.christopherson@intel.com> wrote:
>
> Future patches will change the semantics of 'struct host_state' from
> a straightforward tracker to a means of optimizing away unnecessary
> VMWRITEs.  Move msr_host_bndcfgs out of host_state as it won't mesh
> with the new semantics, to allow for more proper naming of host_state
> and to constrain a likely conflict with another in-flight patch[1] to
> this non-functional change.
>
> [1] https://www.spinics.net/lists/kvm/msg171645.html
>
> Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>

Reviewed-by: Peter Shier <pshier@google.com>
Tested-by: Peter Shier <pshier@google.com>
diff mbox series

Patch

diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index 1689f433f3a0..553bf26af831 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -802,7 +802,6 @@  struct vcpu_vmx {
 #endif
 		int           gs_ldt_reload_needed;
 		int           fs_reload_needed;
-		u64           msr_host_bndcfgs;
 	} host_state;
 	struct {
 		int vm86_active;
@@ -845,6 +844,7 @@  struct vcpu_vmx {
 	u32 host_pkru;
 
 	unsigned long host_debugctlmsr;
+	u64           msr_host_bndcfgs;
 
 	/*
 	 * Only bits masked by msr_ia32_feature_control_valid_bits can be set in
@@ -2622,7 +2622,7 @@  static void vmx_save_host_state(struct kvm_vcpu *vcpu)
 	vmcs_writel(HOST_GS_BASE, segment_base(vmx->host_state.gs_sel));
 #endif
 	if (boot_cpu_has(X86_FEATURE_MPX))
-		rdmsrl(MSR_IA32_BNDCFGS, vmx->host_state.msr_host_bndcfgs);
+		rdmsrl(MSR_IA32_BNDCFGS, vmx->msr_host_bndcfgs);
 	for (i = 0; i < vmx->save_nmsrs; ++i)
 		kvm_set_shared_msr(vmx->guest_msrs[i].index,
 				   vmx->guest_msrs[i].data,
@@ -2660,8 +2660,8 @@  static void __vmx_load_host_state(struct vcpu_vmx *vmx)
 #ifdef CONFIG_X86_64
 	wrmsrl(MSR_KERNEL_GS_BASE, vmx->msr_host_kernel_gs_base);
 #endif
-	if (vmx->host_state.msr_host_bndcfgs)
-		wrmsrl(MSR_IA32_BNDCFGS, vmx->host_state.msr_host_bndcfgs);
+	if (vmx->msr_host_bndcfgs)
+		wrmsrl(MSR_IA32_BNDCFGS, vmx->msr_host_bndcfgs);
 	load_fixmap_gdt(raw_smp_processor_id());
 }