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 24258C7EE23 for ; Thu, 8 Jun 2023 15:51:56 +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:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=nEaL+Q0MqoV7/vRgwseQ4au9dAAKrFV0O9MeatwhLV0=; b=MdpRLgfBGYDCOK ncDAE1yQgoRfqQegaSKt7j/Pb9dRx9/Oj/mGMa0WR4LFHQe9l05q4BkZYYhPsSnkAI1+84etylYv2 0lUFvA8EITsaRkGaHmIUYEuXrMUe0MgD77qN4Ivj4nK8vK9zVpxEdryiSxejxPjOxunqot5MB+TGt vjMDT1R62HAmYSsIV79sFXFNeK+C1CsJ1vZe5hhsWL46tKdNGOMzZC2uo7xgqImpNnRJnS7jn12Mr OR7iCNTMp676nrsD0v2kRQhT6IRwKr/i9VmFgHvZkZgwGCgtuoQGuqxMbX/S13a6omIf4z3qECChZ ury5KcJEsTHO4DASpALg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1q7HvD-009n4W-1h; Thu, 08 Jun 2023 15:51:35 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1q7HvA-009n3n-16 for linux-arm-kernel@lists.infradead.org; Thu, 08 Jun 2023 15:51:33 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 9E293AB6; Thu, 8 Jun 2023 08:52:15 -0700 (PDT) Received: from FVFF77S0Q05N (unknown [10.57.24.103]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id CBE463F587; Thu, 8 Jun 2023 08:51:28 -0700 (PDT) Date: Thu, 8 Jun 2023 16:51:26 +0100 From: Mark Rutland To: Mark Brown Cc: Catalin Marinas , Will Deacon , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Anders Roxell , Naresh Kamboju Subject: Re: [PATCH] arm64/fpsimd: Exit streaming mode when flushing tasks Message-ID: References: <20230607-arm64-flush-svcr-v1-1-7821a6199e0a@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20230607-arm64-flush-svcr-v1-1-7821a6199e0a@kernel.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230608_085132_424222_8731B94C X-CRM114-Status: GOOD ( 19.14 ) 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, Jun 07, 2023 at 09:30:51PM +0100, Mark Brown wrote: > Ensure there is no path where we might attempt to save SME state after we > flush a task by updating the SVCR register state as well as updating our > in memory state. I haven't seen a specific case where this is happening or > seen a path where it might happen but for the cost of a single low overhead > instruction it seems sensible to close the potential gap. > > Signed-off-by: Mark Brown > --- > arch/arm64/kernel/fpsimd.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/arch/arm64/kernel/fpsimd.c b/arch/arm64/kernel/fpsimd.c > index 2fbafa5cc7ac..1627e0efe39a 100644 > --- a/arch/arm64/kernel/fpsimd.c > +++ b/arch/arm64/kernel/fpsimd.c > @@ -1649,6 +1649,7 @@ void fpsimd_flush_thread(void) > > fpsimd_flush_thread_vl(ARM64_VEC_SME); > current->thread.svcr = 0; > + sme_smstop_sm(); I don't think we should blindly do this if we never expect to get here in that state; this is just going to mask bugs and make them harder to debug going forwards. If we need this, it'd be better to have something like: if (WARN_ON_ONCE(sme_is_in_streaming_mode())) sme_smstop_sm(); ... so that we can identify this case and fix it. Thanks, Mark. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel