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=-14.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 397EAC433FE for ; Wed, 15 Sep 2021 18:01:26 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id F2D22610E9 for ; Wed, 15 Sep 2021 18:01:25 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org F2D22610E9 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org 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=PqvMu4smKakleW27IljFZV0Iqz8vn2RHMYIorAJR85o=; b=KNBN/YY3SzZlAp IvnkzVV1AM8WIiSjNYop7/GR2YJIJDS3oIC8NkbrYzLG/ZlEFuR6GibHLZARvmmP8fovEUjv+R75b h6B/g7vsDHoCEQKhQoFv9g4cir5Y9to7iPKZ+lhgdqIFPzl1v6DVn6Uk0k5P5I9Oe3hY1XuaXNsp+ 5UfxN6uoIRb9d2FG1vnQ5A+jrGnHHxez6EhDDm475tyINtCQBaMdGn4ggHNUo4+T2KOJzZXjOg7x8 uPngMS1aGqs3m1vcmU1QDx2zByDKmj8BzLaWJm57au5giHGJ/FdCnJK/KWReDwKAn1s4Vp8Gqqnyw XUHEVN9K5jjn+kFLDucw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mQZCQ-009fT2-1R; Wed, 15 Sep 2021 17:59:58 +0000 Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mQZCL-009fRl-Hu for linux-arm-kernel@lists.infradead.org; Wed, 15 Sep 2021 17:59:55 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id A495961130; Wed, 15 Sep 2021 17:59:51 +0000 (UTC) Date: Wed, 15 Sep 2021 18:59:48 +0100 From: Catalin Marinas To: Peter Collingbourne Cc: Vincenzo Frascino , Will Deacon , Andrey Konovalov , Evgenii Stepanov , linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH v2 1/2] arm64: add an MTE support check to the top of mte_thread_switch() Message-ID: References: <20210914215429.745849-1-pcc@google.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20210914215429.745849-1-pcc@google.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210915_105953_651268_3B9BEB81 X-CRM114-Status: GOOD ( 18.48 ) 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 Tue, Sep 14, 2021 at 02:54:28PM -0700, Peter Collingbourne wrote: > This lets us avoid doing unnecessary work on hardware that does > not support MTE, and will allow us to freely use MTE instructions > in the code called by mte_thread_switch(). > > Signed-off-by: Peter Collingbourne > Link: https://linux-review.googlesource.com/id/I02fd000d1ef2c86c7d2952a7f099b254ec227a5d > --- > arch/arm64/kernel/mte.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/arch/arm64/kernel/mte.c b/arch/arm64/kernel/mte.c > index 9d314a3bad3b..8fc2d90eeb00 100644 > --- a/arch/arm64/kernel/mte.c > +++ b/arch/arm64/kernel/mte.c > @@ -199,6 +199,9 @@ void mte_thread_init_user(void) > > void mte_thread_switch(struct task_struct *next) > { > + if (!system_supports_mte()) > + return; > + > mte_update_sctlr_user(next); Ah, good point. While you are at this, could you please remove the system_supports_mte() check from mte_check_tfsr_el1() and add it to mte_check_tfsr_entry/exit? On the exit path, we unnecessarily do a dsb+isb even when MTE is not present. I guess we could also skip the tfsr_el1 check if !system_uses_mte_async_mode() (well, I'd need to page in which TFSR bits are set for uaccess). Thanks. -- Catalin _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel