Hi Maciej,
On 12/2/24 3:08 AM, Maciej Wieczor-Retman wrote:
diff --git a/tools/testing/selftests/resctrl/resctrlfs.c b/tools/testing/selftests/resctrl/resctrlfs.c index 50561993d37c..d0a5c0f78397 100644 --- a/tools/testing/selftests/resctrl/resctrlfs.c +++ b/tools/testing/selftests/resctrl/resctrlfs.c @@ -949,3 +949,35 @@ unsigned int count_bits(unsigned long n) return count; }
+/**
- snc_kernel_support - Check for existence of mon_sub_L3_00 file that indicates
- SNC resctrl support on the kernel side.
- Return: 0 if not supported, 1 if SNC is disabled or SNC discovery is
- unreliable or SNC is both enabled and supported.
- */
+int snc_kernel_support(void) +{
- char node_path[PATH_MAX];
- struct stat statbuf;
- int ret;
- ret = snc_nodes_per_l3_cache();
- /*
* If SNC is disabled then its kernel support isn't important. If SNC
* got disabled because the discovery process was unreliable the
* snc_unreliable variable was set. It can be used to verify the SNC
* discovery reliability elsewhere in the selftest.
*/
- if (ret == 1)
return ret;
- snprintf(node_path, sizeof(node_path), "%s/%s/%s", RESCTRL_PATH, "mon_data",
"mon_L3_00/mon_sub_L3_00");
The patch looks good. I am curious why the string constants are split in two and not, for example, a single constant of "mon_data/mon_L3_00/mon_sub_L3_00"?
- if (!stat(node_path, &statbuf))
return 1;
- return 0;
+}
Reinette