summaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/resctrl/cmt_test.c
diff options
context:
space:
mode:
authorIlpo Järvinen <ilpo.jarvinen@linux.intel.com>2023-07-17 15:15:05 +0200
committerShuah Khan <skhan@linuxfoundation.org>2023-07-25 16:53:59 +0200
commit85b73447a44cd215815464a0981604e177384192 (patch)
tree34d624843d8a5100b8eeef93728e94f0f28c463a /tools/testing/selftests/resctrl/cmt_test.c
parentselftests/resctrl: Don't use variable argument list for ->setup() (diff)
downloadlinux-85b73447a44cd215815464a0981604e177384192.tar.xz
linux-85b73447a44cd215815464a0981604e177384192.zip
selftests/resctrl: Move CAT/CMT test global vars to function they are used in
CAT and CMT tests have count_of_bits, long_mask, cbm_mask, and cache_size global variables that can be moved into the sole using function. Make the global variables local variables of the relevant function to scope them better. While at it, move cache_size initialization into the declaration line. Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Reviewed-by: Reinette Chatre <reinette.chatre@intel.com> Tested-by: Babu Moger <babu.moger@amd.com> Tested-by: Shaopeng Tan (Fujitsu) <tan.shaopeng@fujitsu.com> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
Diffstat (limited to 'tools/testing/selftests/resctrl/cmt_test.c')
-rw-r--r--tools/testing/selftests/resctrl/cmt_test.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/tools/testing/selftests/resctrl/cmt_test.c b/tools/testing/selftests/resctrl/cmt_test.c
index 7214aefb55ed..0ac9d6bbd13d 100644
--- a/tools/testing/selftests/resctrl/cmt_test.c
+++ b/tools/testing/selftests/resctrl/cmt_test.c
@@ -16,11 +16,6 @@
#define MAX_DIFF 2000000
#define MAX_DIFF_PERCENT 15
-static int count_of_bits;
-static char cbm_mask[256];
-static unsigned long long_mask;
-static unsigned long cache_size;
-
static int cmt_setup(struct resctrl_val_param *p)
{
/* Run NUM_OF_RUNS times */
@@ -75,10 +70,12 @@ void cmt_test_cleanup(void)
int cmt_resctrl_val(int cpu_no, int n, char **benchmark_cmd)
{
+ unsigned long cache_size = 0;
+ unsigned long long_mask;
+ char cbm_mask[256];
+ int count_of_bits;
int ret;
- cache_size = 0;
-
if (!validate_resctrl_feature_request(CMT_STR))
return -1;