KVM/SVM: Move vmenter.S exception fixups out of line
PATCH 1/1 KVM/SVM: Move vmenter.S exception fixups out of line
Avoid jump by moving exception fixups out of line.
Cc Sean Christopherson <[email protected]>
Cc Paolo Bonzini <[email protected]>
Signed-off-by Uros Bizjak <[email protected]>
--- arch/x86/kvm/svm/vmenter.S | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-)
arch/x86/kvm/svm/vmenter.S +20 -15
@@ -80,15 +80,9 @@ SYM_FUNC_START(__svm_vcpu_run) /* Enter guest mode */ sti -3: vmrun %_ASM_AX - jmp 5f -4: cmpb $0, kvm_rebooting - jne 5f - ud2 - _ASM_EXTABLE(3b, 4b) +1: vmrun %_ASM_AX -5: - cli +2: cli #ifdef CONFIG_RETPOLINE /* IMPORTANT: Stuff the RSB immediately after VM-Exit, before RET! */
@@ -155,6 +149,13 @@ SYM_FUNC_START(__svm_vcpu_run) #endif pop %_ASM_BP ret + +3: cmpb $0, kvm_rebooting + jne 2b + ud2 + + _ASM_EXTABLE(1b, 3b) + SYM_FUNC_END(__svm_vcpu_run) /**
@@ -174,18 +175,15 @@ SYM_FUNC_START(__svm_sev_es_vcpu_run) #endif push %_ASM_BX - /* Enter guest mode */ + /* Move @vmcb to RAX. */ mov %_ASM_ARG1, %_ASM_AX + + /* Enter guest mode */ sti 1: vmrun %_ASM_AX - jmp 3f -2: cmpb $0, kvm_rebooting - jne 3f - ud2 - _ASM_EXTABLE(1b, 2b) -3: cli +2: cli #ifdef CONFIG_RETPOLINE /* IMPORTANT: Stuff the RSB immediately after VM-Exit, before RET! */
@@ -205,4 +203,11 @@ SYM_FUNC_START(__svm_sev_es_vcpu_run) #endif pop %_ASM_BP ret + +3: cmpb $0, kvm_rebooting + jne 2b + ud2 + + _ASM_EXTABLE(1b, 3b) + SYM_FUNC_END(__svm_sev_es_vcpu_run)
Signature · 1 line
2.29.2
Quoted 71 lines · Uros Bizjak
Avoid jump by moving exception fixups out of line.
Cc Sean Christopherson <[email protected]>Cc Paolo Bonzini <[email protected]>Signed-off-by Uros Bizjak <[email protected]>--- arch/x86/kvm/svm/vmenter.S | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-)arch/x86/kvm/svm/vmenter.S +13
-15@@ -80,15 +80,9 @@ SYM_FUNC_START(__svm_vcpu_run) /* Enter guest mode */ sti -3: vmrun %_ASM_AX - jmp 5f -4: cmpb $0, kvm_rebooting - jne 5f - ud2 - _ASM_EXTABLE(3b, 4b) +1: vmrun %_ASM_AX -5: - cli +2: cli #ifdef CONFIG_RETPOLINE /* IMPORTANT: Stuff the RSB immediately after VM-Exit, before RET! */@@ -155,6 +149,13 @@ SYM_FUNC_START(__svm_vcpu_run) #endif pop %_ASM_BP ret + +3: cmpb $0, kvm_rebooting + jne 2b + ud2 + + _ASM_EXTABLE(1b, 3b) + SYM_FUNC_END(__svm_vcpu_run) /**@@ -174,18 +175,15 @@ SYM_FUNC_START(__svm_sev_es_vcpu_run) #endif push %_ASM_BX - /* Enter guest mode */ + /* Move @vmcb to RAX. */ mov %_ASM_ARG1, %_ASM_AX + + /* Enter guest mode */ sti 1: vmrun %_ASM_AX - jmp 3f -2: cmpb $0, kvm_rebooting - jne 3f - ud2 - _ASM_EXTABLE(1b, 2b) -3: cli +2: cli #ifdef CONFIG_RETPOLINE /* IMPORTANT: Stuff the RSB immediately after VM-Exit, before RET! */@@ -205,4 +203,11 @@ SYM_FUNC_START(__svm_sev_es_vcpu_run) #endif
arch/x86/kvm/svm/vmenter.S SYM_FUNC_START(__svm_sev_es_vcpu_run) · line 213
Quoted 10 lines
arch/x86/kvm/svm/vmenter.S +7
-0pop %_ASM_BP ret + +3: cmpb $0, kvm_rebooting + jne 2b + ud2 + + _ASM_EXTABLE(1b, 3b) + SYM_FUNC_END(__svm_sev_es_vcpu_run)
Queued, thanks.
Paolo