Patch "KVM/nVMX: Use __vmx_vcpu_run in nested_vmx_check_vmentry_hw" has been added to the 5.4-stable tree

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

 



20201231002702.2223707-5-seanjc@xxxxxxxxxx>
Message-ID: <166496600617116@xxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset=ANSI_X3.4-1968
Content-Transfer-Encoding: 8bit
X-stable: commit
X-Patchwork-Hint: ignore 


This is a note to let you know that I've just added the patch titled

    KVM/nVMX: Use __vmx_vcpu_run in nested_vmx_check_vmentry_hw

to the 5.4-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     kvm-nvmx-use-__vmx_vcpu_run-in-nested_vmx_check_vmentry_hw.patch
and it can be found in the queue-5.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.


>From foo@baz Wed Oct  5 12:28:43 PM CEST 2022
From: Thadeu Lima de Souza Cascardo <cascardo@xxxxxxxxxxxxx>
Date: Mon,  3 Oct 2022 10:10:26 -0300
Subject: KVM/nVMX: Use __vmx_vcpu_run in nested_vmx_check_vmentry_hw
To: stable@xxxxxxxxxxxxxxx
Cc: x86@xxxxxxxxxx, kvm@xxxxxxxxxxxxxxx, bp@xxxxxxxxx, pbonzini@xxxxxxxxxx, peterz@xxxxxxxxxxxxx, jpoimboe@xxxxxxxxxx
Message-ID: <20221003131038.12645-26-cascardo@xxxxxxxxxxxxx>

From: Uros Bizjak <ubizjak@xxxxxxxxx>

commit 150f17bfab37e981ba03b37440638138ff2aa9ec upstream.

Replace inline assembly in nested_vmx_check_vmentry_hw
with a call to __vmx_vcpu_run.  The function is not
performance critical, so (double) GPR save/restore
in __vmx_vcpu_run can be tolerated, as far as performance
effects are concerned.

Cc: Paolo Bonzini <pbonzini@xxxxxxxxxx>
Cc: Sean Christopherson <seanjc@xxxxxxxxxx>
Reviewed-and-tested-by: Sean Christopherson <seanjc@xxxxxxxxxx>
Signed-off-by: Uros Bizjak <ubizjak@xxxxxxxxx>
[sean: dropped versioning info from changelog]
Signed-off-by: Sean Christopherson <seanjc@xxxxxxxxxx>
Message-Id: <20201231002702.2223707-5-seanjc@xxxxxxxxxx>
Signed-off-by: Paolo Bonzini <pbonzini@xxxxxxxxxx>
[cascardo: small fixups]
Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@xxxxxxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
---
 arch/x86/kvm/vmx/nested.c |   32 +++-----------------------------
 arch/x86/kvm/vmx/vmx.c    |    2 --
 arch/x86/kvm/vmx/vmx.h    |    1 +
 3 files changed, 4 insertions(+), 31 deletions(-)

--- a/arch/x86/kvm/vmx/nested.c
+++ b/arch/x86/kvm/vmx/nested.c
@@ -11,6 +11,7 @@
 #include "mmu.h"
 #include "nested.h"
 #include "trace.h"
+#include "vmx.h"
 #include "x86.h"
 
 static bool __read_mostly enable_shadow_vmcs = 1;
@@ -2863,35 +2864,8 @@ static int nested_vmx_check_vmentry_hw(s
 		vmx->loaded_vmcs->host_state.cr4 = cr4;
 	}
 
-	asm(
-		"sub $%c[wordsize], %%" _ASM_SP "\n\t" /* temporarily adjust RSP for CALL */
-		"cmp %%" _ASM_SP ", %c[host_state_rsp](%[loaded_vmcs]) \n\t"
-		"je 1f \n\t"
-		__ex("vmwrite %%" _ASM_SP ", %[HOST_RSP]") "\n\t"
-		"mov %%" _ASM_SP ", %c[host_state_rsp](%[loaded_vmcs]) \n\t"
-		"1: \n\t"
-		"add $%c[wordsize], %%" _ASM_SP "\n\t" /* un-adjust RSP */
-
-		/* Check if vmlaunch or vmresume is needed */
-		"cmpb $0, %c[launched](%[loaded_vmcs])\n\t"
-
-		/*
-		 * VMLAUNCH and VMRESUME clear RFLAGS.{CF,ZF} on VM-Exit, set
-		 * RFLAGS.CF on VM-Fail Invalid and set RFLAGS.ZF on VM-Fail
-		 * Valid.  vmx_vmenter() directly "returns" RFLAGS, and so the
-		 * results of VM-Enter is captured via CC_{SET,OUT} to vm_fail.
-		 */
-		"call vmx_vmenter\n\t"
-
-		CC_SET(be)
-	      : ASM_CALL_CONSTRAINT, CC_OUT(be) (vm_fail)
-	      :	[HOST_RSP]"r"((unsigned long)HOST_RSP),
-		[loaded_vmcs]"r"(vmx->loaded_vmcs),
-		[launched]"i"(offsetof(struct loaded_vmcs, launched)),
-		[host_state_rsp]"i"(offsetof(struct loaded_vmcs, host_state.rsp)),
-		[wordsize]"i"(sizeof(ulong))
-	      : "memory"
-	);
+	vm_fail = __vmx_vcpu_run(vmx, (unsigned long *)&vcpu->arch.regs,
+				 vmx->loaded_vmcs->launched);
 
 	if (vmx->msr_autoload.host.nr)
 		vmcs_write32(VM_EXIT_MSR_LOAD_COUNT, vmx->msr_autoload.host.nr);
--- a/arch/x86/kvm/vmx/vmx.c
+++ b/arch/x86/kvm/vmx/vmx.c
@@ -6540,8 +6540,6 @@ void vmx_update_host_rsp(struct vcpu_vmx
 	}
 }
 
-bool __vmx_vcpu_run(struct vcpu_vmx *vmx, unsigned long *regs, bool launched);
-
 static void vmx_vcpu_run(struct kvm_vcpu *vcpu)
 {
 	struct vcpu_vmx *vmx = to_vmx(vcpu);
--- a/arch/x86/kvm/vmx/vmx.h
+++ b/arch/x86/kvm/vmx/vmx.h
@@ -336,6 +336,7 @@ void vmx_set_virtual_apic_mode(struct kv
 struct shared_msr_entry *find_msr_entry(struct vcpu_vmx *vmx, u32 msr);
 void pt_update_intercept_for_msr(struct vcpu_vmx *vmx);
 void vmx_update_host_rsp(struct vcpu_vmx *vmx, unsigned long host_rsp);
+bool __vmx_vcpu_run(struct vcpu_vmx *vmx, unsigned long *regs, bool launched);
 
 #define POSTED_INTR_ON  0
 #define POSTED_INTR_SN  1


Patches currently in stable-queue which might be from cascardo@xxxxxxxxxxxxx are

queue-5.4/x86-speculation-disable-rrsba-behavior.patch
queue-5.4/kvm-vmx-flatten-__vmx_vcpu_run.patch
queue-5.4/x86-kvm-vmx-make-noinstr-clean.patch
queue-5.4/revert-x86-speculation-add-rsb-vm-exit-protections.patch
queue-5.4/kvm-vmx-fix-ibrs-handling-after-vmexit.patch
queue-5.4/kvm-vmx-prevent-guest-rsb-poisoning-attacks-with-eibrs.patch
queue-5.4/kvm-nvmx-use-__vmx_vcpu_run-in-nested_vmx_check_vmentry_hw.patch
queue-5.4/x86-bugs-keep-a-per-cpu-ia32_spec_ctrl-value.patch
queue-5.4/x86-cpu-amd-enumerate-btc_no.patch
queue-5.4/x86-speculation-fix-firmware-entry-spec_ctrl-handling.patch
queue-5.4/x86-speculation-add-spectre_v2-ibrs-option-to-support-kernel-ibrs.patch
queue-5.4/x86-cpu-add-consistent-cpu-match-macros.patch
queue-5.4/x86-speculation-remove-x86_spec_ctrl_mask.patch
queue-5.4/x86-bugs-add-cannon-lake-to-retbleed-affected-cpu-list.patch
queue-5.4/x86-bugs-warn-when-ibrs-mitigation-is-selected-on-enhanced-ibrs-parts.patch
queue-5.4/x86-speculation-fill-rsb-on-vmexit-for-ibrs.patch
queue-5.4/x86-cpu-add-a-steppings-field-to-struct-x86_cpu_id.patch
queue-5.4/kvm-vmx-convert-launched-argument-to-flags.patch
queue-5.4/x86-common-stamp-out-the-stepping-madness.patch
queue-5.4/x86-bugs-split-spectre_v2_select_mitigation-and-spectre_v2_user_select_mitigation.patch
queue-5.4/x86-bugs-report-intel-retbleed-vulnerability.patch
queue-5.4/x86-speculation-change-fill_return_buffer-to-work-with-objtool.patch
queue-5.4/x86-cpufeatures-move-retpoline-flags-to-word-11.patch
queue-5.4/x86-speculation-fix-spec_ctrl-write-on-smt-state-change.patch
queue-5.4/kvm-vmx-use-test-reg-reg-instead-of-cmp-0-reg-in-vmenter.s.patch
queue-5.4/x86-bugs-optimize-spec_ctrl-msr-writes.patch
queue-5.4/x86-bugs-report-amd-retbleed-vulnerability.patch
queue-5.4/x86-speculation-fix-rsb-filling-with-config_retpoline-n.patch
queue-5.4/intel_idle-disable-ibrs-during-long-idle.patch
queue-5.4/x86-speculation-use-declare_per_cpu-for-x86_spec_ctrl_current.patch
queue-5.4/x86-entry-remove-skip_r11rcx.patch
queue-5.4/x86-speculation-use-cached-host-spec_ctrl-value-for-guest-entry-exit.patch
queue-5.4/x86-devicetable-move-x86-specific-macro-out-of-generic-code.patch
queue-5.4/x86-bugs-add-amd-retbleed-boot-parameter.patch
queue-5.4/x86-entry-add-kernel-ibrs-implementation.patch
queue-5.4/revert-x86-cpu-add-a-steppings-field-to-struct-x86_cpu_id.patch
queue-5.4/x86-speculation-add-rsb-vm-exit-protections.patch



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux