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 46FB8C433DB for ; Tue, 9 Feb 2021 17:29:30 +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 E002E64EA6 for ; Tue, 9 Feb 2021 17:29:29 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E002E64EA6 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=g3w94OHkfNCYRdswhruGvsVY/ZHGJQ0F2Zwo8XLDmys=; b=0bDrcsUCzYCMbz0+g4hl04rNJ rht2CcEiVgDYW0M2Ne0QZQ6p92UpmSFTs3QoltAO2xMTN3TlA86pU7veSnEWvAsY5xQu8u1ncZsP6 tEjD2sjCg+LfuJfPrPIeQYX8VpQNIoNC8Fa0SFStXecFGLc3iFbN/eygUDfRtuctwQFQ9dxAFgtKX q/GJs7/9wc/rX5vyyXUeQ91Y7UGDsFG+M//kJw5FRkP6uSrxnDHJUlem1k3+qKDgmCJE6/jmk/+yp tOrtMQyjR0fuyO9OJzCvD/LPcxQl7W83Hoit9X3CYOSczGSm8aRazdh2CFg06ZKL6VqV/jJdFNyNq Q5k16CvWg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l9WoR-0007Rp-10; Tue, 09 Feb 2021 17:28:31 +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 1l9WoO-0007RD-AC for linux-arm-kernel@lists.infradead.org; Tue, 09 Feb 2021 17:28:29 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id C72D964E9C; Tue, 9 Feb 2021 17:28:24 +0000 (UTC) Date: Tue, 9 Feb 2021 17:28:22 +0000 From: Catalin Marinas To: Lorenzo Pieralisi Subject: Re: [PATCH v12 6/7] arm64: mte: Save/Restore TFSR_EL1 during suspend Message-ID: <20210209172821.GI1435@arm.com> References: <20210208165617.9977-1-vincenzo.frascino@arm.com> <20210208165617.9977-7-vincenzo.frascino@arm.com> <20210209115533.GE1435@arm.com> <20210209143328.GA27791@e121166-lin.cambridge.arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20210209143328.GA27791@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-20210209_122828_472700_64F88AAF X-CRM114-Status: GOOD ( 27.28 ) 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 Tue, Feb 09, 2021 at 02:33:28PM +0000, Lorenzo Pieralisi wrote: > On Tue, Feb 09, 2021 at 11:55:33AM +0000, Catalin Marinas wrote: > > On Mon, Feb 08, 2021 at 04:56:16PM +0000, Vincenzo Frascino wrote: > > > When MTE async mode is enabled TFSR_EL1 contains the accumulative > > > asynchronous tag check faults for EL1 and EL0. > > > > > > During the suspend/resume operations the firmware might perform some > > > operations that could change the state of the register resulting in > > > a spurious tag check fault report. > > > > > > Save/restore the state of the TFSR_EL1 register during the > > > suspend/resume operations to prevent this to happen. > > > > Do we need a similar fix for TFSRE0_EL1? We get away with this if > > suspend is only entered on the idle (kernel) thread but I recall we > > could also enter suspend on behalf of a user process (I may be wrong > > though). > > Yes, when we suspend the machine to RAM, we execute suspend on behalf > on a userspace process (but that's only running on 1 cpu, the others > are hotplugged out). > > IIUC (and that's an if) TFSRE0_EL1 is checked on kernel entry so I don't > think there is a need to save/restore it (just reset it on suspend > exit). You are right, we don't check TFSRE0_EL1 on return to user, only clear it, so no need to do anything on suspend/resume. > TFSR_EL1, I don't see a point in saving/restoring it (it is a bit > per-CPU AFAICS) either, IMO we should "check" it on suspend (if it is > possible in that context) and reset it on resume. I think this should work. > I don't think though you can "check" with IRQs disabled so I suspect > that TFSR_EL1 has to be saved/restored (which means that there is a > black out period where we run kernel code without being able to detect > faults but there is no solution to that other than delaying saving the > value to just before calling into PSCI). Likewise on resume from low > power. It depends on whether kasan_report can be called with IRQs disabled. I don't see why not, so if this works I'd rather just call mte_check_async (or whatever it's called) on the suspend path and zero the register on resume (mte_suspend_exit). We avoid any saving of the state. -- Catalin _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel