From: Vitaly Kuznetsov <vkuznets@redhat.com>
To: Wanpeng Li <kernellwp@gmail.com>,
linux-kernel@vger.kernel.org, kvm@vger.kernel.org
Cc: Paolo Bonzini <pbonzini@redhat.com>,
Sean Christopherson <sean.j.christopherson@intel.com>,
Wanpeng Li <wanpengli@tencent.com>,
Jim Mattson <jmattson@google.com>, Joerg Roedel <joro@8bytes.org>
Subject: Re: [PATCH v2 3/3] KVM: SVM: Fix disable pause loop exit/pause filtering capability on SVM
Date: Wed, 29 Jul 2020 14:20:54 +0200 [thread overview]
Message-ID: <87k0ymldg9.fsf@vitty.brq.redhat.com> (raw)
In-Reply-To: <1595929506-9203-3-git-send-email-wanpengli@tencent.com>
Wanpeng Li <kernellwp@gmail.com> writes:
> From: Wanpeng Li <wanpengli@tencent.com>
>
> Commit 8566ac8b (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.
>
> We can observe 2.9% hackbench improvement for a 92 vCPUs guest on AMD
> Rome Server.
>
> Reported-by: Haiwei Li <lihaiwei@tencent.com>
> Tested-by: Haiwei Li <lihaiwei@tencent.com>
> Fixes: 8566ac8b (KVM: SVM: Implement pause loop exit logic in SVM)
> Signed-off-by: Wanpeng Li <wanpengli@tencent.com>
> ---
> arch/x86/kvm/svm/svm.c | 9 ++++++---
> 1 file changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c
> index c0da4dd..c20f127 100644
> --- a/arch/x86/kvm/svm/svm.c
> +++ b/arch/x86/kvm/svm/svm.c
> @@ -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 (pause_filter_count && !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;
> @@ -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);
> @@ -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);
> }
>
> @@ -3958,6 +3958,9 @@ static void svm_vm_destroy(struct kvm *kvm)
>
> static int svm_vm_init(struct kvm *kvm)
> {
> + if (!pause_filter_thresh)
> + kvm->arch.pause_in_guest = true;
Would it make sense to do
if (!pause_filter_count || !pause_filter_thresh)
kvm->arch.pause_in_guest = true;
here and simplify the condition in init_vmcb()?
> +
> if (avic) {
> int ret = avic_vm_init(kvm);
> if (ret)
--
Vitaly
next prev parent reply other threads:[~2020-07-29 12:21 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-28 9:45 [PATCH v2 1/3] KVM: LAPIC: Prevent setting the tscdeadline timer if the lapic is hw disabled Wanpeng Li
2020-07-28 9:45 ` [PATCH v2 2/3] KVM: LAPIC: Set the APIC_TDCR settable bits Wanpeng Li
2020-07-28 9:45 ` [PATCH v2 3/3] KVM: SVM: Fix disable pause loop exit/pause filtering capability on SVM Wanpeng Li
2020-07-29 12:20 ` Vitaly Kuznetsov [this message]
2020-07-30 0:56 ` Wanpeng Li
2020-07-30 11:16 ` Vitaly Kuznetsov
2020-07-31 3:18 ` Wanpeng Li
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87k0ymldg9.fsf@vitty.brq.redhat.com \
--to=vkuznets@redhat.com \
--cc=jmattson@google.com \
--cc=joro@8bytes.org \
--cc=kernellwp@gmail.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=sean.j.christopherson@intel.com \
--cc=wanpengli@tencent.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.