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=-9.2 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,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 451C7C433E1 for ; Thu, 27 Aug 2020 12:17:37 +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 0C29922B40 for ; Thu, 27 Aug 2020 12:17:37 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="zU/xuRK2" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0C29922B40 Authentication-Results: mail.kernel.org; dmarc=none (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=c5w0gI+jr7J4+1CEwd6unhoKYZ009v84aqZHvvJhEK0=; b=zU/xuRK25GES22CdWkiM54ZUi tgA0KXyAQBVqjAPJ48iw7uvsjv7nVyOlCE6bLtQIXXJGBSEp37DZFh99Ih3neM43Eq110a2XfxPWc Y5xJ0SRJmv21ebTo4EzpFC2MPPMaSgZAcW0m5uRWKk6slsLzWTDQW7HR767tJNFRJGCloyGDAkbW9 IdVA2dOxVbsakneuOS7mTEGia8P1lFSYEAt33xKMR6egf2G53+nYqYKXsfaDyK0SX5jy1YGSY2GLY dOFkoMuErn1d9lz6lEfn2HpWc1fjWzsayRlZk6BJ13oHHppH+9nVYT4uhd1pZMdJMQexnUAARvdTA Xe7Smf6ZQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kBGpB-0003ga-GD; Thu, 27 Aug 2020 12:16:13 +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 1kBGp8-0003fn-CV for linux-arm-kernel@lists.infradead.org; Thu, 27 Aug 2020 12:16:11 +0000 Received: from gaia (unknown [46.69.195.127]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 1D0BA207CD; Thu, 27 Aug 2020 12:16:06 +0000 (UTC) Date: Thu, 27 Aug 2020 13:16:04 +0100 From: Catalin Marinas To: Vincenzo Frascino Subject: Re: [PATCH 24/35] arm64: mte: Switch GCR_EL1 in kernel entry and exit Message-ID: <20200827121604.GL29264@gaia> References: <20200827103819.GE29264@gaia> <8affcfbe-b8b4-0914-1651-368f669ddf85@arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <8affcfbe-b8b4-0914-1651-368f669ddf85@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-20200827_081610_529869_4E2ADB2C X-CRM114-Status: GOOD ( 23.03 ) 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: linux-arm-kernel@lists.infradead.org, Marco Elver , Elena Petrova , Andrey Konovalov , Kevin Brodsky , Will Deacon , Branislav Rankov , kasan-dev@googlegroups.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Alexander Potapenko , Evgenii Stepanov , Andrey Ryabinin , Andrew Morton , Dmitry Vyukov 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 Thu, Aug 27, 2020 at 11:56:49AM +0100, Vincenzo Frascino wrote: > On 8/27/20 11:38 AM, Catalin Marinas wrote: > > On Fri, Aug 14, 2020 at 07:27:06PM +0200, Andrey Konovalov wrote: > >> diff --git a/arch/arm64/kernel/mte.c b/arch/arm64/kernel/mte.c > >> index 7717ea9bc2a7..cfac7d02f032 100644 > >> --- a/arch/arm64/kernel/mte.c > >> +++ b/arch/arm64/kernel/mte.c > >> @@ -18,10 +18,14 @@ > >> > >> #include > >> #include > >> +#include > >> +#include > >> #include > >> #include > >> #include > >> > >> +u64 gcr_kernel_excl __read_mostly; > > > > Could we make this __ro_after_init? > > Yes, it makes sense, it should be updated only once through mte_init_tags(). > > Something to consider though here is that this might not be the right approach > if in future we want to add stack tagging. In such a case we need to know the > kernel exclude mask before any C code is executed. Initializing the mask via > mte_init_tags() it is too late. It depends on how stack tagging ends up in the kernel, whether it uses ADDG/SUBG or not. If it's only IRG, I think it can cope with changing the GCR_EL1.Excl in the middle of a function. > I was thinking to add a compilation define instead of having gcr_kernel_excl in > place. This might not work if the kernel excl mask is meant to change during the > execution. A macro with the default value works for me. That's what it basically is currently, only that it ends up in a variable. -- Catalin _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel