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 ED011C433FE for ; Thu, 17 Feb 2022 13:45:54 +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-Type: Content-Transfer-Encoding:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:Message-ID:References:In-Reply-To:Subject:Cc:To:From :Date:MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=kZyOSSkIb1k5VWtfiyFhFaQiqbFkCDRRxGpQUDY1LU4=; b=dGXLJVvZlkKjrKp58DB/WoUBTq W0I1snxuB/huCYUg3O1rR2IEaSmJtMmcnmwqd2X2juGiLB5vNc+pB+5iix0E+hFsql7eHiVvDgN4G i3RBYGau7NloKbWw4ZLEQRKhSKPbN+20KLCWWbdZ92eVl+62vDgJl0HWpL89cTwo6MVNBRfNVkI3w x/KvvAnNL2TxCPguvdyOFv/5gKnogbEQbusBplKilNnTMG1jWdS69cRhi7LHXNR7aJ1VRHgQXtw4s 3CJ34TD8UG7Pi9J1Z1iDdCA2vIhRA6SH2FOT7kMTi4FUxBEYAhwlojSwq0w37kd4gaZaYsK79jUcM TiwjuLzQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nKh59-00Ahm0-IY; Thu, 17 Feb 2022 13:44:27 +0000 Received: from ams.source.kernel.org ([145.40.68.75]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nKh1m-00AfbZ-GI for linux-arm-kernel@lists.infradead.org; Thu, 17 Feb 2022 13:41:00 +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 ams.source.kernel.org (Postfix) with ESMTPS id 2FB65B8212B; Thu, 17 Feb 2022 13:40:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D4782C340E9; Thu, 17 Feb 2022 13:40:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1645105255; bh=Ss67S13WIbOTQNO32Um4TEuBFG3UFPz44UqCkkF0YeY=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=tNXUrNV6GCVRn8Exm/tkHGSQNU2vydVaAUyZUS4vmCWuVjZSKfQgFNoktfJ0yncsC wNjmdHax6vkMTfzCSQiVAXfhQN4hFOJ+ddKZwLCBKqtnqug/N1GNd/7UDPTkrqjDOP 1NJ+wpj+kiIan6fWo+4irQpE2/THtRLB3VQ3d40wNA+EETfw+1pCg9/q2tSMF/v2fX omlbfcmxXlVFxvI5cfyhiPFGlOJIfjufhhlVsZ+vwbV+4+jcrr7ch2xSmBthbPx6Cr 0Qe7O57eRV9tqgTfcxmZoLId0d+ZYasoidhx6mwm6+DcPcg6kgu+tcwqVKSN+iNIaL uZ+CYoBONIcUA== Received: from disco-boy.misterjones.org ([51.254.78.96] helo=www.loen.fr) 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 1nKh1h-008a8W-Hp; Thu, 17 Feb 2022 13:40:53 +0000 MIME-Version: 1.0 Date: Thu, 17 Feb 2022 13:40:53 +0000 From: Marc Zyngier To: Oliver Upton Cc: kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, James Morse , Alexandru Elisei , Suzuki K Poulose , linux-arm-kernel@lists.infradead.org, Peter Shier , Ricardo Koller , Reiji Watanabe , Paolo Bonzini , Sean Christopherson Subject: Re: [PATCH] KVM: arm64: Don't miss pending interrupts for suspended vCPU In-Reply-To: <20220217101242.3013716-1-oupton@google.com> References: <20220217101242.3013716-1-oupton@google.com> User-Agent: Roundcube Webmail/1.4.13 Message-ID: X-Sender: maz@kernel.org X-SA-Exim-Connect-IP: 51.254.78.96 X-SA-Exim-Rcpt-To: oupton@google.com, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, james.morse@arm.com, alexandru.elisei@arm.com, suzuki.poulose@arm.com, linux-arm-kernel@lists.infradead.org, pshier@google.com, ricarkol@google.com, reijiw@google.com, pbonzini@redhat.com, seanjc@google.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-20220217_054058_961087_F00E1D77 X-CRM114-Status: GOOD ( 20.03 ) 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-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 2022-02-17 10:12, Oliver Upton wrote: > In order to properly emulate the WFI instruction, KVM reads back > ICH_VMCR_EL2 and enables doorbells for GICv4. These preparations are > necessary in order to recognize pending interrupts in > kvm_arch_vcpu_runnable() and return to the guest. Until recently, this > work was done by kvm_arch_vcpu_{blocking,unblocking}(). Since commit > 6109c5a6ab7f ("KVM: arm64: Move vGIC v4 handling for WFI out arch > callback hook"), these callbacks were gutted and superseded by > kvm_vcpu_wfi(). > > It is important to note that KVM implements PSCI CPU_SUSPEND calls as > a WFI within the guest. However, the implementation calls directly into > kvm_vcpu_halt(), which skips the needed work done in kvm_vcpu_wfi() > to detect pending interrupts. Fix the issue by calling the WFI helper. > > Fixes: 6109c5a6ab7f ("KVM: arm64: Move vGIC v4 handling for WFI out > arch callback hook") > Signed-off-by: Oliver Upton > --- > arch/arm64/kvm/psci.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/arch/arm64/kvm/psci.c b/arch/arm64/kvm/psci.c > index 3eae32876897..2ce60fecd861 100644 > --- a/arch/arm64/kvm/psci.c > +++ b/arch/arm64/kvm/psci.c > @@ -46,8 +46,7 @@ static unsigned long kvm_psci_vcpu_suspend(struct > kvm_vcpu *vcpu) > * specification (ARM DEN 0022A). This means all suspend states > * for KVM will preserve the register state. > */ > - kvm_vcpu_halt(vcpu); > - kvm_clear_request(KVM_REQ_UNHALT, vcpu); > + kvm_vcpu_wfi(vcpu); > > return PSCI_RET_SUCCESS; > } Thanks for picking this up, I kept forgetting about fixing it. I'll merge it once I'm back home. M. -- Jazz is not dead. It just smells funny... _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel