lkml.org 
[lkml]   [2020]   [Oct]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v3 06/21] selftests/resctrl: Check for resctrl mount point only if resctrl FS is supported
Date
check_resctrlfs_support() does the following
1. Checks if the platform supports resctrl file system or not by looking
for resctrl in /proc/filesystems
2. Calls opendir() on default resctrl file system path
(i.e. /sys/fs/resctrl)
3. Checks if resctrl file system is mounted or not by looking at
/proc/mounts

Steps 2 and 3 will fail if the platform does not support resctrl file
system. So, there is no need to check for them if step 1 fails.

Fix this by returning immediately if the platform does not support
resctrl file system.

Fixes: ecdbb911f22d ("selftests/resctrl: Add MBM test")
Signed-off-by: Fenghua Yu <fenghua.yu@intel.com>
---
tools/testing/selftests/resctrl/resctrlfs.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/tools/testing/selftests/resctrl/resctrlfs.c b/tools/testing/selftests/resctrl/resctrlfs.c
index 727e667e2cc9..e43ddebd1aa4 100644
--- a/tools/testing/selftests/resctrl/resctrlfs.c
+++ b/tools/testing/selftests/resctrl/resctrlfs.c
@@ -581,6 +581,9 @@ bool check_resctrlfs_support(void)
printf("%sok kernel supports resctrl filesystem\n", ret ? "" : "not ");
tests_run++;

+ if (!ret)
+ return ret;
+
dp = opendir(RESCTRL_PATH);
printf("%sok resctrl mountpoint \"%s\" exists\n",
dp ? "" : "not ", RESCTRL_PATH);
--
2.29.0
\
 
 \ /
  Last update: 2020-10-21 01:53    [W:0.120 / U:0.332 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site