From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D0D78C433EF for ; Wed, 13 Apr 2022 13:48:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Subject:Cc:To:From:Message-ID:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=cwUYWF9PyGmGHtYnQzqs9vILQtRshYyd0RrlqLw2OtM=; b=gm7YpAlXUez43d ziU3jUCcddeptTNtmrBMjVprEQASPlNqZDQm8phNwQavDy0gY8cw6QphEigQj3r2iA6W8wC00Vm4r e4IljxVuqyRGE84l54x++QnPRaV8exoXyxihwgE92IpfkFYFBMH9pM0GrTpy6WtFI4SNuxUUizZX0 tnr25ro1bxtCVShso7XSWb1sv4V29FLMfD/t68qYJHH+wv3fxjKzMYPtvqtbOylL+JjRjqKWe938o 6aRoosqxFlOIA3TQUn7Xh94gWpnKykvlcdRyzsT7CIi8cJhKhFtM1j1O6ABhtLw7OwZtRM3habGs+ bnXjKoATBfoDoZfBfbgA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nedKr-001Fkh-AF; Wed, 13 Apr 2022 13:47:05 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nedKn-001Fja-Nq for linux-arm-kernel@lists.infradead.org; Wed, 13 Apr 2022 13:47:03 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 6A5ED61943; Wed, 13 Apr 2022 13:47:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BF745C385A4; Wed, 13 Apr 2022 13:46:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1649857619; bh=i5lzFw1ROF9MKAhGCUIV1AVoLWPXDmxI34tlOG7J/Hc=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=iAvDaW4ezj9xNtK7nEzufIn55UE2kDKlKfE4KO2a1VzzayMvagY/j+o8p10DXwdYb EOHyr/ULZI2DhjO6bYaZfD+U/o0dwLjrM5TB9JysMhuxjavq37x2YBplHLOZYATRbt Mn2HvsmxwuDAjFbYyxpFQ6eS6u51HL+hq29cqlAKyrhbxSqV1oAjnEz3pp/N53Iq6R jCZWmZiaCwbopygkQ4LUe+lwK4y+uW4+s6LOcHox9ylSC6IeIsXsD/UOFp7W51byIY EDt76YLrZbILfYikWIYcGwtjySal1fTD81brAvMTne9Coq4gbKYnCLjFdcYOYydX5J oey3jK9niEbVA== Received: from sofa.misterjones.org ([185.219.108.64] helo=why.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1nedKj-0043Ek-5h; Wed, 13 Apr 2022 14:46:57 +0100 Date: Wed, 13 Apr 2022 14:46:56 +0100 Message-ID: <87a6cpayen.wl-maz@kernel.org> From: Marc Zyngier To: Joey Gouly Cc: , , , Catalin Marinas , Will Deacon , Mark Rutland , James Morse , Suzuki K Poulose , "Alexandru\ Elisei" , , Subject: Re: [PATCH 06/10] KVM: arm64: Offer early resume for non-blocking WFxT instructions In-Reply-To: <20220413113726.GA35565@e124191.cambridge.arm.com> References: <20220412131303.504690-1-maz@kernel.org> <20220412131303.504690-7-maz@kernel.org> <20220413113726.GA35565@e124191.cambridge.arm.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/27.1 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: joey.gouly@arm.com, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, catalin.marinas@arm.com, will@kernel.org, mark.rutland@arm.com, james.morse@arm.com, suzuki.poulose@arm.com, alexandru.elisei@arm.com, kernel-team@android.com, nd@arm.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220413_064701_888610_902FD6A7 X-CRM114-Status: GOOD ( 30.23 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, 13 Apr 2022 12:37:26 +0100, Joey Gouly 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 > > --- > > 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