public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: Will Deacon <will@kernel.org>
To: Peter Collingbourne <pcc@google.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>,
	Vincenzo Frascino <vincenzo.frascino@arm.com>,
	Andrey Konovalov <andreyknvl@gmail.com>,
	Mark Rutland <mark.rutland@arm.com>,
	Evgenii Stepanov <eugenis@google.com>,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v4] arm64: mte: avoid clearing PSTATE.TCO on entry unless necessary
Date: Tue, 15 Feb 2022 22:51:53 +0000	[thread overview]
Message-ID: <20220215225152.GA9229@willie-the-truck> (raw)
In-Reply-To: <20220125005850.2500784-1-pcc@google.com>

On Mon, Jan 24, 2022 at 04:58:50PM -0800, Peter Collingbourne wrote:
> On some microarchitectures, clearing PSTATE.TCO is expensive. Clearing
> TCO is only necessary if in-kernel MTE is enabled, or if MTE is
> enabled in the userspace process in synchronous (or, soon, asymmetric)
> mode, because we do not report uaccess faults to userspace in none
> or asynchronous modes. Therefore, adjust the kernel entry code to
> clear TCO only if necessary.
> 
> Because it is now possible to switch to a task in which TCO needs to
> be clear from a task in which TCO is set, we also need to do the same
> thing on task switch.
> 
> Signed-off-by: Peter Collingbourne <pcc@google.com>
> Link: https://linux-review.googlesource.com/id/I52d82a580bd0500d420be501af2c35fa8c90729e
> Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
> ---
> v4:
> - some changes suggested by Catalin
> 
> v3:
> - switch to a C implementation
> 
> v2:
> - do the same thing in cpu_switch_to()
> 
>  arch/arm64/include/asm/mte.h     | 22 ++++++++++++++++++++++
>  arch/arm64/kernel/entry-common.c |  3 +++
>  arch/arm64/kernel/entry.S        |  7 -------
>  arch/arm64/kernel/mte.c          |  3 +++
>  4 files changed, 28 insertions(+), 7 deletions(-)

I applied this, but it broke the 'allmodconfig' build so I had to drop it:

 | In file included from ./arch/arm64/include/asm/pgtable.h:12,
 |                  from ./include/linux/pgtable.h:6,
 |                  from ./include/linux/kasan.h:30,
 |                  from ./include/linux/slab.h:136,
 |                  from ./include/linux/resource_ext.h:11,
 |                  from ./include/linux/acpi.h:14,
 |                  from ./include/acpi/apei.h:9,
 |                  from ./include/acpi/ghes.h:5,
 |                  from ./include/linux/arm_sdei.h:8,
 |                  from arch/arm64/kernel/asm-offsets.c:10:
 | ./arch/arm64/include/asm/mte.h: In function ‘mte_disable_tco_entry’:
 | ./arch/arm64/include/asm/mte.h:106:6: error: implicit declaration of function ‘kasan_hw_tags_enabled’ [-Werror=implicit-function-declaration]
 |   106 |  if (kasan_hw_tags_enabled() ||
 |       |      ^~~~~~~~~~~~~~~~~~~~~
 | In file included from ./include/linux/slab.h:136,
 |                  from ./include/linux/resource_ext.h:11,
 |                  from ./include/linux/acpi.h:14,
 |                  from ./include/acpi/apei.h:9,
 |                  from ./include/acpi/ghes.h:5,
 |                  from ./include/linux/arm_sdei.h:8,
 |                  from arch/arm64/kernel/asm-offsets.c:10:
 | ./include/linux/kasan.h: At top level:
 | ./include/linux/kasan.h:108:20: error: conflicting types for ‘kasan_hw_tags_enabled’
 |   108 | static inline bool kasan_hw_tags_enabled(void)
 |       |                    ^~~~~~~~~~~~~~~~~~~~~
 | In file included from ./arch/arm64/include/asm/pgtable.h:12,
 |                  from ./include/linux/pgtable.h:6,
 |                  from ./include/linux/kasan.h:30,
 |                  from ./include/linux/slab.h:136,
 |                  from ./include/linux/resource_ext.h:11,
 |                  from ./include/linux/acpi.h:14,
 |                  from ./include/acpi/apei.h:9,
 |                  from ./include/acpi/ghes.h:5,
 |                  from ./include/linux/arm_sdei.h:8,
 |                  from arch/arm64/kernel/asm-offsets.c:10:
 | ./arch/arm64/include/asm/mte.h:106:6: note: previous implicit declaration of ‘kasan_hw_tags_enabled’ was here
 |   106 |  if (kasan_hw_tags_enabled() ||
 |       |      ^~~~~~~~~~~~~~~~~~~~~
 | cc1: all warnings being treated as errors
 | make[1]: *** [scripts/Makefile.build:121: arch/arm64/kernel/asm-offsets.s] Error 1
 | make: *** [Makefile:1191: prepare0] Error 2

Will

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2022-02-15 22:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-25  0:58 [PATCH v4] arm64: mte: avoid clearing PSTATE.TCO on entry unless necessary Peter Collingbourne
2022-02-15 22:51 ` Will Deacon [this message]
2022-02-19  1:31   ` 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=20220215225152.GA9229@willie-the-truck \
    --to=will@kernel.org \
    --cc=andreyknvl@gmail.com \
    --cc=catalin.marinas@arm.com \
    --cc=eugenis@google.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=mark.rutland@arm.com \
    --cc=pcc@google.com \
    --cc=vincenzo.frascino@arm.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox