From: Paolo Bonzini <pbonzini@redhat.com>
To: "Marc Zyngier" <maz@kernel.org>,
"Radim Krčmář" <rkrcmar@redhat.com>,
"Julien Thierry" <julien.thierry.kdev@gmail.com>,
"Suzuki K Poulose" <suzuki.poulose@arm.com>,
"James Morse" <james.morse@arm.com>,
"Joerg Roedel" <joro@8bytes.org>,
"Suravee Suthikulpanit" <Suravee.Suthikulpanit@amd.com>,
Tangnianyao <tangnianyao@huawei.com>
Cc: kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org
Subject: Re: [PATCH 2/2] KVM: Call kvm_arch_vcpu_blocking early into the blocking sequence
Date: Fri, 2 Aug 2019 12:46:33 +0200 [thread overview]
Message-ID: <a7250b9a-60e9-b04c-5515-e506aea46515@redhat.com> (raw)
In-Reply-To: <20190802103709.70148-3-maz@kernel.org>
On 02/08/19 12:37, Marc Zyngier wrote:
> When a vpcu is about to block by calling kvm_vcpu_block, we call
> back into the arch code to allow any form of synchronization that
> may be required at this point (SVN stops the AVIC, ARM synchronises
> the VMCR and enables GICv4 doorbells). But this synchronization
> comes in quite late, as we've potentially waited for halt_poll_ns
> to expire.
>
> Instead, let's move kvm_arch_vcpu_blocking() to the beginning of
> kvm_vcpu_block(), which on ARM has several benefits:
>
> - VMCR gets synchronised early, meaning that any interrupt delivered
> during the polling window will be evaluated with the correct guest
> PMR
> - GICv4 doorbells are enabled, which means that any guest interrupt
> directly injected during that window will be immediately recognised
>
> Tang Nianyao ran some tests on a GICv4 machine to evaluate such
> change, and reported up to a 10% improvement for netperf:
>
> <quote>
> netperf result:
> D06 as server, intel 8180 server as client
> with change:
> package 512 bytes - 5500 Mbits/s
> package 64 bytes - 760 Mbits/s
> without change:
> package 512 bytes - 5000 Mbits/s
> package 64 bytes - 710 Mbits/s
> </quote>
>
> Signed-off-by: Marc Zyngier <maz@kernel.org>
> ---
> virt/kvm/kvm_main.c | 7 +++----
> 1 file changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
> index 887f3b0c2b60..90d429c703cb 100644
> --- a/virt/kvm/kvm_main.c
> +++ b/virt/kvm/kvm_main.c
> @@ -2322,6 +2322,8 @@ void kvm_vcpu_block(struct kvm_vcpu *vcpu)
> bool waited = false;
> u64 block_ns;
>
> + kvm_arch_vcpu_blocking(vcpu);
> +
> start = cur = ktime_get();
> if (vcpu->halt_poll_ns && !kvm_arch_no_poll(vcpu)) {
> ktime_t stop = ktime_add_ns(ktime_get(), vcpu->halt_poll_ns);
> @@ -2342,8 +2344,6 @@ void kvm_vcpu_block(struct kvm_vcpu *vcpu)
> } while (single_task_running() && ktime_before(cur, stop));
> }
>
> - kvm_arch_vcpu_blocking(vcpu);
> -
> for (;;) {
> prepare_to_swait_exclusive(&vcpu->wq, &wait, TASK_INTERRUPTIBLE);
>
> @@ -2356,9 +2356,8 @@ void kvm_vcpu_block(struct kvm_vcpu *vcpu)
>
> finish_swait(&vcpu->wq, &wait);
> cur = ktime_get();
> -
> - kvm_arch_vcpu_unblocking(vcpu);
> out:
> + kvm_arch_vcpu_unblocking(vcpu);
> block_ns = ktime_to_ns(cur) - ktime_to_ns(start);
>
> if (!vcpu_valid_wakeup(vcpu))
>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
_______________________________________________
kvmarm mailing list
kvmarm@lists.cs.columbia.edu
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm
next prev parent reply other threads:[~2019-08-02 10:46 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-02 10:37 [PATCH 0/2] KVM: arm/arm64: Fix guest's PMR synchronization when blocking on WFI Marc Zyngier
2019-08-02 10:37 ` [PATCH 1/2] KVM: arm/arm64: Sync ICH_VMCR_EL2 back when about to block Marc Zyngier
2019-08-02 10:37 ` [PATCH 2/2] KVM: Call kvm_arch_vcpu_blocking early into the blocking sequence Marc Zyngier
2019-08-02 10:46 ` Paolo Bonzini [this message]
2019-08-18 17:53 ` Marc Zyngier
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=a7250b9a-60e9-b04c-5515-e506aea46515@redhat.com \
--to=pbonzini@redhat.com \
--cc=Suravee.Suthikulpanit@amd.com \
--cc=james.morse@arm.com \
--cc=joro@8bytes.org \
--cc=julien.thierry.kdev@gmail.com \
--cc=kvm@vger.kernel.org \
--cc=kvmarm@lists.cs.columbia.edu \
--cc=maz@kernel.org \
--cc=rkrcmar@redhat.com \
--cc=suzuki.poulose@arm.com \
--cc=tangnianyao@huawei.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).