From mboxrd@z Thu Jan 1 00:00:00 1970 From: Catalin Marinas Subject: Re: [PATCH] arm64: mte: Clear SCTLR_EL1.TCF0 on exec Date: Wed, 12 Feb 2020 17:03:50 +0000 Message-ID: <20200212170350.GB587247@arrakis.emea.arm.com> References: <20191220014853.223389-1-pcc@google.com> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Return-path: Received: from foss.arm.com ([217.140.110.172]:35314 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726728AbgBLRDz (ORCPT ); Wed, 12 Feb 2020 12:03:55 -0500 Content-Disposition: inline In-Reply-To: <20191220014853.223389-1-pcc@google.com> Sender: linux-arch-owner@vger.kernel.org List-ID: To: Peter Collingbourne Cc: Evgenii Stepanov , Kostya Serebryany , Linux ARM , linux-arch@vger.kernel.org, Richard Earnshaw , Szabolcs Nagy , Marc Zyngier , Kevin Brodsky , linux-mm@kvack.org, Andrey Konovalov , Vincenzo Frascino , Will Deacon On Thu, Dec 19, 2019 at 05:48:53PM -0800, Peter Collingbourne wrote: > On Thu, Dec 19, 2019 at 12:32 PM Peter Collingbourne wrote: > > On Wed, Dec 11, 2019 at 10:45 AM Catalin Marinas > > wrote: > > > +       if (current->thread.sctlr_tcf0 != next->thread.sctlr_tcf0) > > > +               update_sctlr_el1_tcf0(next->thread.sctlr_tcf0); > > > > I don't entirely understand why yet, but I've found that this check is > > insufficient for ensuring consistency between SCTLR_EL1.TCF0 and > > sctlr_tcf0. In my Android test environment with some processes having > > sctlr_tcf0=SCTLR_EL1_TCF0_SYNC and others having sctlr_tcf0=0, I am > > seeing intermittent tag failures coming from the sctlr_tcf0=0 > > processes. With this patch: [...] > > Since sysreg_clear_set only sets the sysreg if it ended up changing, I > > wouldn't expect this to cause a significant performance hit unless > > just reading SCTLR_EL1 is expensive. That being said, if the > > inconsistency is indicative of a deeper problem, we should probably > > address that. > > I tracked it down to the flush_mte_state() function setting sctlr_tcf0 but > failing to update SCTLR_EL1.TCF0. With this patch I am not seeing any more > inconsistencies. Thanks Peter. I folded in your fix. -- Catalin