selftests/resctrl: Rename resource ID to domain ID
authorIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
Fri, 15 Dec 2023 15:05:14 +0000 (17:05 +0200)
committerShuah Khan <skhan@linuxfoundation.org>
Tue, 13 Feb 2024 20:56:45 +0000 (13:56 -0700)
Kernel-side calls the instances of a resource domains.

Change the resource_id naming in the selftest code to domain_id to
match the kernel side better.

Suggested-by: Maciej Wieczór-Retman <maciej.wieczor-retman@intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Reviewed-by: Reinette Chatre <reinette.chatre@intel.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
tools/testing/selftests/resctrl/resctrl.h
tools/testing/selftests/resctrl/resctrl_val.c
tools/testing/selftests/resctrl/resctrlfs.c

index 97d16daf81907c1db8c318c65ca32e750c523276..d4eef20723fcd332cd256dd08a6584ab39d091e1 100644 (file)
@@ -129,7 +129,7 @@ extern char llc_occup_path[1024];
 int get_vendor(void);
 bool check_resctrlfs_support(void);
 int filter_dmesg(void);
-int get_resource_id(int cpu_no, int *resource_id);
+int get_domain_id(int cpu_no, int *domain_id);
 int mount_resctrlfs(void);
 int umount_resctrlfs(void);
 int validate_bw_report_request(char *bw_report);
index 16ad91ccbcd324250a265f66b9546e673d33a278..631e5f055694279a1d19b72fd5c2f920760c018c 100644 (file)
@@ -387,20 +387,20 @@ static int get_mem_bw_imc(int cpu_no, char *bw_report, float *bw_imc)
        return 0;
 }
 
-void set_mbm_path(const char *ctrlgrp, const char *mongrp, int resource_id)
+void set_mbm_path(const char *ctrlgrp, const char *mongrp, int domain_id)
 {
        if (ctrlgrp && mongrp)
                sprintf(mbm_total_path, CON_MON_MBM_LOCAL_BYTES_PATH,
-                       RESCTRL_PATH, ctrlgrp, mongrp, resource_id);
+                       RESCTRL_PATH, ctrlgrp, mongrp, domain_id);
        else if (!ctrlgrp && mongrp)
                sprintf(mbm_total_path, MON_MBM_LOCAL_BYTES_PATH, RESCTRL_PATH,
-                       mongrp, resource_id);
+                       mongrp, domain_id);
        else if (ctrlgrp && !mongrp)
                sprintf(mbm_total_path, CON_MBM_LOCAL_BYTES_PATH, RESCTRL_PATH,
-                       ctrlgrp, resource_id);
+                       ctrlgrp, domain_id);
        else if (!ctrlgrp && !mongrp)
                sprintf(mbm_total_path, MBM_LOCAL_BYTES_PATH, RESCTRL_PATH,
-                       resource_id);
+                       domain_id);
 }
 
 /*
@@ -413,23 +413,23 @@ void set_mbm_path(const char *ctrlgrp, const char *mongrp, int resource_id)
 static void initialize_mem_bw_resctrl(const char *ctrlgrp, const char *mongrp,
                                      int cpu_no, char *resctrl_val)
 {
-       int resource_id;
+       int domain_id;
 
-       if (get_resource_id(cpu_no, &resource_id) < 0) {
-               ksft_print_msg("Could not get resource_id\n");
+       if (get_domain_id(cpu_no, &domain_id) < 0) {
+               ksft_print_msg("Could not get domain ID\n");
                return;
        }
 
        if (!strncmp(resctrl_val, MBM_STR, sizeof(MBM_STR)))
-               set_mbm_path(ctrlgrp, mongrp, resource_id);
+               set_mbm_path(ctrlgrp, mongrp, domain_id);
 
        if (!strncmp(resctrl_val, MBA_STR, sizeof(MBA_STR))) {
                if (ctrlgrp)
                        sprintf(mbm_total_path, CON_MBM_LOCAL_BYTES_PATH,
-                               RESCTRL_PATH, ctrlgrp, resource_id);
+                               RESCTRL_PATH, ctrlgrp, domain_id);
                else
                        sprintf(mbm_total_path, MBM_LOCAL_BYTES_PATH,
-                               RESCTRL_PATH, resource_id);
+                               RESCTRL_PATH, domain_id);
        }
 }
 
@@ -582,15 +582,15 @@ static void set_cmt_path(const char *ctrlgrp, const char *mongrp, char sock_num)
 static void initialize_llc_occu_resctrl(const char *ctrlgrp, const char *mongrp,
                                        int cpu_no, char *resctrl_val)
 {
-       int resource_id;
+       int domain_id;
 
-       if (get_resource_id(cpu_no, &resource_id) < 0) {
-               ksft_print_msg("Could not get resource_id\n");
+       if (get_domain_id(cpu_no, &domain_id) < 0) {
+               ksft_print_msg("Could not get domain ID\n");
                return;
        }
 
        if (!strncmp(resctrl_val, CMT_STR, sizeof(CMT_STR)))
-               set_cmt_path(ctrlgrp, mongrp, resource_id);
+               set_cmt_path(ctrlgrp, mongrp, domain_id);
 }
 
 static int measure_vals(const struct user_params *uparams,
index eab928c46f9813fe000a8328e247f46612709ffb..f29dc65d8b3065423d299247daa1bcc4f99a0b48 100644 (file)
@@ -112,13 +112,13 @@ static int get_cache_level(const char *cache_type)
 }
 
 /*
- * get_resource_id - Get socket number/l3 id for a specified CPU
+ * get_domain_id - Get resctrl domain ID for a specified CPU
  * @cpu_no:    CPU number
- * @resource_id: Socket number or l3_id
+ * @domain_id: domain ID (cache ID; for MB, L3 cache ID)
  *
  * Return: >= 0 on success, < 0 on failure.
  */
-int get_resource_id(int cpu_no, int *resource_id)
+int get_domain_id(int cpu_no, int *domain_id)
 {
        char phys_pkg_path[1024];
        FILE *fp;
@@ -136,8 +136,8 @@ int get_resource_id(int cpu_no, int *resource_id)
 
                return -1;
        }
-       if (fscanf(fp, "%d", resource_id) <= 0) {
-               ksft_perror("Could not get socket number or l3 id");
+       if (fscanf(fp, "%d", domain_id) <= 0) {
+               ksft_perror("Could not get domain ID");
                fclose(fp);
 
                return -1;
@@ -551,7 +551,7 @@ out:
 int write_schemata(char *ctrlgrp, char *schemata, int cpu_no, const char *resource)
 {
        char controlgroup[1024], reason[128], schema[1024] = {};
-       int resource_id, fd, schema_len, ret = 0;
+       int domain_id, fd, schema_len, ret = 0;
 
        if (!schemata) {
                ksft_print_msg("Skipping empty schemata update\n");
@@ -559,8 +559,8 @@ int write_schemata(char *ctrlgrp, char *schemata, int cpu_no, const char *resour
                return -1;
        }
 
-       if (get_resource_id(cpu_no, &resource_id) < 0) {
-               sprintf(reason, "Failed to get resource id");
+       if (get_domain_id(cpu_no, &domain_id) < 0) {
+               sprintf(reason, "Failed to get domain ID");
                ret = -1;
 
                goto out;
@@ -572,7 +572,7 @@ int write_schemata(char *ctrlgrp, char *schemata, int cpu_no, const char *resour
                sprintf(controlgroup, "%s/schemata", RESCTRL_PATH);
 
        schema_len = snprintf(schema, sizeof(schema), "%s:%d=%s\n",
-                             resource, resource_id, schemata);
+                             resource, domain_id, schemata);
        if (schema_len < 0 || schema_len >= sizeof(schema)) {
                snprintf(reason, sizeof(reason),
                         "snprintf() failed with return value : %d", schema_len);