selftests/resctrl: Allow CAT testing when no exclusive cache exists
Subsystems (2)
PATCH 1/1 selftests/resctrl: Allow CAT testing when no exclusive cache exists
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.
--- tools/testing/selftests/resctrl/cat_test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/resctrl/cat_test.c +1 -1
@@ -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);
Signature · 1 line
2.25.1
Quoted 20 lines · Chen Yu
The
shareable_bitsindicates 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_CATtest 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 <[email protected]>Signed-off-by Chen Yu <[email protected]>--- tools/testing/selftests/resctrl/cat_test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tools/testing/selftests/resctrl/cat_test.c +0
-0
tools/testing/selftests/resctrl/cat_test.c static int cat_run_test(const struct resctrl_test *test, const struct user_param · line 251
Quoted 5 lines
tools/testing/selftests/resctrl/cat_test.c +1
-1@@ -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).
Quoted 4 lines
tools/testing/selftests/resctrl/cat_test.c +0
-0/* Get L3/L2 cache size */ ret =get_cache_size (uparams->cpu, test->resource, &cache_total_size);
Signature · 1 line
i.
Hi Ilpo,
Quoted 17 lines · Ilpo Järvinen
Quoted 15 lines · Chen Yu
The
shareable_bitsindicates 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_CATtest 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 <[email protected]>Signed-off-by Chen Yu <[email protected]>--- tools/testing/selftests/resctrl/cat_test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 15 lines
tools/testing/selftests/resctrl/cat_test.c static int cat_run_test(const struct resctrl_test *test, const struct user_param · line 251
Quoted 10 lines
tools/testing/selftests/resctrl/cat_test.c +1
-1@@ -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
Reinette Chatre
maintainerHi Chenyu,
Quoted 12 lines · Yu C
Hi Ilpo,
Quoted 9 lines · Ilpo Järvinen
Quoted 7 lines · Chen Yu
The
shareable_bitsindicates 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_CATtest 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?
Quoted 24 lines
Quoted 8 lines
Quoted 8 lines
is a hint about potential interference, not a hard exclusion.
Reported-by Hongyu Ning <[email protected]>Signed-off-by Chen Yu <[email protected]>---
tools/testing/selftests/resctrl/cat_test.c| 2 +-1 file changed, 1 insertion(+), 1 deletion(-)Quoted 15 lines
tools/testing/selftests/resctrl/cat_test.c static int cat_run_test(const struct resctrl_test *test, const struct user_param · line 251
Quoted 10 lines
tools/testing/selftests/resctrl/cat_test.c +1
-1@@ -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).
Quoted 2 lines
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
Hi Reinette,
Quoted 52 lines · Reinette Chatre
Hi Chenyu,
Quoted 12 lines · Yu C
Hi Ilpo,
Quoted 9 lines · Ilpo Järvinen
Quoted 7 lines · Chen Yu
The
shareable_bitsindicates 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_CATtest 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 maskHow 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?
Quoted 24 lines
Quoted 8 lines
Quoted 8 lines
is a hint about potential interference, not a hard exclusion.
Reported-by Hongyu Ning <[email protected]>Signed-off-by Chen Yu <[email protected]>--- tools/testing/selftests/resctrl/cat_test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)Quoted 15 lines
tools/testing/selftests/resctrl/cat_test.c static int cat_run_test(const struct resctrl_test *test, const struct user_param · line 251
Quoted 10 lines
tools/testing/selftests/resctrl/cat_test.c +1
-1@@ -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).
Quoted 2 lines
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.
Quoted 5 lines
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
Reinette Chatre
maintainerHi Chenyu,
Quoted 10 lines · Yu C
My thinking was that
shareable_bitsonly 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_CATwhen 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/[email protected]/
does what you need.
Quoted 4 lines
For platforms where all cache ways are marked shareable, do you think providing a extra parameter to ask
cat_testto "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/[email protected]/
Reinette
Hi Reinette,
Quoted 9 lines · Reinette Chatre
Hi Chenyu,
Quoted 6 lines · Yu C
My thinking was that
shareable_bitsonly 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.
Quoted 8 lines
Quoted 4 lines
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_CATwhen 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/[email protected]/
does what you need.
Thanks for pointing this out. I’ve tested the patch, and it works for me.
Quoted 13 lines
Quoted 4 lines
For platforms where all cache ways are marked shareable, do you think providing a extra parameter to ask
cat_testto "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.
Quoted 3 lines
I think effort is better spent on creating an actual CAT functional test.
For reference: https://lore.kernel.org/lkml/[email protected]/
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
Quoted 28 lines · Reinette Chatre
Quoted 10 lines · Yu C
My thinking was that
shareable_bitsonly 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_CATwhen 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/[email protected]/
does what you need.Quoted 4 lines
For platforms where all cache ways are marked shareable, do you think providing a extra parameter to ask
cat_testto "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.
Quoted 3 lines
I think effort is better spent on creating an actual CAT functional test.
For reference: https://lore.kernel.org/lkml/[email protected]/
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.
Signature · 1 line
i.