* [PATCH] selftests/resctrl: Allow CAT testing when no exclusive cache exists
@ 2026-05-23 10:17 Chen Yu
2026-05-25 10:01 ` Ilpo Järvinen
0 siblings, 1 reply; 8+ messages in thread
From: Chen Yu @ 2026-05-23 10:17 UTC (permalink / raw)
To: Tony Luck, Reinette Chatre
Cc: x86, Dave Martin, James Morse, Babu Moger, linux-kernel,
linux-kselftest, Chen Yu, Hongyu Ning
The shareable_bits indicates which cache portions might be shared with
other agents (e.g., GPU, other I/O devices). On some platforms, all L3
cache ways are marked as potentially shared.
The L3_CAT test should fall back to using the full CBM mask when no
exclusive portion exists, since the test logic (writing different
schemata and measuring cache misses) still works. The shareable mask
is a hint about potential interference, not a hard exclusion.
Reported-by: Hongyu Ning <hongyu.ning@linux.intel.com>
Signed-off-by: Chen Yu <yu.c.chen@intel.com>
---
tools/testing/selftests/resctrl/cat_test.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/testing/selftests/resctrl/cat_test.c b/tools/testing/selftests/resctrl/cat_test.c
index f00b622c1460..b6994ba4504b 100644
--- a/tools/testing/selftests/resctrl/cat_test.c
+++ b/tools/testing/selftests/resctrl/cat_test.c
@@ -248,7 +248,7 @@ static int cat_run_test(const struct resctrl_test *test, const struct user_param
/* Get the largest contiguous exclusive portion of the cache */
ret = get_mask_no_shareable(test->resource, &long_mask);
if (ret)
- return ret;
+ long_mask = full_cache_mask;
/* Get L3/L2 cache size */
ret = get_cache_size(uparams->cpu, test->resource, &cache_total_size);
--
2.25.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH] selftests/resctrl: Allow CAT testing when no exclusive cache exists
2026-05-23 10:17 [PATCH] selftests/resctrl: Allow CAT testing when no exclusive cache exists Chen Yu
@ 2026-05-25 10:01 ` Ilpo Järvinen
2026-05-25 11:59 ` Chen, Yu C
0 siblings, 1 reply; 8+ messages in thread
From: Ilpo Järvinen @ 2026-05-25 10:01 UTC (permalink / raw)
To: Chen Yu
Cc: Tony Luck, Reinette Chatre, x86, Dave Martin, James Morse,
Babu Moger, LKML, linux-kselftest, Hongyu Ning
On Sat, 23 May 2026, Chen Yu wrote:
> The shareable_bits indicates which cache portions might be shared with
> other agents (e.g., GPU, other I/O devices). On some platforms, all L3
> cache ways are marked as potentially shared.
>
> The L3_CAT test should fall back to using the full CBM mask when no
> exclusive portion exists, since the test logic (writing different
> schemata and measuring cache misses) still works. The shareable mask
> is a hint about potential interference, not a hard exclusion.
>
> Reported-by: Hongyu Ning <hongyu.ning@linux.intel.com>
> Signed-off-by: Chen Yu <yu.c.chen@intel.com>
> ---
> tools/testing/selftests/resctrl/cat_test.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/testing/selftests/resctrl/cat_test.c b/tools/testing/selftests/resctrl/cat_test.c
> index f00b622c1460..b6994ba4504b 100644
> --- a/tools/testing/selftests/resctrl/cat_test.c
> +++ b/tools/testing/selftests/resctrl/cat_test.c
> @@ -248,7 +248,7 @@ static int cat_run_test(const struct resctrl_test *test, const struct user_param
> /* Get the largest contiguous exclusive portion of the cache */
> ret = get_mask_no_shareable(test->resource, &long_mask);
> if (ret)
> - return ret;
> + long_mask = full_cache_mask;
Wouldn't it warrant to log something when the fallback occurs? It
certainly looks something that makes the results less reliable (so it
would be nice to know about it when looking at the test results).
>
> /* Get L3/L2 cache size */
> ret = get_cache_size(uparams->cpu, test->resource, &cache_total_size);
>
--
i.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] selftests/resctrl: Allow CAT testing when no exclusive cache exists
2026-05-25 10:01 ` Ilpo Järvinen
@ 2026-05-25 11:59 ` Chen, Yu C
2026-05-26 15:25 ` Reinette Chatre
0 siblings, 1 reply; 8+ messages in thread
From: Chen, Yu C @ 2026-05-25 11:59 UTC (permalink / raw)
To: Ilpo Järvinen
Cc: Tony Luck, Reinette Chatre, x86, Dave Martin, James Morse,
Babu Moger, LKML, linux-kselftest, Hongyu Ning
Hi Ilpo,
On 5/25/2026 6:01 PM, Ilpo Järvinen wrote:
> On Sat, 23 May 2026, Chen Yu wrote:
>
>> The shareable_bits indicates which cache portions might be shared with
>> other agents (e.g., GPU, other I/O devices). On some platforms, all L3
>> cache ways are marked as potentially shared.
>>
>> The L3_CAT test should fall back to using the full CBM mask when no
>> exclusive portion exists, since the test logic (writing different
>> schemata and measuring cache misses) still works. The shareable mask
>> is a hint about potential interference, not a hard exclusion.
>>
>> Reported-by: Hongyu Ning <hongyu.ning@linux.intel.com>
>> Signed-off-by: Chen Yu <yu.c.chen@intel.com>
>> ---
>> tools/testing/selftests/resctrl/cat_test.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/tools/testing/selftests/resctrl/cat_test.c b/tools/testing/selftests/resctrl/cat_test.c
>> index f00b622c1460..b6994ba4504b 100644
>> --- a/tools/testing/selftests/resctrl/cat_test.c
>> +++ b/tools/testing/selftests/resctrl/cat_test.c
>> @@ -248,7 +248,7 @@ static int cat_run_test(const struct resctrl_test *test, const struct user_param
>> /* Get the largest contiguous exclusive portion of the cache */
>> ret = get_mask_no_shareable(test->resource, &long_mask);
>> if (ret)
>> - return ret;
>> + long_mask = full_cache_mask;
>
> Wouldn't it warrant to log something when the fallback occurs? It
> certainly looks something that makes the results less reliable (so it
> would be nice to know about it when looking at the test results).
>
Got it. Let me add the following message:
ksft_print_msg("No exclusive cache portion found, fall back to full
cache mask\n");
thanks,
Chenyu
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] selftests/resctrl: Allow CAT testing when no exclusive cache exists
2026-05-25 11:59 ` Chen, Yu C
@ 2026-05-26 15:25 ` Reinette Chatre
2026-05-27 1:57 ` Chen, Yu C
0 siblings, 1 reply; 8+ messages in thread
From: Reinette Chatre @ 2026-05-26 15:25 UTC (permalink / raw)
To: Chen, Yu C, Ilpo Järvinen
Cc: Tony Luck, x86, Dave Martin, James Morse, Babu Moger, LKML,
linux-kselftest, Hongyu Ning
Hi Chenyu,
On 5/25/26 4:59 AM, Chen, Yu C wrote:
> Hi Ilpo,
>
> On 5/25/2026 6:01 PM, Ilpo Järvinen wrote:
>> On Sat, 23 May 2026, Chen Yu wrote:
>>
>>> The shareable_bits indicates which cache portions might be shared with
>>> other agents (e.g., GPU, other I/O devices). On some platforms, all L3
>>> cache ways are marked as potentially shared.
>>>
>>> The L3_CAT test should fall back to using the full CBM mask when no
>>> exclusive portion exists, since the test logic (writing different
>>> schemata and measuring cache misses) still works. The shareable mask
How do you define "still works"? Allowing more interference will impact the
number of cache misses that is used to determine effectiveness of cache
allocation, no?
>>> is a hint about potential interference, not a hard exclusion.
>>>
>>> Reported-by: Hongyu Ning <hongyu.ning@linux.intel.com>
>>> Signed-off-by: Chen Yu <yu.c.chen@intel.com>
>>> ---
>>> tools/testing/selftests/resctrl/cat_test.c | 2 +-
>>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/tools/testing/selftests/resctrl/cat_test.c b/tools/testing/selftests/resctrl/cat_test.c
>>> index f00b622c1460..b6994ba4504b 100644
>>> --- a/tools/testing/selftests/resctrl/cat_test.c
>>> +++ b/tools/testing/selftests/resctrl/cat_test.c
>>> @@ -248,7 +248,7 @@ static int cat_run_test(const struct resctrl_test *test, const struct user_param
>>> /* Get the largest contiguous exclusive portion of the cache */
>>> ret = get_mask_no_shareable(test->resource, &long_mask);
>>> if (ret)
>>> - return ret;
>>> + long_mask = full_cache_mask;
>>
>> Wouldn't it warrant to log something when the fallback occurs? It
>> certainly looks something that makes the results less reliable (so it
>> would be nice to know about it when looking at the test results).
>>
>
> Got it. Let me add the following message:
> ksft_print_msg("No exclusive cache portion found, fall back to full cache mask\n");
Allowing more interference will cause the test to fail while the system behaves correctly.
This log message may help a knowledgeable user running the test manually but I expect would
be confusing to folks not familiar with resctrl and definitely does not help test automation
that just looks for the pass/fail.
The test can be fixed by skipping the test, instead of failing, if there are no bits
available for the test to run as intended. Of course, this will prevent CAT mechanics to
be tested on this platform so to test CAT on this platform there is a need a new functional
test since a performance test is not appropriate.
Reinette
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] selftests/resctrl: Allow CAT testing when no exclusive cache exists
2026-05-26 15:25 ` Reinette Chatre
@ 2026-05-27 1:57 ` Chen, Yu C
2026-05-27 2:24 ` Reinette Chatre
0 siblings, 1 reply; 8+ messages in thread
From: Chen, Yu C @ 2026-05-27 1:57 UTC (permalink / raw)
To: Reinette Chatre, Ilpo Järvinen
Cc: Tony Luck, x86, Dave Martin, James Morse, Babu Moger, LKML,
linux-kselftest, Hongyu Ning
Hi Reinette,
On 5/26/2026 11:25 PM, Reinette Chatre wrote:
> Hi Chenyu,
>
> On 5/25/26 4:59 AM, Chen, Yu C wrote:
>> Hi Ilpo,
>>
>> On 5/25/2026 6:01 PM, Ilpo Järvinen wrote:
>>> On Sat, 23 May 2026, Chen Yu wrote:
>>>
>>>> The shareable_bits indicates which cache portions might be shared with
>>>> other agents (e.g., GPU, other I/O devices). On some platforms, all L3
>>>> cache ways are marked as potentially shared.
>>>>
>>>> The L3_CAT test should fall back to using the full CBM mask when no
>>>> exclusive portion exists, since the test logic (writing different
>>>> schemata and measuring cache misses) still works. The shareable mask
>
> How do you define "still works"? Allowing more interference will impact the
> number of cache misses that is used to determine effectiveness of cache
> allocation, no?
>
>>>> is a hint about potential interference, not a hard exclusion.
>>>>
>>>> Reported-by: Hongyu Ning <hongyu.ning@linux.intel.com>
>>>> Signed-off-by: Chen Yu <yu.c.chen@intel.com>
>>>> ---
>>>> tools/testing/selftests/resctrl/cat_test.c | 2 +-
>>>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>>>
>>>> diff --git a/tools/testing/selftests/resctrl/cat_test.c b/tools/testing/selftests/resctrl/cat_test.c
>>>> index f00b622c1460..b6994ba4504b 100644
>>>> --- a/tools/testing/selftests/resctrl/cat_test.c
>>>> +++ b/tools/testing/selftests/resctrl/cat_test.c
>>>> @@ -248,7 +248,7 @@ static int cat_run_test(const struct resctrl_test *test, const struct user_param
>>>> /* Get the largest contiguous exclusive portion of the cache */
>>>> ret = get_mask_no_shareable(test->resource, &long_mask);
>>>> if (ret)
>>>> - return ret;
>>>> + long_mask = full_cache_mask;
>>>
>>> Wouldn't it warrant to log something when the fallback occurs? It
>>> certainly looks something that makes the results less reliable (so it
>>> would be nice to know about it when looking at the test results).
>>>
>>
>> Got it. Let me add the following message:
>> ksft_print_msg("No exclusive cache portion found, fall back to full cache mask\n");
>
> Allowing more interference will cause the test to fail while the system behaves correctly.
> This log message may help a knowledgeable user running the test manually but I expect would
> be confusing to folks not familiar with resctrl and definitely does not help test automation
> that just looks for the pass/fail.
>
> The test can be fixed by skipping the test, instead of failing, if there are no bits
> available for the test to run as intended. Of course, this will prevent CAT mechanics to
> be tested on this platform so to test CAT on this platform there is a need a new functional
> test since a performance test is not appropriate.
>
Got it.
My thinking was that shareable_bits only describes portions that may
be shared with non-CPU agents, and on an otherwise idle test system
the CAT miss-rate trend can still be observed even if all ways are
marked shareable. But I agree that this is not a good assumption for
kselftest pass/fail.
So I agree that falling back to the full CBM is not the right fix for
this test. I will change the patch to skip L3_CAT when no exclusive
cache portion is available, with a message explaining that the performance
test cannot run reliably because all cache portions are shareable.
For platforms where all cache ways are marked shareable, do you think
providing a extra parameter to ask cat_test to "ignore" the share
restriction is acceptable?
thanks,
Chenyu
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] selftests/resctrl: Allow CAT testing when no exclusive cache exists
2026-05-27 1:57 ` Chen, Yu C
@ 2026-05-27 2:24 ` Reinette Chatre
2026-05-27 4:52 ` Chen, Yu C
2026-05-27 9:49 ` Ilpo Järvinen
0 siblings, 2 replies; 8+ messages in thread
From: Reinette Chatre @ 2026-05-27 2:24 UTC (permalink / raw)
To: Chen, Yu C, Ilpo Järvinen
Cc: Tony Luck, x86, Dave Martin, James Morse, Babu Moger, LKML,
linux-kselftest, Hongyu Ning
Hi Chenyu,
On 5/26/26 6:57 PM, Chen, Yu C wrote:
> My thinking was that shareable_bits only describes portions that may
> be shared with non-CPU agents, and on an otherwise idle test system
> the CAT miss-rate trend can still be observed even if all ways are
> marked shareable. But I agree that this is not a good assumption for
> kselftest pass/fail.
>
> So I agree that falling back to the full CBM is not the right fix for
> this test. I will change the patch to skip L3_CAT when no exclusive
> cache portion is available, with a message explaining that the performance
> test cannot run reliably because all cache portions are shareable.
Sounds like https://lore.kernel.org/lkml/20260526024251.7895-1-icheng@nvidia.com/
does what you need.
>
> For platforms where all cache ways are marked shareable, do you think
> providing a extra parameter to ask cat_test to "ignore" the share
> restriction is acceptable?
While resctrl tests support command line arguments I do not know if they
are actually being used. During a previous rework we found that they were
not behaving as intended and we did not receive any complaints. Even if
somebody uses the hypothetical "ignore" parameter I do not see how the test
result can be trusted unless this is done as part of some hardware validation
that resctrl selftests do not aim to support. resctrl selftests are intended to
test the resctrl kernel subsystem.
I think effort is better spent on creating an actual CAT functional test.
For reference: https://lore.kernel.org/lkml/20250616082453.3725-1-ilpo.jarvinen@linux.intel.com/
Reinette
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] selftests/resctrl: Allow CAT testing when no exclusive cache exists
2026-05-27 2:24 ` Reinette Chatre
@ 2026-05-27 4:52 ` Chen, Yu C
2026-05-27 9:49 ` Ilpo Järvinen
1 sibling, 0 replies; 8+ messages in thread
From: Chen, Yu C @ 2026-05-27 4:52 UTC (permalink / raw)
To: Reinette Chatre, Ilpo Järvinen
Cc: Tony Luck, x86, Dave Martin, James Morse, Babu Moger, LKML,
linux-kselftest, Hongyu Ning
Hi Reinette,
On 5/27/2026 10:24 AM, Reinette Chatre wrote:
> Hi Chenyu,
>
> On 5/26/26 6:57 PM, Chen, Yu C wrote:
>> My thinking was that shareable_bits only describes portions that may
>> be shared with non-CPU agents, and on an otherwise idle test system
>> the CAT miss-rate trend can still be observed even if all ways are
>> marked shareable. But I agree that this is not a good assumption for
>> kselftest pass/fail.
>>
>> So I agree that falling back to the full CBM is not the right fix for
>> this test. I will change the patch to skip L3_CAT when no exclusive
>> cache portion is available, with a message explaining that the performance
>> test cannot run reliably because all cache portions are shareable.
>
> Sounds like https://lore.kernel.org/lkml/20260526024251.7895-1-icheng@nvidia.com/
> does what you need.
>
Thanks for pointing this out. I’ve tested the patch, and it works for me.
>>
>> For platforms where all cache ways are marked shareable, do you think
>> providing a extra parameter to ask cat_test to "ignore" the share
>> restriction is acceptable?
>
> While resctrl tests support command line arguments I do not know if they
> are actually being used. During a previous rework we found that they were
> not behaving as intended and we did not receive any complaints. Even if
> somebody uses the hypothetical "ignore" parameter I do not see how the test
> result can be trusted unless this is done as part of some hardware validation
> that resctrl selftests do not aim to support. resctrl selftests are intended to
> test the resctrl kernel subsystem.
>
> I think effort is better spent on creating an actual CAT functional test.
> For reference: https://lore.kernel.org/lkml/20250616082453.3725-1-ilpo.jarvinen@linux.intel.com/
>
If I understand correctly, what you suggest is that if the machine does
not have
exclusive cache ways, it is not suitable for kselftest performance
tests. The
only reliable tests are functional tests to verify that the CBM is written
correctly, and so on. I'll check if Ilpo's patch set could be leveraged on
this share-cache machine.
thanks,
Chenyu
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] selftests/resctrl: Allow CAT testing when no exclusive cache exists
2026-05-27 2:24 ` Reinette Chatre
2026-05-27 4:52 ` Chen, Yu C
@ 2026-05-27 9:49 ` Ilpo Järvinen
1 sibling, 0 replies; 8+ messages in thread
From: Ilpo Järvinen @ 2026-05-27 9:49 UTC (permalink / raw)
To: Reinette Chatre
Cc: Chen, Yu C, Tony Luck, x86, Dave Martin, James Morse, Babu Moger,
LKML, linux-kselftest, Hongyu Ning
On Tue, 26 May 2026, Reinette Chatre wrote:
> On 5/26/26 6:57 PM, Chen, Yu C wrote:
> > My thinking was that shareable_bits only describes portions that may
> > be shared with non-CPU agents, and on an otherwise idle test system
> > the CAT miss-rate trend can still be observed even if all ways are
> > marked shareable. But I agree that this is not a good assumption for
> > kselftest pass/fail.
> >
> > So I agree that falling back to the full CBM is not the right fix for
> > this test. I will change the patch to skip L3_CAT when no exclusive
> > cache portion is available, with a message explaining that the performance
> > test cannot run reliably because all cache portions are shareable.
>
> Sounds like https://lore.kernel.org/lkml/20260526024251.7895-1-icheng@nvidia.com/
> does what you need.
>
> >
> > For platforms where all cache ways are marked shareable, do you think
> > providing a extra parameter to ask cat_test to "ignore" the share
> > restriction is acceptable?
>
> While resctrl tests support command line arguments I do not know if they
> are actually being used. During a previous rework we found that they were
> not behaving as intended and we did not receive any complaints. Even if
> somebody uses the hypothetical "ignore" parameter I do not see how the test
> result can be trusted unless this is done as part of some hardware validation
> that resctrl selftests do not aim to support. resctrl selftests are intended to
> test the resctrl kernel subsystem.
>
> I think effort is better spent on creating an actual CAT functional test.
>
> For reference: https://lore.kernel.org/lkml/20250616082453.3725-1-ilpo.jarvinen@linux.intel.com/
Unfortunately I got stuck with that series as I couldn't figure out how
to bend the build system to get the msr code out of resctrl selftest
(I've tried it multiple times). Other than that challenge, I'd have the
other comments addressed in my local version.
--
i.
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2026-05-27 9:50 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-23 10:17 [PATCH] selftests/resctrl: Allow CAT testing when no exclusive cache exists Chen Yu
2026-05-25 10:01 ` Ilpo Järvinen
2026-05-25 11:59 ` Chen, Yu C
2026-05-26 15:25 ` Reinette Chatre
2026-05-27 1:57 ` Chen, Yu C
2026-05-27 2:24 ` Reinette Chatre
2026-05-27 4:52 ` Chen, Yu C
2026-05-27 9:49 ` Ilpo Järvinen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox