Skip to content

Commit 26ca442

Browse files
pccctmarinas
authored andcommitted
arm64: mte: Make mte_check_tfsr_*() conditional on KASAN instead of MTE
The check in mte_check_tfsr_el1() is only necessary if HW tag based KASAN is enabled. However, we were also executing the check if MTE is enabled and KASAN is enabled at build time but disabled at runtime. This turned out to cause a measurable increase in power consumption on a specific microarchitecture after enabling MTE. Moreover, on the same system, an increase in invalid syscall latency (as measured by [1]) of around 20-30% (depending on the cluster) was observed after enabling MTE; this almost entirely goes away after removing this check. Therefore, make the check conditional on whether KASAN is enabled rather than on whether MTE is enabled. [1] https://lore.kernel.org/all/CAMn1gO4MwRV8bmFJ_SeY5tsYNPn2ZP56LjAhafygjFaKuu5ouw@mail.gmail.com/ Signed-off-by: Peter Collingbourne <[email protected]> Link: https://linux-review.googlesource.com/id/I22d98d1483dd400a95595946552b769a5a1ad7bd Reviewed-by: Alexandru Elisei <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Catalin Marinas <[email protected]>
1 parent 83a7eef commit 26ca442

File tree

1 file changed

+2
-2
lines changed
  • arch/arm64/include/asm

1 file changed

+2
-2
lines changed

arch/arm64/include/asm/mte.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,15 +182,15 @@ void mte_check_tfsr_el1(void);
182182

183183
static inline void mte_check_tfsr_entry(void)
184184
{
185-
if (!system_supports_mte())
185+
if (!kasan_hw_tags_enabled())
186186
return;
187187

188188
mte_check_tfsr_el1();
189189
}
190190

191191
static inline void mte_check_tfsr_exit(void)
192192
{
193-
if (!system_supports_mte())
193+
if (!kasan_hw_tags_enabled())
194194
return;
195195

196196
/*

0 commit comments

Comments
 (0)