Skip to content

Commit

Permalink
KVM: SVM: Fix disable pause loop exit/pause filtering capability on SVM
Browse files Browse the repository at this point in the history
'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]>
  • Loading branch information
Wanpeng Li authored and bonzini committed Jul 31, 2020
1 parent d2286ba commit 830f01b
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions arch/x86/kvm/svm/svm.c
Original file line number Diff line number Diff line change
Expand Up @@ -1090,7 +1090,7 @@ static void init_vmcb(struct vcpu_svm *svm)
svm->nested.vmcb = 0;
svm->vcpu.arch.hflags = 0;

if (pause_filter_count) {
if (!kvm_pause_in_guest(svm->vcpu.kvm)) {
control->pause_filter_count = pause_filter_count;
if (pause_filter_thresh)
control->pause_filter_thresh = pause_filter_thresh;
Expand Down Expand Up @@ -2693,7 +2693,7 @@ static int pause_interception(struct vcpu_svm *svm)
struct kvm_vcpu *vcpu = &svm->vcpu;
bool in_kernel = (svm_get_cpl(vcpu) == 0);

if (pause_filter_thresh)
if (!kvm_pause_in_guest(vcpu->kvm))
grow_ple_window(vcpu);

kvm_vcpu_on_spin(vcpu, in_kernel);
Expand Down Expand Up @@ -3780,7 +3780,7 @@ static void svm_handle_exit_irqoff(struct kvm_vcpu *vcpu)

static void svm_sched_in(struct kvm_vcpu *vcpu, int cpu)
{
if (pause_filter_thresh)
if (!kvm_pause_in_guest(vcpu->kvm))
shrink_ple_window(vcpu);
}

Expand Down Expand Up @@ -3958,6 +3958,9 @@ static void svm_vm_destroy(struct kvm *kvm)

static int svm_vm_init(struct kvm *kvm)
{
if (!pause_filter_count || !pause_filter_thresh)
kvm->arch.pause_in_guest = true;

if (avic) {
int ret = avic_vm_init(kvm);
if (ret)
Expand Down

0 comments on commit 830f01b

Please sign in to comment.