All of lore.kernel.org
 help / color / mirror / Atom feed
From: Catalin Marinas <catalin.marinas@arm.com>
To: Peter Collingbourne <pcc@google.com>
Cc: Vincenzo Frascino <vincenzo.frascino@arm.com>,
	Will Deacon <will@kernel.org>,
	Andrey Konovalov <andreyknvl@gmail.com>,
	Evgenii Stepanov <eugenis@google.com>,
	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()
Date: Wed, 15 Sep 2021 18:59:48 +0100	[thread overview]
Message-ID: <YUI0lOmdabAfUtFV@arm.com> (raw)
In-Reply-To: <20210914215429.745849-1-pcc@google.com>

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 <pcc@google.com>
> 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

  parent reply	other threads:[~2021-09-15 18:01 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-14 21:54 [PATCH v2 1/2] arm64: add an MTE support check to the top of mte_thread_switch() Peter Collingbourne
2021-09-14 21:54 ` [PATCH v2 2/2] arm64: kasan: mte: move GCR_EL1 switch to task switch when KASAN disabled Peter Collingbourne
2021-09-15 17:59 ` Catalin Marinas [this message]
2021-09-15 19:04   ` [PATCH v2 1/2] arm64: add an MTE support check to the top of mte_thread_switch() Peter Collingbourne

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YUI0lOmdabAfUtFV@arm.com \
    --to=catalin.marinas@arm.com \
    --cc=andreyknvl@gmail.com \
    --cc=eugenis@google.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=pcc@google.com \
    --cc=vincenzo.frascino@arm.com \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.