Skip to content

Commit 830f01b

Browse files
Wanpeng Libonzini
authored andcommitted
KVM: SVM: Fix disable pause loop exit/pause filtering capability on SVM
'Commit 8566ac8 ("KVM: SVM: Implement pause loop exit logic in SVM")' drops disable pause loop exit/pause filtering capability completely, I guess it is a merge fault by Radim since disable vmexits capabilities and pause loop exit for SVM patchsets are merged at the same time. This patch reintroduces the disable pause loop exit/pause filtering capability support. Reported-by: Haiwei Li <[email protected]> Tested-by: Haiwei Li <[email protected]> Fixes: 8566ac8 ("KVM: SVM: Implement pause loop exit logic in SVM") Signed-off-by: Wanpeng Li <[email protected]> Message-Id: <[email protected]> Cc: [email protected] Signed-off-by: Paolo Bonzini <[email protected]>
1 parent d2286ba commit 830f01b

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

arch/x86/kvm/svm/svm.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1090,7 +1090,7 @@ static void init_vmcb(struct vcpu_svm *svm)
10901090
svm->nested.vmcb = 0;
10911091
svm->vcpu.arch.hflags = 0;
10921092

1093-
if (pause_filter_count) {
1093+
if (!kvm_pause_in_guest(svm->vcpu.kvm)) {
10941094
control->pause_filter_count = pause_filter_count;
10951095
if (pause_filter_thresh)
10961096
control->pause_filter_thresh = pause_filter_thresh;
@@ -2693,7 +2693,7 @@ static int pause_interception(struct vcpu_svm *svm)
26932693
struct kvm_vcpu *vcpu = &svm->vcpu;
26942694
bool in_kernel = (svm_get_cpl(vcpu) == 0);
26952695

2696-
if (pause_filter_thresh)
2696+
if (!kvm_pause_in_guest(vcpu->kvm))
26972697
grow_ple_window(vcpu);
26982698

26992699
kvm_vcpu_on_spin(vcpu, in_kernel);
@@ -3780,7 +3780,7 @@ static void svm_handle_exit_irqoff(struct kvm_vcpu *vcpu)
37803780

37813781
static void svm_sched_in(struct kvm_vcpu *vcpu, int cpu)
37823782
{
3783-
if (pause_filter_thresh)
3783+
if (!kvm_pause_in_guest(vcpu->kvm))
37843784
shrink_ple_window(vcpu);
37853785
}
37863786

@@ -3958,6 +3958,9 @@ static void svm_vm_destroy(struct kvm *kvm)
39583958

39593959
static int svm_vm_init(struct kvm *kvm)
39603960
{
3961+
if (!pause_filter_count || !pause_filter_thresh)
3962+
kvm->arch.pause_in_guest = true;
3963+
39613964
if (avic) {
39623965
int ret = avic_vm_init(kvm);
39633966
if (ret)

0 commit comments

Comments
 (0)