linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Marc Zyngier <maz@kernel.org>
To: Joey Gouly <joey.gouly@arm.com>
Cc: <linux-arm-kernel@lists.infradead.org>,
	<kvmarm@lists.cs.columbia.edu>, <kvm@vger.kernel.org>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Will Deacon <will@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	James Morse <james.morse@arm.com>,
	Suzuki K Poulose <suzuki.poulose@arm.com>,
	"Alexandru\ Elisei" <alexandru.elisei@arm.com>,
	<kernel-team@android.com>, <nd@arm.com>
Subject: Re: [PATCH 06/10] KVM: arm64: Offer early resume for non-blocking WFxT instructions
Date: Wed, 13 Apr 2022 14:46:56 +0100	[thread overview]
Message-ID: <87a6cpayen.wl-maz@kernel.org> (raw)
In-Reply-To: <20220413113726.GA35565@e124191.cambridge.arm.com>

On Wed, 13 Apr 2022 12:37:26 +0100,
Joey Gouly <joey.gouly@arm.com> wrote:
> 
> Hi Marc,
> 
> On Tue, Apr 12, 2022 at 02:12:59PM +0100, Marc Zyngier wrote:
> > For WFxT instructions used with very small delays, it is not
> > unlikely that the deadling is already expired by the time we
> 
> typo: deadline
> 
> > reach the WFx handling code.
> > 
> > Check for this condition as soon as possible, and return to the
> > guest immediately if we can.
> > 
> > Signed-off-by: Marc Zyngier <maz@kernel.org>
> > ---
> >  arch/arm64/kvm/handle_exit.c | 25 ++++++++++++++++++++++---
> >  1 file changed, 22 insertions(+), 3 deletions(-)
> > 
> > diff --git a/arch/arm64/kvm/handle_exit.c b/arch/arm64/kvm/handle_exit.c
> > index 4260f2cd1971..87d9a36de860 100644
> > --- a/arch/arm64/kvm/handle_exit.c
> > +++ b/arch/arm64/kvm/handle_exit.c
> > @@ -80,17 +80,34 @@ static int handle_no_fpsimd(struct kvm_vcpu *vcpu)
> >   *
> >   * @vcpu:	the vcpu pointer
> >   *
> > - * WFE: Yield the CPU and come back to this vcpu when the scheduler
> > + * WFE[T]: Yield the CPU and come back to this vcpu when the scheduler
> >   * decides to.
> >   * WFI: Simply call kvm_vcpu_halt(), which will halt execution of
> >   * world-switches and schedule other host processes until there is an
> >   * incoming IRQ or FIQ to the VM.
> >   * WFIT: Same as WFI, with a timed wakeup implemented as a background timer
> > + *
> > + * WF{I,E}T can immediately return if the deadline has already expired.
> >   */
> >  static int kvm_handle_wfx(struct kvm_vcpu *vcpu)
> >  {
> >  	u64 esr = kvm_vcpu_get_esr(vcpu);
> >  
> > +	if (esr & ESR_ELx_WFx_ISS_WFxT) {
> > +		if (esr & ESR_ELx_WFx_ISS_RV) {
> > +			u64 val, now;
> > +
> > +			now = kvm_arm_timer_get_reg(vcpu, KVM_REG_ARM_TIMER_CNT);
> > +			val = vcpu_get_reg(vcpu, kvm_vcpu_sys_get_rt(vcpu));
> > +
> > +			if (now >= val)
> > +				goto out;
> 
> If this returns early, the trace_kvm_wfx and wfx_exit_stats below will not be
> called / updated. Is this intentional?

Good catch. No, it isn't. I'll hoist the stats/traces up to address
it.

Thanks,

	M.

-- 
Without deviation from the norm, progress is not possible.

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2022-04-13 13:48 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-12 13:12 [PATCH 00/10] arm64: Add initial support for FEAT_WFxT Marc Zyngier
2022-04-12 13:12 ` [PATCH 01/10] arm64: Expand ESR_ELx_WFx_ISS_TI to match its ARMv8.7 definition Marc Zyngier
2022-04-13 11:50   ` Joey Gouly
2022-04-12 13:12 ` [PATCH 02/10] arm64: Add RV and RN fields for ESR_ELx_WFx_ISS Marc Zyngier
2022-04-13 11:53   ` Joey Gouly
2022-04-12 13:12 ` [PATCH 03/10] KVM: arm64: Simplify kvm_cpu_has_pending_timer() Marc Zyngier
2022-04-12 13:12 ` [PATCH 04/10] KVM: arm64: Introduce kvm_counter_compute_delta() helper Marc Zyngier
2022-04-12 13:12 ` [PATCH 05/10] KVM: arm64: Handle blocking WFIT instruction Marc Zyngier
2022-04-12 13:12 ` [PATCH 06/10] KVM: arm64: Offer early resume for non-blocking WFxT instructions Marc Zyngier
2022-04-13 11:37   ` Joey Gouly
2022-04-13 13:46     ` Marc Zyngier [this message]
2022-04-12 13:13 ` [PATCH 07/10] KVM: arm64: Expose the WFXT feature to guests Marc Zyngier
2022-04-12 13:13 ` [PATCH 08/10] arm64: Add HWCAP advertising FEAT_WFXT Marc Zyngier
2022-04-12 13:13 ` [PATCH 09/10] arm64: Add wfet()/wfit() helpers Marc Zyngier
2022-04-12 13:13 ` [PATCH 10/10] arm64: Use WFxT for __delay() when possible 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=87a6cpayen.wl-maz@kernel.org \
    --to=maz@kernel.org \
    --cc=alexandru.elisei@arm.com \
    --cc=catalin.marinas@arm.com \
    --cc=james.morse@arm.com \
    --cc=joey.gouly@arm.com \
    --cc=kernel-team@android.com \
    --cc=kvm@vger.kernel.org \
    --cc=kvmarm@lists.cs.columbia.edu \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=mark.rutland@arm.com \
    --cc=nd@arm.com \
    --cc=suzuki.poulose@arm.com \
    --cc=will@kernel.org \
    /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).