All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sohil Mehta <sohil.mehta@intel.com>
To: Maciej Wieczor-Retman <m.wieczorretman@pm.me>,
	<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>
Cc: <x86@kernel.org>, <linux-kselftest@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>, <llvm@lists.linux.dev>
Subject: Re: [PATCH v5 3/3] selftests/lam: Add test cases for different LAM tag widths
Date: Tue, 7 Apr 2026 13:06:40 -0700	[thread overview]
Message-ID: <39edd67c-c718-4005-87b9-f16392fa4841@intel.com> (raw)
In-Reply-To: <91141bc8dc7241b0c77208c743a7e051c782ccef.1775581451.git.m.wieczorretman@pm.me>

The subject needs a change. No new tests are being added now, right?

On 4/7/2026 10:45 AM, Maciej Wieczor-Retman wrote:
> From: Maciej Wieczor-Retman <maciej.wieczor-retman@intel.com>
> 
> diff --git a/tools/testing/selftests/x86/lam.c b/tools/testing/selftests/x86/lam.c
> index 1919fa6daec0..d27f947ea694 100644
> --- a/tools/testing/selftests/x86/lam.c
> +++ b/tools/testing/selftests/x86/lam.c
> @@ -26,9 +26,9 @@
>  
>  /* LAM modes, these definitions were copied from kernel code */
>  #define LAM_NONE                0
> -#define LAM_U57_BITS            6
> +#define LAM_BITS                4
>  
> -#define LAM_U57_MASK            (0x3fULL << 57)
> +#define LAM_MASK                (0xfULL << 57)

How about calculating the LAM_MASK from the LAM bits similar to the core
code in patch 1?

Also, when copying over the defines it would be useful to name them
exactly the same as the core code. That way any name changes would
happen in sync.


> @@ -247,10 +247,10 @@ static uint64_t set_metadata(uint64_t src, unsigned long lam)
>  	srand(time(NULL));
>  
>  	switch (lam) {
> -	case LAM_U57_BITS: /* Set metadata in bits 62:57 */
> +	case LAM_BITS: /* Set metadata in bits 62:57 */

This needs to change to 60:57 similar to the change below.

>  		/* Get a random non-zero value as metadata */
> -		metadata = (rand() % ((1UL << LAM_U57_BITS) - 1) + 1) << 57;
> -		metadata |= (src & ~(LAM_U57_MASK));
> +		metadata = (rand() % ((1UL << LAM_BITS) - 1) + 1) << 57;
> +		metadata |= (src & ~(LAM_MASK));
>  		break;
>  	default:
>  		metadata = src;
> @@ -291,7 +291,7 @@ int handle_max_bits(struct testcases *test)
>  	unsigned long bits = 0;
>  
>  	if (exp_bits != LAM_NONE)
> -		exp_bits = LAM_U57_BITS;
> +		exp_bits = LAM_BITS;
>  
>  	/* Get LAM max tag bits */
>  	if (syscall(SYS_arch_prctl, ARCH_GET_MAX_TAG_BITS, &bits) == -1)
> @@ -719,8 +719,8 @@ int do_uring(unsigned long lam)
>  			uint64_t addr = ((uint64_t)fi->iovecs[i].iov_base);
>  
>  			switch (lam) {
> -			case LAM_U57_BITS: /* Clear bits 62:57 */
> -				addr = (addr & ~(LAM_U57_MASK));
> +			case LAM_BITS: /* Clear bits 60:57 */

Just like this one.

  reply	other threads:[~2026-04-07 20:06 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
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 [this message]
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=39edd67c-c718-4005-87b9-f16392fa4841@intel.com \
    --to=sohil.mehta@intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.