mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sohil Mehta <sohil.mehta@intel.com>
To: Maciej Wieczor-Retman <m.wieczorretman@pm.me>,
	<peterz@infradead.org>, <ryan.roberts@arm.com>,
	<ilpo.jarvinen@linux.intel.com>,
	<maciej.wieczor-retman@intel.com>, <jgross@suse.com>,
	<morbo@google.com>, <mingo@redhat.com>, <ljs@kernel.org>,
	<nathan@kernel.org>, <shuah@kernel.org>,
	<akpm@linux-foundation.org>, <james.morse@arm.com>,
	<oleg@redhat.com>, <houwenlong.hwl@antgroup.com>, <xin@zytor.com>,
	<justinstitt@google.com>, <seanjc@google.com>, <hpa@zytor.com>,
	<perry.yuan@amd.com>, <bp@alien8.de>,
	<dave.hansen@linux.intel.com>, <tglx@kernel.org>,
	<nick.desaulniers+lkml@gmail.com>
Cc: <linux-kernel@vger.kernel.org>, <linux-kselftest@vger.kernel.org>,
	<llvm@lists.linux.dev>, <x86@kernel.org>
Subject: Re: [PATCH v6 1/3] x86/process: Shorten the LAM tag width
Date: Wed, 22 Apr 2026 10:24:19 -0700	[thread overview]
Message-ID: <e12c21c4-8de5-476d-b1ab-8bee4c1aedb5@intel.com> (raw)
In-Reply-To: <79720f2640839b15f22e3618136b084cb376456b.1775813245.git.m.wieczorretman@pm.me>

On 4/10/2026 2:55 AM, Maciej Wieczor-Retman wrote:
> diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c
> index 08e72f429870..d6f8e71156cd 100644
> --- a/arch/x86/kernel/process_64.c
> +++ b/arch/x86/kernel/process_64.c
> @@ -797,7 +797,10 @@ static long prctl_map_vdso(const struct vdso_image *image, unsigned long addr)
>  
>  #ifdef CONFIG_ADDRESS_MASKING
>  
> -#define LAM_U57_BITS 6
> +#define LAM_TAG_BITS	4

This makes sense as the tag width would be fixed at 4.

> +#define LAM_LS_BIT	57
> +#define LAM_MS_BIT	(LAM_LS_BIT + LAM_TAG_BITS - 1) /* 60 */
> +#define LAM_UNTAG_MASK	~GENMASK(LAM_MS_BIT, LAM_LS_BIT)
>  

This seems overkill. What we essentially need is 4 bits starting from
bit 57. GENMASK is the right macro for that, but it doesn't need these
extra argument macros and tail comments.

I think using direct numbers with a simple comment on top would be
better. How about something like?

/* Must use the 4 lower bits from the LAM_U57 tag bits 62:57 */
#define LAM_UNTAG_MASK	~GENMASK(60, 57)

You can probably add some explanation in the commit log about why only
the lower bits can be used.

>  static void enable_lam_func(void *__mm)
>  {
> @@ -814,7 +817,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 = LAM_UNTAG_MASK;
>  


Other than that,

Reviewed-by: Sohil Mehta <sohil.mehta@intel.com>

  reply	other threads:[~2026-04-22 17:24 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-10  9:55 [PATCH v6 0/3] x86: Simplifying LAM Maciej Wieczor-Retman
2026-04-10  9:55 ` [PATCH v6 1/3] x86/process: Shorten the LAM tag width Maciej Wieczor-Retman
2026-04-22 17:24   ` Sohil Mehta [this message]
2026-04-22 17:53     ` Maciej Wieczor-Retman
2026-04-22 18:07   ` Edgecombe, Rick P
2026-04-23  8:09     ` Maciej Wieczor-Retman
2026-04-23  9:38       ` Maciej Wieczor-Retman
2026-04-23 18:07       ` Edgecombe, Rick P
2026-04-23 19:10         ` Maciej Wieczor-Retman
2026-04-10  9:55 ` [PATCH v6 2/3] x86/mm: Cleanup comments where LAM_U48 is mentioned Maciej Wieczor-Retman
2026-04-10  9:55 ` [PATCH v6 3/3] selftests/lam: Update LAM tag width and cleanup names Maciej Wieczor-Retman
2026-04-22 18:11   ` Sohil Mehta
2026-04-22 18:36     ` 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=e12c21c4-8de5-476d-b1ab-8bee4c1aedb5@intel.com \
    --to=sohil.mehta@intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --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=ljs@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=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

Powered by JetHome