Commit 2f320911 authored by Fenghua Yu's avatar Fenghua Yu Committed by Shuah Khan

selftests/resctrl: Rename CQM test as CMT test

CMT (Cache Monitoring Technology) [1] is a H/W feature that reports cache
occupancy of a process. resctrl selftest suite has a unit test to test CMT
for LLC but the test is named as CQM (Cache Quality Monitoring).
Furthermore, the unit test source file is named as cqm_test.c and several
functions, variables, comments, preprocessors and statements widely use
"cqm" as either suffix or prefix. This rampant misusage of CQM for CMT
might confuse someone who is newly looking at resctrl selftests because
this feature is named CMT in the Intel Software Developer's Manual.

Hence, rename all the occurrences (unit test source file name, functions,
variables, comments and preprocessors) of cqm with cmt.

[1] Please see Intel SDM, Volume 3, chapter 17 and section 18 for more
    information on CMT: https://software.intel.com/content/www/us/en/develop/articles/intel-sdm.htmlSuggested-by: default avatarReinette Chatre <reinette.chatre@intel.com>
Tested-by: default avatarBabu Moger <babu.moger@amd.com>
Signed-off-by: default avatarFenghua Yu <fenghua.yu@intel.com>
Signed-off-by: default avatarShuah Khan <skhan@linuxfoundation.org>
parent d7af3d0d
...@@ -46,8 +46,8 @@ ARGUMENTS ...@@ -46,8 +46,8 @@ ARGUMENTS
Parameter '-h' shows usage information. Parameter '-h' shows usage information.
usage: resctrl_tests [-h] [-b "benchmark_cmd [options]"] [-t test list] [-n no_of_bits] usage: resctrl_tests [-h] [-b "benchmark_cmd [options]"] [-t test list] [-n no_of_bits]
-b benchmark_cmd [options]: run specified benchmark for MBM, MBA and CQM default benchmark is builtin fill_buf -b benchmark_cmd [options]: run specified benchmark for MBM, MBA and CMT default benchmark is builtin fill_buf
-t test list: run tests specified in the test list, e.g. -t mbm, mba, cqm, cat -t test list: run tests specified in the test list, e.g. -t mbm, mba, cmt, cat
-n no_of_bits: run cache tests using specified no of bits in cache bit mask -n no_of_bits: run cache tests using specified no of bits in cache bit mask
-p cpu_no: specify CPU number to run the test. 1 is default -p cpu_no: specify CPU number to run the test. 1 is default
-h: help -h: help
...@@ -111,7 +111,7 @@ static int get_llc_perf(unsigned long *llc_perf_miss) ...@@ -111,7 +111,7 @@ static int get_llc_perf(unsigned long *llc_perf_miss)
/* /*
* Get LLC Occupancy as reported by RESCTRL FS * Get LLC Occupancy as reported by RESCTRL FS
* For CQM, * For CMT,
* 1. If con_mon grp and mon grp given, then read from mon grp in * 1. If con_mon grp and mon grp given, then read from mon grp in
* con_mon grp * con_mon grp
* 2. If only con_mon grp given, then read from con_mon grp * 2. If only con_mon grp given, then read from con_mon grp
...@@ -192,7 +192,7 @@ int measure_cache_vals(struct resctrl_val_param *param, int bm_pid) ...@@ -192,7 +192,7 @@ int measure_cache_vals(struct resctrl_val_param *param, int bm_pid)
/* /*
* Measure llc occupancy from resctrl. * Measure llc occupancy from resctrl.
*/ */
if (!strncmp(param->resctrl_val, CQM_STR, sizeof(CQM_STR))) { if (!strncmp(param->resctrl_val, CMT_STR, sizeof(CMT_STR))) {
ret = get_llc_occu_resctrl(&llc_occu_resc); ret = get_llc_occu_resctrl(&llc_occu_resc);
if (ret < 0) if (ret < 0)
return ret; return ret;
......
// SPDX-License-Identifier: GPL-2.0 // SPDX-License-Identifier: GPL-2.0
/* /*
* Cache Monitoring Technology (CQM) test * Cache Monitoring Technology (CMT) test
* *
* Copyright (C) 2018 Intel Corporation * Copyright (C) 2018 Intel Corporation
* *
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
#include "resctrl.h" #include "resctrl.h"
#include <unistd.h> #include <unistd.h>
#define RESULT_FILE_NAME "result_cqm" #define RESULT_FILE_NAME "result_cmt"
#define NUM_OF_RUNS 5 #define NUM_OF_RUNS 5
#define MAX_DIFF 2000000 #define MAX_DIFF 2000000
#define MAX_DIFF_PERCENT 15 #define MAX_DIFF_PERCENT 15
...@@ -21,7 +21,7 @@ static char cbm_mask[256]; ...@@ -21,7 +21,7 @@ static char cbm_mask[256];
static unsigned long long_mask; static unsigned long long_mask;
static unsigned long cache_size; static unsigned long cache_size;
static int cqm_setup(int num, ...) static int cmt_setup(int num, ...)
{ {
struct resctrl_val_param *p; struct resctrl_val_param *p;
va_list param; va_list param;
...@@ -58,7 +58,7 @@ static void show_cache_info(unsigned long sum_llc_occu_resc, int no_of_bits, ...@@ -58,7 +58,7 @@ static void show_cache_info(unsigned long sum_llc_occu_resc, int no_of_bits,
else else
res = false; res = false;
printf("%sok CQM: diff within %d, %d\%%\n", res ? "" : "not", printf("%sok CMT: diff within %d, %d\%%\n", res ? "" : "not",
MAX_DIFF, (int)MAX_DIFF_PERCENT); MAX_DIFF, (int)MAX_DIFF_PERCENT);
printf("# diff: %ld\n", avg_diff); printf("# diff: %ld\n", avg_diff);
...@@ -106,12 +106,12 @@ static int check_results(struct resctrl_val_param *param, int no_of_bits) ...@@ -106,12 +106,12 @@ static int check_results(struct resctrl_val_param *param, int no_of_bits)
return 0; return 0;
} }
void cqm_test_cleanup(void) void cmt_test_cleanup(void)
{ {
remove(RESULT_FILE_NAME); remove(RESULT_FILE_NAME);
} }
int cqm_resctrl_val(int cpu_no, int n, char **benchmark_cmd) int cmt_resctrl_val(int cpu_no, int n, char **benchmark_cmd)
{ {
int ret, mum_resctrlfs; int ret, mum_resctrlfs;
...@@ -122,7 +122,7 @@ int cqm_resctrl_val(int cpu_no, int n, char **benchmark_cmd) ...@@ -122,7 +122,7 @@ int cqm_resctrl_val(int cpu_no, int n, char **benchmark_cmd)
if (ret) if (ret)
return ret; return ret;
if (!validate_resctrl_feature_request("cqm")) if (!validate_resctrl_feature_request(CMT_STR))
return -1; return -1;
ret = get_cbm_mask("L3", cbm_mask); ret = get_cbm_mask("L3", cbm_mask);
...@@ -145,7 +145,7 @@ int cqm_resctrl_val(int cpu_no, int n, char **benchmark_cmd) ...@@ -145,7 +145,7 @@ int cqm_resctrl_val(int cpu_no, int n, char **benchmark_cmd)
} }
struct resctrl_val_param param = { struct resctrl_val_param param = {
.resctrl_val = CQM_STR, .resctrl_val = CMT_STR,
.ctrlgrp = "c1", .ctrlgrp = "c1",
.mongrp = "m1", .mongrp = "m1",
.cpu_no = cpu_no, .cpu_no = cpu_no,
...@@ -154,7 +154,7 @@ int cqm_resctrl_val(int cpu_no, int n, char **benchmark_cmd) ...@@ -154,7 +154,7 @@ int cqm_resctrl_val(int cpu_no, int n, char **benchmark_cmd)
.mask = ~(long_mask << n) & long_mask, .mask = ~(long_mask << n) & long_mask,
.span = cache_size * n / count_of_bits, .span = cache_size * n / count_of_bits,
.num_of_runs = 0, .num_of_runs = 0,
.setup = cqm_setup, .setup = cmt_setup,
}; };
if (strcmp(benchmark_cmd[0], "fill_buf") == 0) if (strcmp(benchmark_cmd[0], "fill_buf") == 0)
...@@ -170,7 +170,7 @@ int cqm_resctrl_val(int cpu_no, int n, char **benchmark_cmd) ...@@ -170,7 +170,7 @@ int cqm_resctrl_val(int cpu_no, int n, char **benchmark_cmd)
if (ret) if (ret)
return ret; return ret;
cqm_test_cleanup(); cmt_test_cleanup();
return 0; return 0;
} }
...@@ -64,7 +64,7 @@ struct resctrl_val_param { ...@@ -64,7 +64,7 @@ struct resctrl_val_param {
#define MBM_STR "mbm" #define MBM_STR "mbm"
#define MBA_STR "mba" #define MBA_STR "mba"
#define CQM_STR "cqm" #define CMT_STR "cmt"
#define CAT_STR "cat" #define CAT_STR "cat"
extern pid_t bm_pid, ppid; extern pid_t bm_pid, ppid;
...@@ -103,9 +103,9 @@ void ctrlc_handler(int signum, siginfo_t *info, void *ptr); ...@@ -103,9 +103,9 @@ void ctrlc_handler(int signum, siginfo_t *info, void *ptr);
int cat_val(struct resctrl_val_param *param); int cat_val(struct resctrl_val_param *param);
void cat_test_cleanup(void); void cat_test_cleanup(void);
int cat_perf_miss_val(int cpu_no, int no_of_bits, char *cache_type); int cat_perf_miss_val(int cpu_no, int no_of_bits, char *cache_type);
int cqm_resctrl_val(int cpu_no, int n, char **benchmark_cmd); int cmt_resctrl_val(int cpu_no, int n, char **benchmark_cmd);
unsigned int count_bits(unsigned long n); unsigned int count_bits(unsigned long n);
void cqm_test_cleanup(void); void cmt_test_cleanup(void);
int get_core_sibling(int cpu_no); int get_core_sibling(int cpu_no);
int measure_cache_vals(struct resctrl_val_param *param, int bm_pid); int measure_cache_vals(struct resctrl_val_param *param, int bm_pid);
......
...@@ -37,10 +37,10 @@ void detect_amd(void) ...@@ -37,10 +37,10 @@ void detect_amd(void)
static void cmd_help(void) static void cmd_help(void)
{ {
printf("usage: resctrl_tests [-h] [-b \"benchmark_cmd [options]\"] [-t test list] [-n no_of_bits]\n"); printf("usage: resctrl_tests [-h] [-b \"benchmark_cmd [options]\"] [-t test list] [-n no_of_bits]\n");
printf("\t-b benchmark_cmd [options]: run specified benchmark for MBM, MBA and CQM"); printf("\t-b benchmark_cmd [options]: run specified benchmark for MBM, MBA and CMT");
printf("\t default benchmark is builtin fill_buf\n"); printf("\t default benchmark is builtin fill_buf\n");
printf("\t-t test list: run tests specified in the test list, "); printf("\t-t test list: run tests specified in the test list, ");
printf("e.g. -t mbm, mba, cqm, cat\n"); printf("e.g. -t mbm, mba, cmt, cat\n");
printf("\t-n no_of_bits: run cache tests using specified no of bits in cache bit mask\n"); printf("\t-n no_of_bits: run cache tests using specified no of bits in cache bit mask\n");
printf("\t-p cpu_no: specify CPU number to run the test. 1 is default\n"); printf("\t-p cpu_no: specify CPU number to run the test. 1 is default\n");
printf("\t-h: help\n"); printf("\t-h: help\n");
...@@ -50,13 +50,13 @@ void tests_cleanup(void) ...@@ -50,13 +50,13 @@ void tests_cleanup(void)
{ {
mbm_test_cleanup(); mbm_test_cleanup();
mba_test_cleanup(); mba_test_cleanup();
cqm_test_cleanup(); cmt_test_cleanup();
cat_test_cleanup(); cat_test_cleanup();
} }
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
bool has_ben = false, mbm_test = true, mba_test = true, cqm_test = true; bool has_ben = false, mbm_test = true, mba_test = true, cmt_test = true;
int res, c, cpu_no = 1, span = 250, argc_new = argc, i, no_of_bits = 5; int res, c, cpu_no = 1, span = 250, argc_new = argc, i, no_of_bits = 5;
char *benchmark_cmd[BENCHMARK_ARGS], bw_report[64], bm_type[64]; char *benchmark_cmd[BENCHMARK_ARGS], bw_report[64], bm_type[64];
char benchmark_cmd_area[BENCHMARK_ARGS][BENCHMARK_ARG_SIZE]; char benchmark_cmd_area[BENCHMARK_ARGS][BENCHMARK_ARG_SIZE];
...@@ -82,15 +82,15 @@ int main(int argc, char **argv) ...@@ -82,15 +82,15 @@ int main(int argc, char **argv)
mbm_test = false; mbm_test = false;
mba_test = false; mba_test = false;
cqm_test = false; cmt_test = false;
cat_test = false; cat_test = false;
while (token) { while (token) {
if (!strncmp(token, MBM_STR, sizeof(MBM_STR))) { if (!strncmp(token, MBM_STR, sizeof(MBM_STR))) {
mbm_test = true; mbm_test = true;
} else if (!strncmp(token, MBA_STR, sizeof(MBA_STR))) { } else if (!strncmp(token, MBA_STR, sizeof(MBA_STR))) {
mba_test = true; mba_test = true;
} else if (!strncmp(token, CQM_STR, sizeof(CQM_STR))) { } else if (!strncmp(token, CMT_STR, sizeof(CMT_STR))) {
cqm_test = true; cmt_test = true;
} else if (!strncmp(token, CAT_STR, sizeof(CAT_STR))) { } else if (!strncmp(token, CAT_STR, sizeof(CAT_STR))) {
cat_test = true; cat_test = true;
} else { } else {
...@@ -178,13 +178,13 @@ int main(int argc, char **argv) ...@@ -178,13 +178,13 @@ int main(int argc, char **argv)
tests_run++; tests_run++;
} }
if (cqm_test) { if (cmt_test) {
printf("# Starting CQM test ...\n"); printf("# Starting CMT test ...\n");
if (!has_ben) if (!has_ben)
sprintf(benchmark_cmd[5], "%s", CQM_STR); sprintf(benchmark_cmd[5], "%s", CMT_STR);
res = cqm_resctrl_val(cpu_no, no_of_bits, benchmark_cmd); res = cmt_resctrl_val(cpu_no, no_of_bits, benchmark_cmd);
printf("%sok CQM: test\n", res ? "not " : ""); printf("%sok CMT: test\n", res ? "not " : "");
cqm_test_cleanup(); cmt_test_cleanup();
tests_run++; tests_run++;
} }
......
...@@ -492,7 +492,7 @@ static int print_results_bw(char *filename, int bm_pid, float bw_imc, ...@@ -492,7 +492,7 @@ static int print_results_bw(char *filename, int bm_pid, float bw_imc,
return 0; return 0;
} }
static void set_cqm_path(const char *ctrlgrp, const char *mongrp, char sock_num) static void set_cmt_path(const char *ctrlgrp, const char *mongrp, char sock_num)
{ {
if (strlen(ctrlgrp) && strlen(mongrp)) if (strlen(ctrlgrp) && strlen(mongrp))
sprintf(llc_occup_path, CON_MON_LCC_OCCUP_PATH, RESCTRL_PATH, sprintf(llc_occup_path, CON_MON_LCC_OCCUP_PATH, RESCTRL_PATH,
...@@ -512,7 +512,7 @@ static void set_cqm_path(const char *ctrlgrp, const char *mongrp, char sock_num) ...@@ -512,7 +512,7 @@ static void set_cqm_path(const char *ctrlgrp, const char *mongrp, char sock_num)
* @ctrlgrp: Name of the control monitor group (con_mon grp) * @ctrlgrp: Name of the control monitor group (con_mon grp)
* @mongrp: Name of the monitor group (mon grp) * @mongrp: Name of the monitor group (mon grp)
* @cpu_no: CPU number that the benchmark PID is binded to * @cpu_no: CPU number that the benchmark PID is binded to
* @resctrl_val: Resctrl feature (Eg: cat, cqm.. etc) * @resctrl_val: Resctrl feature (Eg: cat, cmt.. etc)
*/ */
static void initialize_llc_occu_resctrl(const char *ctrlgrp, const char *mongrp, static void initialize_llc_occu_resctrl(const char *ctrlgrp, const char *mongrp,
int cpu_no, char *resctrl_val) int cpu_no, char *resctrl_val)
...@@ -524,8 +524,8 @@ static void initialize_llc_occu_resctrl(const char *ctrlgrp, const char *mongrp, ...@@ -524,8 +524,8 @@ static void initialize_llc_occu_resctrl(const char *ctrlgrp, const char *mongrp,
return; return;
} }
if (!strncmp(resctrl_val, CQM_STR, sizeof(CQM_STR))) if (!strncmp(resctrl_val, CMT_STR, sizeof(CMT_STR)))
set_cqm_path(ctrlgrp, mongrp, resource_id); set_cmt_path(ctrlgrp, mongrp, resource_id);
} }
static int static int
...@@ -682,7 +682,7 @@ int resctrl_val(char **benchmark_cmd, struct resctrl_val_param *param) ...@@ -682,7 +682,7 @@ int resctrl_val(char **benchmark_cmd, struct resctrl_val_param *param)
initialize_mem_bw_resctrl(param->ctrlgrp, param->mongrp, initialize_mem_bw_resctrl(param->ctrlgrp, param->mongrp,
param->cpu_no, resctrl_val); param->cpu_no, resctrl_val);
} else if (!strncmp(resctrl_val, CQM_STR, sizeof(CQM_STR))) } else if (!strncmp(resctrl_val, CMT_STR, sizeof(CMT_STR)))
initialize_llc_occu_resctrl(param->ctrlgrp, param->mongrp, initialize_llc_occu_resctrl(param->ctrlgrp, param->mongrp,
param->cpu_no, resctrl_val); param->cpu_no, resctrl_val);
...@@ -721,7 +721,7 @@ int resctrl_val(char **benchmark_cmd, struct resctrl_val_param *param) ...@@ -721,7 +721,7 @@ int resctrl_val(char **benchmark_cmd, struct resctrl_val_param *param)
ret = measure_vals(param, &bw_resc_start); ret = measure_vals(param, &bw_resc_start);
if (ret) if (ret)
break; break;
} else if (!strncmp(resctrl_val, CQM_STR, sizeof(CQM_STR))) { } else if (!strncmp(resctrl_val, CMT_STR, sizeof(CMT_STR))) {
ret = param->setup(1, param); ret = param->setup(1, param);
if (ret) { if (ret) {
ret = 0; ret = 0;
......
...@@ -334,7 +334,7 @@ void run_benchmark(int signum, siginfo_t *info, void *ucontext) ...@@ -334,7 +334,7 @@ void run_benchmark(int signum, siginfo_t *info, void *ucontext)
operation = atoi(benchmark_cmd[4]); operation = atoi(benchmark_cmd[4]);
sprintf(resctrl_val, "%s", benchmark_cmd[5]); sprintf(resctrl_val, "%s", benchmark_cmd[5]);
if (strncmp(resctrl_val, CQM_STR, sizeof(CQM_STR))) if (strncmp(resctrl_val, CMT_STR, sizeof(CMT_STR)))
buffer_span = span * MB; buffer_span = span * MB;
else else
buffer_span = span; buffer_span = span;
...@@ -458,8 +458,8 @@ int write_bm_pid_to_resctrl(pid_t bm_pid, char *ctrlgrp, char *mongrp, ...@@ -458,8 +458,8 @@ int write_bm_pid_to_resctrl(pid_t bm_pid, char *ctrlgrp, char *mongrp,
if (ret) if (ret)
goto out; goto out;
/* Create mon grp and write pid into it for "mbm" and "cqm" test */ /* Create mon grp and write pid into it for "mbm" and "cmt" test */
if (!strncmp(resctrl_val, CQM_STR, sizeof(CQM_STR)) || if (!strncmp(resctrl_val, CMT_STR, sizeof(CMT_STR)) ||
!strncmp(resctrl_val, MBM_STR, sizeof(MBM_STR))) { !strncmp(resctrl_val, MBM_STR, sizeof(MBM_STR))) {
if (strlen(mongrp)) { if (strlen(mongrp)) {
sprintf(monitorgroup_p, "%s/mon_groups", controlgroup); sprintf(monitorgroup_p, "%s/mon_groups", controlgroup);
...@@ -507,7 +507,7 @@ int write_schemata(char *ctrlgrp, char *schemata, int cpu_no, char *resctrl_val) ...@@ -507,7 +507,7 @@ int write_schemata(char *ctrlgrp, char *schemata, int cpu_no, char *resctrl_val)
if (strncmp(resctrl_val, MBA_STR, sizeof(MBA_STR)) && if (strncmp(resctrl_val, MBA_STR, sizeof(MBA_STR)) &&
strncmp(resctrl_val, CAT_STR, sizeof(CAT_STR)) && strncmp(resctrl_val, CAT_STR, sizeof(CAT_STR)) &&
strncmp(resctrl_val, CQM_STR, sizeof(CQM_STR))) strncmp(resctrl_val, CMT_STR, sizeof(CMT_STR)))
return -ENOENT; return -ENOENT;
if (!schemata) { if (!schemata) {
...@@ -529,7 +529,7 @@ int write_schemata(char *ctrlgrp, char *schemata, int cpu_no, char *resctrl_val) ...@@ -529,7 +529,7 @@ int write_schemata(char *ctrlgrp, char *schemata, int cpu_no, char *resctrl_val)
sprintf(controlgroup, "%s/schemata", RESCTRL_PATH); sprintf(controlgroup, "%s/schemata", RESCTRL_PATH);
if (!strncmp(resctrl_val, CAT_STR, sizeof(CAT_STR)) || if (!strncmp(resctrl_val, CAT_STR, sizeof(CAT_STR)) ||
!strncmp(resctrl_val, CQM_STR, sizeof(CQM_STR))) !strncmp(resctrl_val, CMT_STR, sizeof(CMT_STR)))
sprintf(schema, "%s%d%c%s", "L3:", resource_id, '=', schemata); sprintf(schema, "%s%d%c%s", "L3:", resource_id, '=', schemata);
if (!strncmp(resctrl_val, MBA_STR, sizeof(MBA_STR))) if (!strncmp(resctrl_val, MBA_STR, sizeof(MBA_STR)))
sprintf(schema, "%s%d%c%s", "MB:", resource_id, '=', schemata); sprintf(schema, "%s%d%c%s", "MB:", resource_id, '=', schemata);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment