From: David Laight <david.laight.linux@gmail.com>
To: Maciej Wieczor-Retman <m.wieczorretman@pm.me>
Cc: houwenlong.hwl@antgroup.com, dave.hansen@linux.intel.com,
ryan.roberts@arm.com, nick.desaulniers+lkml@gmail.com,
bp@alien8.de, will@kernel.org, maciej.wieczor-retman@intel.com,
david@kernel.org, nathan@kernel.org, justinstitt@google.com,
seanjc@google.com, perry.yuan@amd.com, oleg@redhat.com,
tglx@kernel.org, hpa@zytor.com, james.morse@arm.com,
mingo@redhat.com, akpm@linux-foundation.org, jgross@suse.com,
peterz@infradead.org, morbo@google.com,
ilpo.jarvinen@linux.intel.com, xin@zytor.com, shuah@kernel.org,
x86@kernel.org, linux-kselftest@vger.kernel.org,
linux-kernel@vger.kernel.org, llvm@lists.linux.dev
Subject: Re: [PATCH v5 1/3] x86/process: Shorten the default LAM tag width
Date: Tue, 7 Apr 2026 22:36:53 +0100 [thread overview]
Message-ID: <20260407223653.2d3d3c60@pumpkin> (raw)
In-Reply-To: <bf872c3f7591dc7580679e35b343b08534be2d5a.1775581451.git.m.wieczorretman@pm.me>
On Tue, 07 Apr 2026 17:45:20 +0000
Maciej Wieczor-Retman <m.wieczorretman@pm.me> wrote:
> From: Maciej Wieczor-Retman <maciej.wieczor-retman@intel.com>
>
> With the announcement of ChkTag, it's worth preparing a stable x86
> linear address masking (lam) user interface. One important aspect of lam
> is the tag width, and aligning it with other industry solutions can
> provide a more popular, generalized interface that other technologies
> could utilize.
>
> ChkTag will use 4-bit tags and since that's the direction other memory
> tagging implementations seem to be taking too (for example Arm's MTE)
> it's reasonable to converge lam in linux to the same specification. Even
> though x86's LAM supports 6-bit tags it is beneficial to shorten lam to
> 4 bits as ChkTag will likely be the main user of the interface and such
> connection should simplify things in the future.
>
> Shrink the maximum acceptable tag width from 6 to 4.
>
> Signed-off-by: Maciej Wieczor-Retman <maciej.wieczor-retman@intel.com>
> ---
> Changelog v4:
> - Ditch the default wording in the patch message.
> - Add the imperative last line as Dave suggested.
>
> Changelog v3:
> - Remove the variability of the lam width after the debugfs part was
> removed from the patchset.
>
> arch/x86/kernel/process_64.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c
> index 08e72f429870..1a0e96835bbc 100644
> --- a/arch/x86/kernel/process_64.c
> +++ b/arch/x86/kernel/process_64.c
> @@ -797,7 +797,7 @@ static long prctl_map_vdso(const struct vdso_image *image, unsigned long addr)
>
> #ifdef CONFIG_ADDRESS_MASKING
>
> -#define LAM_U57_BITS 6
> +#define LAM_DEFAULT_BITS 4
>
> static void enable_lam_func(void *__mm)
> {
> @@ -814,7 +814,7 @@ static void enable_lam_func(void *__mm)
> static void mm_enable_lam(struct mm_struct *mm)
> {
> mm->context.lam_cr3_mask = X86_CR3_LAM_U57;
> - mm->context.untag_mask = ~GENMASK(62, 57);
> + mm->context.untag_mask = ~GENMASK(57 + LAM_DEFAULT_BITS - 1, 57);
I'm not sure that GENMASK() is really the best way to describe that value.
It really is ((1ul << LAM_BITS) - 1) << 57 and even the 57 shouldn't be
a magic constant.
I also wonder how userspace knows which bits to use. The other patches
just seem to handle a count from userspace, but you aren't giving out
the highest available bits.
If this had been done for 48bit vaddr, you would really have wished that
that bits 62-59 had been used not 51-48.
David
next prev parent reply other threads:[~2026-04-07 21:36 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-07 17:45 [PATCH v5 0/3] x86: Simplifying LAM Maciej Wieczor-Retman
2026-04-07 17:45 ` [PATCH v5 1/3] x86/process: Shorten the default LAM tag width Maciej Wieczor-Retman
2026-04-07 19:52 ` Sohil Mehta
2026-04-07 20:31 ` Maciej Wieczor-Retman
2026-04-07 21:30 ` Sohil Mehta
2026-04-07 21:36 ` Maciej Wieczor-Retman
2026-04-07 21:36 ` David Laight [this message]
2026-04-07 21:53 ` Maciej Wieczor-Retman
2026-04-08 8:51 ` David Laight
2026-04-08 10:19 ` Maciej Wieczor-Retman
2026-04-07 17:45 ` [PATCH v5 2/3] x86/mm: Cleanup comments where LAM_U48 is mentioned Maciej Wieczor-Retman
2026-04-07 19:58 ` Sohil Mehta
2026-04-07 17:45 ` [PATCH v5 3/3] selftests/lam: Add test cases for different LAM tag widths Maciej Wieczor-Retman
2026-04-07 20:06 ` Sohil Mehta
2026-04-07 20:34 ` Maciej Wieczor-Retman
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=20260407223653.2d3d3c60@pumpkin \
--to=david.laight.linux@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=david@kernel.org \
--cc=houwenlong.hwl@antgroup.com \
--cc=hpa@zytor.com \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=james.morse@arm.com \
--cc=jgross@suse.com \
--cc=justinstitt@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=llvm@lists.linux.dev \
--cc=m.wieczorretman@pm.me \
--cc=maciej.wieczor-retman@intel.com \
--cc=mingo@redhat.com \
--cc=morbo@google.com \
--cc=nathan@kernel.org \
--cc=nick.desaulniers+lkml@gmail.com \
--cc=oleg@redhat.com \
--cc=perry.yuan@amd.com \
--cc=peterz@infradead.org \
--cc=ryan.roberts@arm.com \
--cc=seanjc@google.com \
--cc=shuah@kernel.org \
--cc=tglx@kernel.org \
--cc=will@kernel.org \
--cc=x86@kernel.org \
--cc=xin@zytor.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