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=-10.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham 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 794EDC433B4 for ; Fri, 9 Apr 2021 14:49:36 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (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 17EAF61041 for ; Fri, 9 Apr 2021 14:49:36 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 17EAF61041 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=desiato.20200630; 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=eI7BOqXeFHUlFmUUDc4mmABNMi+zt0MhObcOBWiS+f0=; b=WaE4GhzpicR8AFOgYyOBL5CV/ WCRrPK29hQi5yMc99vmu9TZdCxCEM1miM71CErjfNPN7+pbOKaATlYBoTq1Y7hJZe7ecB3JfYKh+y 3THAEf5Xwr4UhY7Xzr32RdHHPPZHlWPsHR4lqpn1OAocaBsx5Eo+N71QGiu4iRHTsu3RWBxhU3YmY xusZ2vtpYUAdCTMOwzf/8vouPkRtI2I05toVrOuaOhsgh1a2m+EgaD1BI6JJOahee7AIcVtbKpxtT dkEgRTTEDjW15SKHDYYTGLaDlVvZs39BcmfdzdDKftVqvpbYrK1olwE04PczKEFLaASJ7OCRQdFXo gOi+7XpLA==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lUsQH-000wwa-M4; Fri, 09 Apr 2021 14:47:49 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lUsQE-000wwO-7I for linux-arm-kernel@desiato.infradead.org; Fri, 09 Apr 2021 14:47:46 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=oRh416PNzI2PZEXFBtYAA+fhYGm9TwWVvbjFwk9VVBo=; b=JwR21+FQB7iQtahMQMzTH5t+DW pW0yr3XbBvZ4Xq60b5RrrkotxyXlaqpDFBU0C3kVH8FBwTu58tm4Pdh78K3FsH2vl+ifWSvLdKKgQ HFmqeQI21zS6f+0sem7pFINUdHfk0lK0vFNMUFujGBbc2XBWef0Z53zrlDXbPOPwoz5t+8DmwYmB5 fdjU0ff0WXl/IUfqRkrutj+/ATOrKFeaZZ8HALOtW+/mz/e4YWyEyo0YCc20UX4u9IVY4h1QfUJlU E3KLUbqCTgErgtkcEr7T2rtJHrA3z0Sp6+COlYKOwoVT6TecTP7sfNML60lMkzigJm4pFHr3Grw6J VHqutWPw==; Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lUsQB-004bEV-Ew for linux-arm-kernel@lists.infradead.org; Fri, 09 Apr 2021 14:47:45 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 895DD610D0; Fri, 9 Apr 2021 14:47:41 +0000 (UTC) Date: Fri, 9 Apr 2021 15:47:39 +0100 From: Catalin Marinas To: Vincenzo Frascino Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, kasan-dev@googlegroups.com, Will Deacon , stable@vger.kernel.org Subject: Re: [PATCH v3] arm64: mte: Move MTE TCF0 check in entry-common Message-ID: <20210409144738.GB24031@arm.com> References: <20210409132419.29965-1-vincenzo.frascino@arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20210409132419.29965-1-vincenzo.frascino@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-20210409_074743_539510_FF061A6B X-CRM114-Status: GOOD ( 19.10 ) 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 Fri, Apr 09, 2021 at 02:24:19PM +0100, Vincenzo Frascino wrote: > diff --git a/arch/arm64/kernel/mte.c b/arch/arm64/kernel/mte.c > index b3c70a612c7a..84a942c25870 100644 > --- a/arch/arm64/kernel/mte.c > +++ b/arch/arm64/kernel/mte.c > @@ -166,14 +166,43 @@ static void set_gcr_el1_excl(u64 excl) > */ > } > > -void flush_mte_state(void) > +void noinstr check_mte_async_tcf0(void) Nitpick: it looks like naming isn't be entirely consistent with your kernel async patches: https://lore.kernel.org/linux-arm-kernel/20210315132019.33202-8-vincenzo.frascino@arm.com/ You could name them mte_check_tfsre0_el1() etc. Also make sure they are called in similar places in both series. > +{ > + u64 tcf0; > + > + if (!system_supports_mte()) > + return; > + > + /* > + * dsb(ish) is not required before the register read > + * because the TFSRE0_EL1 is automatically synchronized > + * by the hardware on exception entry as SCTLR_EL1.ITFSB > + * is set. > + */ > + tcf0 = read_sysreg_s(SYS_TFSRE0_EL1); > + > + if (tcf0 & SYS_TFSR_EL1_TF0) > + set_thread_flag(TIF_MTE_ASYNC_FAULT); > + > + write_sysreg_s(0, SYS_TFSRE0_EL1); Please move the write_sysreg() inside the 'if' block. If it was 0, there's no point in a potentially more expensive write. That said, we only check TFSRE0_EL1 on entry from EL0. Is there a point in clearing it before we return to EL0? Uaccess routines may set it anyway. > +} > + > +void noinstr clear_mte_async_tcf0(void) > { > if (!system_supports_mte()) > return; > > - /* clear any pending asynchronous tag fault */ > dsb(ish); > write_sysreg_s(0, SYS_TFSRE0_EL1); > +} I think Mark suggested on your first version that we should keep these functions in mte.h so that they can be inlined. They are small and only called in one or two places. -- Catalin _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel