* [PATCH V2] mm: alloc_tag: change the KASAN_TAG_WIDTH for HW_TAGS
@ 2025-04-28 11:00 Guilherme Giacomo Simoes
2025-04-28 16:01 ` Suren Baghdasaryan
0 siblings, 1 reply; 3+ messages in thread
From: Guilherme Giacomo Simoes @ 2025-04-28 11:00 UTC (permalink / raw)
To: akpm, pasha.tatashin, surenb
Cc: linux-mm, linux-kernel, Guilherme Giacomo Simoes, Andrey Konovalov
the KASAN_TAG_WIDTH is 8 bits for both (HW_TAGS and SW_TAGS), but for
HW_TAGS the KASAN_TAG_WIDTH can be 4 bits bits because due to the design
of the MTE the memory words for storing metadata only need 4 bits.
Change the preprocessor define KASAN_TAG_WIDTH for check if SW_TAGS is
define, so KASAN_TAG_WIDTH should be 8 bits, but if HW_TAGS is define,
so KASAN_TAG_WIDTH should be 4 bits to save a few flags bits.
Suggested-by: Andrey Konovalov <andreyknvl@gmail.com>
Signed-off-by: Guilherme Giacomo Simoes <trintaeoitogc@gmail.com>
---
V2 changes:
- Improve commit message
---
include/linux/page-flags-layout.h | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/include/linux/page-flags-layout.h b/include/linux/page-flags-layout.h
index 4f5c9e979bb9..760006b1c480 100644
--- a/include/linux/page-flags-layout.h
+++ b/include/linux/page-flags-layout.h
@@ -72,8 +72,10 @@
#define NODE_NOT_IN_PAGE_FLAGS 1
#endif
-#if defined(CONFIG_KASAN_SW_TAGS) || defined(CONFIG_KASAN_HW_TAGS)
+#if defined(CONFIG_KASAN_SW_TAGS)
#define KASAN_TAG_WIDTH 8
+#elif defined(CONFIG_KASAN_HW_TAGS)
+#define KASAN_TAG_WIDTH 4
#else
#define KASAN_TAG_WIDTH 0
#endif
--
2.34.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH V2] mm: alloc_tag: change the KASAN_TAG_WIDTH for HW_TAGS
2025-04-28 11:00 [PATCH V2] mm: alloc_tag: change the KASAN_TAG_WIDTH for HW_TAGS Guilherme Giacomo Simoes
@ 2025-04-28 16:01 ` Suren Baghdasaryan
2025-04-28 20:05 ` Guilherme Giacomo Simoes
0 siblings, 1 reply; 3+ messages in thread
From: Suren Baghdasaryan @ 2025-04-28 16:01 UTC (permalink / raw)
To: Guilherme Giacomo Simoes
Cc: akpm, pasha.tatashin, linux-mm, linux-kernel, Andrey Konovalov
On Mon, Apr 28, 2025 at 4:00 AM Guilherme Giacomo Simoes
<trintaeoitogc@gmail.com> wrote:
>
> the KASAN_TAG_WIDTH is 8 bits for both (HW_TAGS and SW_TAGS), but for
> HW_TAGS the KASAN_TAG_WIDTH can be 4 bits bits because due to the design
> of the MTE the memory words for storing metadata only need 4 bits.
> Change the preprocessor define KASAN_TAG_WIDTH for check if SW_TAGS is
> define, so KASAN_TAG_WIDTH should be 8 bits, but if HW_TAGS is define,
> so KASAN_TAG_WIDTH should be 4 bits to save a few flags bits.
The title lists "alloc_tag" but the change does not directly relate to
allocation tags. I think it should be page-flags-layout.h instead.
>
> Suggested-by: Andrey Konovalov <andreyknvl@gmail.com>
> Signed-off-by: Guilherme Giacomo Simoes <trintaeoitogc@gmail.com>
> ---
>
> V2 changes:
> - Improve commit message
>
> ---
> include/linux/page-flags-layout.h | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/include/linux/page-flags-layout.h b/include/linux/page-flags-layout.h
> index 4f5c9e979bb9..760006b1c480 100644
> --- a/include/linux/page-flags-layout.h
> +++ b/include/linux/page-flags-layout.h
> @@ -72,8 +72,10 @@
> #define NODE_NOT_IN_PAGE_FLAGS 1
> #endif
>
> -#if defined(CONFIG_KASAN_SW_TAGS) || defined(CONFIG_KASAN_HW_TAGS)
> +#if defined(CONFIG_KASAN_SW_TAGS)
> #define KASAN_TAG_WIDTH 8
> +#elif defined(CONFIG_KASAN_HW_TAGS)
> +#define KASAN_TAG_WIDTH 4
> #else
> #define KASAN_TAG_WIDTH 0
> #endif
> --
> 2.34.1
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH V2] mm: alloc_tag: change the KASAN_TAG_WIDTH for HW_TAGS
2025-04-28 16:01 ` Suren Baghdasaryan
@ 2025-04-28 20:05 ` Guilherme Giacomo Simoes
0 siblings, 0 replies; 3+ messages in thread
From: Guilherme Giacomo Simoes @ 2025-04-28 20:05 UTC (permalink / raw)
To: surenb
Cc: akpm, andreyknvl, linux-kernel, linux-mm, pasha.tatashin, trintaeoitogc
Suren Baghdasaryan <surenb@google.com> wrote:
> The title lists "alloc_tag" but the change does not directly relate to
> allocation tags. I think it should be page-flags-layout.h instead.
Okay, so, I will send a v3 with commit prefix "mm: page-flags-layout.h:"
Thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-04-28 20:05 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-04-28 11:00 [PATCH V2] mm: alloc_tag: change the KASAN_TAG_WIDTH for HW_TAGS Guilherme Giacomo Simoes
2025-04-28 16:01 ` Suren Baghdasaryan
2025-04-28 20:05 ` Guilherme Giacomo Simoes
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox