mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Richard Cheng <icheng@nvidia.com>
To: Ben Horgan <ben.horgan@arm.com>
Cc: tony.luck@intel.com, reinette.chatre@intel.com, shuah@kernel.org,
	 fenghuay@nvidia.com, x86@kernel.org, Dave.Martin@arm.com,
	james.morse@arm.com,  babu.moger@amd.com,
	linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org,
	 kaihengf@nvidia.com, kobak@nvidia.com, newtonl@nvidia.com,
	kristinc@nvidia.com
Subject: Re: [PATCH v6 1/2] selftests/resctrl: Fix CMT test failure when all cache bits are tested
Date: Fri, 20 Nov 2026 17:31:30 +0800	[thread overview]
Message-ID: <awAS_P8FGFnjkFDL@MWDK4CY14F> (raw)
In-Reply-To: <6ae02c7b-69a3-43a1-bcd5-639780e2a0f2@arm.com>

On Mon, Nov 16, 2026 at 04:30:06PM +0800, Ben Horgan wrote:
> Hi Richard,
> 
> On 14/11/2026 14:01, Richard Cheng wrote:
> > The CMT test accepts any number of bits from 1 to the length of the full
> > cache bit mask via "-n". Since cmt_init() gives the default resource
> > group the inverse of the tested mask to keep other tasks out of the
> > tested cache portion.
> > 
> > When all bits are tested the inverse mask is empty. resctrl rejects an
> > empty mask with "Mask out of range" on systems that require at least one
> > bit to be set, cmt_init() fails and the test fails before taking any
> > measurement.
> > 
> > Only write the schemata of the default resource group when there're bits
> > left for it. When all bits are tested the default resource group keeps
> > its allocation.
> 
> Why did you choose this policy? For instance, why not just set a single bit?
> 
> Thanks,
> 
> Ben
>

Hi Ben,

No strong reason.
I was fixing the failed write and skipping it was the smallest change.

I think your way is better, it can keep the other tasks in one portion
instead of leaving them the whole cache.
I'll write  the smallest mask the platform accepts min_cbm_bits in v7.

Best regards,
Richard Cheng.
 
> > 
> > Fixes: 7a214b4ec1c9 ("selftests/resctrl: Improve accuracy of cache occupancy test")
> > Signed-off-by: Richard Cheng <icheng@nvidia.com>
> > ---
> >  tools/testing/selftests/resctrl/cmt_test.c | 11 +++++++----
> >  1 file changed, 7 insertions(+), 4 deletions(-)
> > 
> > diff --git a/tools/testing/selftests/resctrl/cmt_test.c b/tools/testing/selftests/resctrl/cmt_test.c
> > index ccb6fe881a94..5d0bb27b7817 100644
> > --- a/tools/testing/selftests/resctrl/cmt_test.c
> > +++ b/tools/testing/selftests/resctrl/cmt_test.c
> > @@ -42,10 +42,13 @@ static int cmt_init(const struct resctrl_test *test,
> >  	if (ret)
> >  		return ret;
> >  
> > -	snprintf(schemata, sizeof(schemata), "%lx", ~param->mask & full_mask);
> > -	ret = write_schemata("", schemata, uparams->cpu, test->resource);
> > -	if (ret)
> > -		return ret;
> > +	/* No bits are left for the default group when all bits are tested. */
> > +	if (~param->mask & full_mask) {
> > +		snprintf(schemata, sizeof(schemata), "%lx", ~param->mask & full_mask);
> > +		ret = write_schemata("", schemata, uparams->cpu, test->resource);
> > +		if (ret)
> > +			return ret;
> > +	}
> >  
> >  	snprintf(schemata, sizeof(schemata), "%lx", param->mask);
> >  	ret = write_schemata(param->ctrlgrp, schemata, uparams->cpu, test->resource);
> 

  reply	other threads:[~2026-11-20  9:31 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-14 14:01 [PATCH v6 0/2] selftests/resctrl: Check the effect of the CBM in CMT test Richard Cheng
2026-11-14 14:01 ` [PATCH v6 1/2] selftests/resctrl: Fix CMT test failure when all cache bits are tested Richard Cheng
2026-11-16 16:30   ` Ben Horgan
2026-11-20  9:31     ` Richard Cheng [this message]
2026-11-14 14:01 ` [PATCH v6 2/2] selftests/resctrl: Check that CBM limits LLC occupancy in CMT test Richard Cheng

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=awAS_P8FGFnjkFDL@MWDK4CY14F \
    --to=icheng@nvidia.com \
    --cc=Dave.Martin@arm.com \
    --cc=babu.moger@amd.com \
    --cc=ben.horgan@arm.com \
    --cc=fenghuay@nvidia.com \
    --cc=james.morse@arm.com \
    --cc=kaihengf@nvidia.com \
    --cc=kobak@nvidia.com \
    --cc=kristinc@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=newtonl@nvidia.com \
    --cc=reinette.chatre@intel.com \
    --cc=shuah@kernel.org \
    --cc=tony.luck@intel.com \
    --cc=x86@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

all inboxes | Powered by JetHome®