selftests/resctrl: Remove test type checks from cat_val()
authorIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
Mon, 17 Jul 2023 13:15:07 +0000 (16:15 +0300)
committerShuah Khan <skhan@linuxfoundation.org>
Tue, 25 Jul 2023 14:54:11 +0000 (08:54 -0600)
cat_val() is only used during CAT test but it checks for test type.

Remove test type checks and the unused else branch from cat_val().

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>
tools/testing/selftests/resctrl/cache.c

index 18ebd1324cb3b491e8812d6b5114c16bf3455293..d3cbb829ff6a70db3e1ad1f0442e326b24af223c 100644 (file)
@@ -230,38 +230,31 @@ int cat_val(struct resctrl_val_param *param)
        if (ret)
                return ret;
 
-       if (!strncmp(resctrl_val, CAT_STR, sizeof(CAT_STR)))
-               initialize_llc_perf();
+       initialize_llc_perf();
 
        /* Test runs until the callback setup() tells the test to stop. */
        while (1) {
-               if (!strncmp(resctrl_val, CAT_STR, sizeof(CAT_STR))) {
-                       ret = param->setup(param);
-                       if (ret == END_OF_TESTS) {
-                               ret = 0;
-                               break;
-                       }
-                       if (ret < 0)
-                               break;
-                       ret = reset_enable_llc_perf(bm_pid, param->cpu_no);
-                       if (ret)
-                               break;
-
-                       if (run_fill_buf(param->span, memflush, operation, true)) {
-                               fprintf(stderr, "Error-running fill buffer\n");
-                               ret = -1;
-                               goto pe_close;
-                       }
-
-                       sleep(1);
-                       ret = measure_cache_vals(param, bm_pid);
-                       if (ret)
-                               goto pe_close;
-
-                       close(fd_lm);
-               } else {
+               ret = param->setup(param);
+               if (ret == END_OF_TESTS) {
+                       ret = 0;
                        break;
                }
+               if (ret < 0)
+                       break;
+               ret = reset_enable_llc_perf(bm_pid, param->cpu_no);
+               if (ret)
+                       break;
+
+               if (run_fill_buf(param->span, memflush, operation, true)) {
+                       fprintf(stderr, "Error-running fill buffer\n");
+                       ret = -1;
+                       goto pe_close;
+               }
+
+               sleep(1);
+               ret = measure_cache_vals(param, bm_pid);
+               if (ret)
+                       goto pe_close;
        }
 
        return ret;