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 X-Spam-Level: X-Spam-Status: No, score=-5.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3AEF5C433E9 for ; Fri, 12 Feb 2021 13:21:40 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C462564E57 for ; Fri, 12 Feb 2021 13:21:39 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C462564E57 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject: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=LIE/i0OhOXsvRcrYxTBvwdDHwRkwmsxMK+wfh2SXvic=; b=nGMo42bMtN4pM2uQ6Cs4EerLK fozHtgSBLeuoxRGPZfLaiyPLbZTe+MakFk0XD790T+8mtWRwn9wEdmcXH1elPg0QUkNbD2zBMmc1a qJo4x3E+xV5qR3rZ4oZzvhksQhPF+4cLw8un1z3PCu3D5YlMZ0McAShSCyfG7DpqZf7hREQJ+yy7+ waH8jOjkHvhLjm1iVkdjQ4UY323yJHNH2VWGhVXHtSnyk+838HHbWIwd1BGPIElnUZNQRpdHtihDo HnosLcFAkwTUCotueNVpuHKoeUQS1LQwKClOxYGm5I5KwgA9a+goB/isgxBV9tOjHP8hZtB6kND7s D6gQG742A==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1lAYMV-0002JZ-GY; Fri, 12 Feb 2021 13:19:56 +0000 Received: from mail.kernel.org ([198.145.29.99]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1lAYMQ-0002IU-21 for linux-arm-kernel@lists.infradead.org; Fri, 12 Feb 2021 13:19:51 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 1457064DBA; Fri, 12 Feb 2021 13:19:46 +0000 (UTC) Date: Fri, 12 Feb 2021 13:19:44 +0000 From: Catalin Marinas To: Lorenzo Pieralisi Subject: Re: [PATCH v13 6/7] arm64: mte: Report async tag faults before suspend Message-ID: <20210212131944.GB7718@arm.com> References: <20210211153353.29094-1-vincenzo.frascino@arm.com> <20210211153353.29094-7-vincenzo.frascino@arm.com> <20210212120015.GA18281@e121166-lin.cambridge.arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20210212120015.GA18281@e121166-lin.cambridge.arm.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210212_081950_268783_5C2C58D3 X-CRM114-Status: GOOD ( 16.87 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Branislav Rankov , Marco Elver , Andrey Konovalov , Evgenii Stepanov , linux-kernel@vger.kernel.org, kasan-dev@googlegroups.com, Alexander Potapenko , Dmitry Vyukov , Andrey Ryabinin , Andrew Morton , Vincenzo Frascino , Will Deacon , linux-arm-kernel@lists.infradead.org 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 Fri, Feb 12, 2021 at 12:00:15PM +0000, Lorenzo Pieralisi wrote: > On Thu, Feb 11, 2021 at 03:33:52PM +0000, Vincenzo Frascino wrote: > > +void mte_suspend_enter(void) > > +{ > > + if (!system_supports_mte()) > > + return; > > + > > + /* > > + * The barriers are required to guarantee that the indirect writes > > + * to TFSR_EL1 are synchronized before we report the state. > > + */ > > + dsb(nsh); > > + isb(); > > + > > + /* Report SYS_TFSR_EL1 before suspend entry */ > > + mte_check_tfsr_el1(); > > +} > > + > > void mte_suspend_exit(void) > > { > > if (!system_supports_mte()) > > return; > > > > update_gcr_el1_excl(gcr_kernel_excl); > > + > > + /* Clear SYS_TFSR_EL1 after suspend exit */ > > + write_sysreg_s(0, SYS_TFSR_EL1); > > AFAICS it is not needed, it is done already in __cpu_setup() (that is > called by cpu_resume on return from cpu_suspend() from firmware). > > However, I have a question. We are relying on context switch to set > sctlr_el1_tfc0 right ? If that's the case, till the thread resuming from > low power switches context we are running with SCTLR_EL1_TCF0 not > reflecting the actual value. I think you have a point here, though not for SCTLR_EL1 as it is already restored. GCR_EL1 is only updated after some C code has run and may mess up stack tagging when/if we ever support it. Anyway, something to worry about later, I think even the boot path gets this wrong. -- Catalin _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel