Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

selftests/resctrl: Do not compare performance counters and resctrl at low bandwidth

The MBA test incrementally throttles memory bandwidth, each time
followed by a comparison between the memory bandwidth observed
by the performance counters and resctrl respectively.

While a comparison between performance counters and resctrl is
generally appropriate, they do not have an identical view of
memory bandwidth. For example RAS features or memory performance
features that generate memory traffic may drive accesses that are
counted differently by performance counters and MBM respectively,
for instance generating "overhead" traffic which is not counted
against any specific RMID. As a ratio, this different view of memory
bandwidth becomes more apparent at low memory bandwidths.

It is not practical to enable/disable the various features that
may generate memory bandwidth to give performance counters and
resctrl an identical view. Instead, do not compare performance
counters and resctrl view of memory bandwidth when the memory
bandwidth is low.

Bandwidth throttling behaves differently across platforms
so it is not appropriate to drop measurement data simply based
on the throttling level. Instead, use a threshold of 750MiB
that has been observed to support adequate comparison between
performance counters and resctrl.

Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>

authored by

Reinette Chatre and committed by
Shuah Khan
501cfdba f77b9672

+17
+7
tools/testing/selftests/resctrl/mba_test.c
··· 98 98 99 99 avg_bw_imc = sum_bw_imc / (NUM_OF_RUNS - 1); 100 100 avg_bw_resc = sum_bw_resc / (NUM_OF_RUNS - 1); 101 + if (avg_bw_imc < THROTTLE_THRESHOLD || avg_bw_resc < THROTTLE_THRESHOLD) { 102 + ksft_print_msg("Bandwidth below threshold (%d MiB). Dropping results from MBA schemata %u.\n", 103 + THROTTLE_THRESHOLD, 104 + ALLOCATION_MIN + ALLOCATION_STEP * allocation); 105 + continue; 106 + } 107 + 101 108 avg_diff = (float)labs(avg_bw_resc - avg_bw_imc) / avg_bw_imc; 102 109 avg_diff_per = (int)(avg_diff * 100); 103 110
+10
tools/testing/selftests/resctrl/resctrl.h
··· 44 44 #define MINIMUM_SPAN (250 * MB) 45 45 46 46 /* 47 + * Memory bandwidth (in MiB) below which the bandwidth comparisons 48 + * between iMC and resctrl are considered unreliable. For example RAS 49 + * features or memory performance features that generate memory traffic 50 + * may drive accesses that are counted differently by performance counters 51 + * and MBM respectively, for instance generating "overhead" traffic which 52 + * is not counted against any specific RMID. 53 + */ 54 + #define THROTTLE_THRESHOLD 750 55 + 56 + /* 47 57 * fill_buf_param: "fill_buf" benchmark parameters 48 58 * @buf_size: Size (in bytes) of buffer used in benchmark. 49 59 * "fill_buf" allocates and initializes buffer of