Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2931951pxb; Fri, 12 Feb 2021 05:22:08 -0800 (PST) X-Google-Smtp-Source: ABdhPJwdF/2kTHR3xYqmsfAPg6wSCojqmQPE7Js3OCWLST3L+mWBrNqakENS1N9WnHXDVO+R/ETA X-Received: by 2002:a05:6402:3198:: with SMTP id di24mr3320756edb.340.1613136128106; Fri, 12 Feb 2021 05:22:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613136128; cv=none; d=google.com; s=arc-20160816; b=ssIsL8vwFNPxSWbSiAC15cKyWMp+EGX9Zs4e0H2hr74oJfM99FLMeY0V6wnNqspGpd n1zDKmj3leXXkZfDDW01QAaKeXeh5IH6bt4naLtXc+G9q9wwe/OVOISLiw4d3dElvqNI iusLZLwyz6JYm7WGTGb3YlMpQdGK0qc8kWMQRVPUMmm3DQu2Iz+hsZBQZOp5bZ92Fny+ j8ZmmspoB/cbIn64WYqx7T04AMbgKTxQokOG4KcMk2vsp0vo/7ZTgcbZphp9t4/saOpi DGhaJbmGCK8xEcS/wORSTukywhPHop0ddoEwQ+Q7delMSx2B29Zsl79l2hGOWRW+YjsW 2KcA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=qAlFUFyppuD/ZizOk/EjjXiFxAJkVe5koEsRVfvz8vI=; b=i2/kifHIUKArUTt0zvc7Jt8kMDXmgk0IHkGRfZQULx0Da6g13GRu3xAK2KRrEP/H8f wWQjhoRiES2gbpyD8ykEeo+pv6ATFueLSHhRNzDn+UxJq+9ZyUeWuATVaXXA7JxvC6Nj B0012H373CNCM1+dz7Xd16kjhbORPMSx308vx1GJGnhCIV0dGbw7ijFdqHzRH18ybRkJ KYcaWVIqqXewPhROiSifqOmtwg5n9Xq40naYX2TJ2tZW3k4ijXQZlju6y/KXnlFQvybI WNiFwo/wnJk52fPDFesZngVAA6O43lR2o+Td/rCAjtv+Jfz6ihXrhCeex5Jerbe7o3fB C+Lg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t15si6414917edc.372.2021.02.12.05.21.43; Fri, 12 Feb 2021 05:22:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231391AbhBLNUi (ORCPT + 99 others); Fri, 12 Feb 2021 08:20:38 -0500 Received: from mail.kernel.org ([198.145.29.99]:34558 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231311AbhBLNUa (ORCPT ); Fri, 12 Feb 2021 08:20:30 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 1457064DBA; Fri, 12 Feb 2021 13:19:46 +0000 (UTC) Date: Fri, 12 Feb 2021 13:19:44 +0000 From: Catalin Marinas To: Lorenzo Pieralisi Cc: Vincenzo Frascino , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, kasan-dev@googlegroups.com, Andrew Morton , Will Deacon , Dmitry Vyukov , Andrey Ryabinin , Alexander Potapenko , Marco Elver , Evgenii Stepanov , Branislav Rankov , Andrey Konovalov Subject: Re: [PATCH v13 6/7] arm64: mte: Report async tag faults before suspend Message-ID: <20210212131944.GB7718@arm.com> References: <20210211153353.29094-1-vincenzo.frascino@arm.com> <20210211153353.29094-7-vincenzo.frascino@arm.com> <20210212120015.GA18281@e121166-lin.cambridge.arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210212120015.GA18281@e121166-lin.cambridge.arm.com> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Feb 12, 2021 at 12:00:15PM +0000, Lorenzo Pieralisi wrote: > On Thu, Feb 11, 2021 at 03:33:52PM +0000, Vincenzo Frascino wrote: > > +void mte_suspend_enter(void) > > +{ > > + if (!system_supports_mte()) > > + return; > > + > > + /* > > + * The barriers are required to guarantee that the indirect writes > > + * to TFSR_EL1 are synchronized before we report the state. > > + */ > > + dsb(nsh); > > + isb(); > > + > > + /* Report SYS_TFSR_EL1 before suspend entry */ > > + mte_check_tfsr_el1(); > > +} > > + > > void mte_suspend_exit(void) > > { > > if (!system_supports_mte()) > > return; > > > > update_gcr_el1_excl(gcr_kernel_excl); > > + > > + /* Clear SYS_TFSR_EL1 after suspend exit */ > > + write_sysreg_s(0, SYS_TFSR_EL1); > > AFAICS it is not needed, it is done already in __cpu_setup() (that is > called by cpu_resume on return from cpu_suspend() from firmware). > > However, I have a question. We are relying on context switch to set > sctlr_el1_tfc0 right ? If that's the case, till the thread resuming from > low power switches context we are running with SCTLR_EL1_TCF0 not > reflecting the actual value. I think you have a point here, though not for SCTLR_EL1 as it is already restored. GCR_EL1 is only updated after some C code has run and may mess up stack tagging when/if we ever support it. Anyway, something to worry about later, I think even the boot path gets this wrong. -- Catalin