From: Luis Machado <luis.machado@linaro.org>
To: Catalin Marinas <catalin.marinas@arm.com>,
linux-arm-kernel@lists.infradead.org
Cc: Will Deacon <will@kernel.org>, John Baldwin <jhb@FreeBSD.org>,
Arnd Bergmann <arnd@arndb.de>,
"Eric W. Biederman" <ebiederm@xmission.com>,
Kees Cook <keescook@chromium.org>,
Szabolcs Nagy <szabolcs.nagy@arm.com>,
Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH 3/5] arm64: mte: Define the number of bytes for storing the tags in a page
Date: Mon, 3 Jan 2022 14:27:58 -0300 [thread overview]
Message-ID: <decd67e4-e659-18bd-c848-f840cda98ba4@linaro.org> (raw)
In-Reply-To: <20211208121941.494956-4-catalin.marinas@arm.com>
On 12/8/21 9:19 AM, Catalin Marinas wrote:
> Rather than explicitly calculating the number of bytes for a compact tag
> storage format corresponding to a page, just add a MTE_PAGE_TAG_STORAGE
> macro. With the current MTE implementation of 4 bits per tag, we store
> 2 tags in a byte.
>
> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
> ---
> arch/arm64/include/asm/mte-def.h | 1 +
> arch/arm64/lib/mte.S | 4 ++--
> arch/arm64/mm/mteswap.c | 2 +-
> 3 files changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/arch/arm64/include/asm/mte-def.h b/arch/arm64/include/asm/mte-def.h
> index 626d359b396e..14ee86b019c2 100644
> --- a/arch/arm64/include/asm/mte-def.h
> +++ b/arch/arm64/include/asm/mte-def.h
> @@ -11,6 +11,7 @@
> #define MTE_TAG_SHIFT 56
> #define MTE_TAG_SIZE 4
> #define MTE_TAG_MASK GENMASK((MTE_TAG_SHIFT + (MTE_TAG_SIZE - 1)), MTE_TAG_SHIFT)
> +#define MTE_PAGE_TAG_STORAGE (MTE_GRANULES_PER_PAGE * MTE_TAG_SIZE / 8)
>
> #define __MTE_PREAMBLE ARM64_ASM_PREAMBLE ".arch_extension memtag\n"
>
> diff --git a/arch/arm64/lib/mte.S b/arch/arm64/lib/mte.S
> index e83643b3995f..62a1025aa118 100644
> --- a/arch/arm64/lib/mte.S
> +++ b/arch/arm64/lib/mte.S
> @@ -128,7 +128,7 @@ SYM_FUNC_END(mte_copy_tags_to_user)
> /*
> * Save the tags in a page
> * x0 - page address
> - * x1 - tag storage
> + * x1 - tag storage, MTE_PAGE_TAG_STORAGE bytes
> */
> SYM_FUNC_START(mte_save_page_tags)
> multitag_transfer_size x7, x5
> @@ -152,7 +152,7 @@ SYM_FUNC_END(mte_save_page_tags)
> /*
> * Restore the tags in a page
> * x0 - page address
> - * x1 - tag storage
> + * x1 - tag storage, MTE_PAGE_TAG_STORAGE bytes
> */
> SYM_FUNC_START(mte_restore_page_tags)
> multitag_transfer_size x7, x5
> diff --git a/arch/arm64/mm/mteswap.c b/arch/arm64/mm/mteswap.c
> index 7c4ef56265ee..a9e50e930484 100644
> --- a/arch/arm64/mm/mteswap.c
> +++ b/arch/arm64/mm/mteswap.c
> @@ -12,7 +12,7 @@ static DEFINE_XARRAY(mte_pages);
> void *mte_allocate_tag_storage(void)
> {
> /* tags granule is 16 bytes, 2 tags stored per byte */
> - return kmalloc(PAGE_SIZE / 16 / 2, GFP_KERNEL);
> + return kmalloc(MTE_PAGE_TAG_STORAGE, GFP_KERNEL);
> }
>
> void mte_free_tag_storage(char *storage)
>
Acked-by: Luis Machado <luis.machado@linaro.org>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2022-01-03 17:29 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-08 12:19 [PATCH 0/5] arm64: mte: add core dump support Catalin Marinas
2021-12-08 12:19 ` [PATCH 1/5] elfcore: Replace CONFIG_{IA64, UML} checks with a new option Catalin Marinas
2021-12-08 12:19 ` [PATCH 2/5] elf: Introduce the ARM MTE ELF segment type Catalin Marinas
2022-01-03 17:28 ` Luis Machado
2021-12-08 12:19 ` [PATCH 3/5] arm64: mte: Define the number of bytes for storing the tags in a page Catalin Marinas
2022-01-03 17:27 ` Luis Machado [this message]
2021-12-08 12:19 ` [PATCH 4/5] arm64: mte: Dump the MTE tags in the core file Catalin Marinas
2022-01-03 17:27 ` Luis Machado
2021-12-08 12:19 ` [PATCH 5/5] arm64: mte: Document the core dump file format Catalin Marinas
2022-01-03 17:27 ` Luis Machado
2022-01-04 12:33 ` Catalin Marinas
2021-12-08 17:21 ` [PATCH 0/5] arm64: mte: add core dump support Eric W. Biederman
2021-12-08 17:57 ` Catalin Marinas
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=decd67e4-e659-18bd-c848-f840cda98ba4@linaro.org \
--to=luis.machado@linaro.org \
--cc=akpm@linux-foundation.org \
--cc=arnd@arndb.de \
--cc=catalin.marinas@arm.com \
--cc=ebiederm@xmission.com \
--cc=jhb@FreeBSD.org \
--cc=keescook@chromium.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=szabolcs.nagy@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).