Skip to content

Commit ca2e4f4

Browse files
rchatreshuahkh
authored andcommitted
selftests/resctrl: Remove requirement on cache miss rate
As the CAT test reads the same buffer into different sized cache portions it compares the number of cache misses against an expected percentage based on the size of the cache portion. Systems and test conditions vary. The CAT test is a test of resctrl subsystem health and not a test of the hardware architecture so it is not required to place requirements on the size of the difference in cache misses, just that the number of cache misses when reading a buffer increase as the cache portion used for the buffer decreases. Remove additional constraint on how big the difference between cache misses should be as the cache portion size changes. Only test that the cache misses increase as the cache portion size decreases. This remains a good sanity check of resctrl subsystem health while reducing impact of hardware architectural differences and the various conditions under which the test may run. Increase the size difference between cache portions to additionally avoid any consequences resulting from smaller increments. Link: https://lore.kernel.org/r/6de4da5486354c0f25fef0d194956470cb744041.1775266384.git.reinette.chatre@intel.com Signed-off-by: Reinette Chatre <reinette.chatre@intel.com> Tested-by: Chen Yu <yu.c.chen@intel.com> Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
1 parent d2ec0e8 commit ca2e4f4

1 file changed

Lines changed: 5 additions & 28 deletions

File tree

tools/testing/selftests/resctrl/cat_test.c

Lines changed: 5 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -14,42 +14,20 @@
1414
#define RESULT_FILE_NAME "result_cat"
1515
#define NUM_OF_RUNS 5
1616

17-
/*
18-
* Minimum difference in LLC misses between a test with n+1 bits CBM to the
19-
* test with n bits is MIN_DIFF_PERCENT_PER_BIT * (n - 1). With e.g. 5 vs 4
20-
* bits in the CBM mask, the minimum difference must be at least
21-
* MIN_DIFF_PERCENT_PER_BIT * (4 - 1) = 3 percent.
22-
*
23-
* The relationship between number of used CBM bits and difference in LLC
24-
* misses is not expected to be linear. With a small number of bits, the
25-
* margin is smaller than with larger number of bits. For selftest purposes,
26-
* however, linear approach is enough because ultimately only pass/fail
27-
* decision has to be made and distinction between strong and stronger
28-
* signal is irrelevant.
29-
*/
30-
#define MIN_DIFF_PERCENT_PER_BIT 1UL
31-
3217
static int show_results_info(__u64 sum_llc_val, int no_of_bits,
3318
unsigned long cache_span,
34-
unsigned long min_diff_percent,
3519
unsigned long num_of_runs, bool platform,
3620
__s64 *prev_avg_llc_val)
3721
{
3822
__u64 avg_llc_val = 0;
39-
float avg_diff;
4023
int ret = 0;
4124

4225
avg_llc_val = sum_llc_val / num_of_runs;
4326
if (*prev_avg_llc_val) {
44-
float delta = (__s64)(avg_llc_val - *prev_avg_llc_val);
45-
46-
avg_diff = delta / *prev_avg_llc_val;
47-
ret = platform && (avg_diff * 100) < (float)min_diff_percent;
48-
49-
ksft_print_msg("%s Check cache miss rate changed more than %.1f%%\n",
50-
ret ? "Fail:" : "Pass:", (float)min_diff_percent);
27+
ret = platform && (avg_llc_val < *prev_avg_llc_val);
5128

52-
ksft_print_msg("Percent diff=%.1f\n", avg_diff * 100);
29+
ksft_print_msg("%s Check cache miss rate increased\n",
30+
ret ? "Fail:" : "Pass:");
5331
}
5432
*prev_avg_llc_val = avg_llc_val;
5533

@@ -58,10 +36,10 @@ static int show_results_info(__u64 sum_llc_val, int no_of_bits,
5836
return ret;
5937
}
6038

61-
/* Remove the highest bit from CBM */
39+
/* Remove the highest bits from CBM */
6240
static unsigned long next_mask(unsigned long current_mask)
6341
{
64-
return current_mask & (current_mask >> 1);
42+
return current_mask & (current_mask >> 2);
6543
}
6644

6745
static int check_results(struct resctrl_val_param *param, const char *cache_type,
@@ -112,7 +90,6 @@ static int check_results(struct resctrl_val_param *param, const char *cache_type
11290

11391
ret = show_results_info(sum_llc_perf_miss, bits,
11492
alloc_size / 64,
115-
MIN_DIFF_PERCENT_PER_BIT * (bits - 1),
11693
runs, get_vendor() == ARCH_INTEL,
11794
&prev_avg_llc_val);
11895
if (ret)

0 commit comments

Comments
 (0)