Skip to contentSkip to conversation

tst_sys_conf.c: Report TCONF if read path trigger error such as EOPNOTSUPP

PATCH In review Wei Gao via ltp 3 participants 7 messages Sep 2, 2025 – Sep 10, 2025 Library code

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tst_sys_conf.c: Report TCONF if read path trigger error such as EOPNOTSUPP

We encounter EOPNOTSUPP error when read path in old sle power test env, the reason is hugepages are disabled. Detail error information such as:
TEST cpuset02:
tst_sys_conf.c:103: TBROK: Failed to read anything from '/proc/sys/vm/nr_hugepages': EOPNOTSUPP (95)

---
 lib/tst_sys_conf.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
lib/tst_sys_conf.c +2 -1
index 80cd83569..30b0b67a8 100644
@@ -99,7 +99,8 @@ int tst_sys_conf_save(const struct tst_path_val *conf)
 		if (conf->flags & TST_SR_IGNORE_ERR)
 			return 1;
 
-		tst_brk(TBROK | TERRNO, "Failed to read anything from '%s'",
+		ttype = conf->flags ? TBROK : TCONF;
+		tst_brk(ttype | TERRNO, "Failed to read anything from '%s'",
 			conf->path);
 	}
 
Signature · 5 lines
2.51.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#1 lore raw

Hi!

Quoted 15 lines

We encounter EOPNOTSUPP error when read path in old sle power test env, the reason is hugepages are disabled. Detail error information such as:
TEST cpuset02:
tst_sys_conf.c:103: TBROK: Failed to read anything from '/proc/sys/vm/nr_hugepages': EOPNOTSUPP (95)

---
 lib/tst_sys_conf.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
lib/tst_sys_conf.c +0 -0
index 80cd83569..30b0b67a8 100644

lib/tst_sys_conf.c int tst_sys_conf_save(const struct tst_path_val *conf) · line 102

Quoted 5 lines
lib/tst_sys_conf.c +1 -1
@@ -99,7 +99,8 @@ int tst_sys_conf_save(const struct tst_path_val *conf)
 		if (conf->flags & TST_SR_IGNORE_ERR)
 			return 1;
 
-		tst_brk(TBROK | TERRNO, "Failed to read anything from '%s'",
+		ttype = conf->flags ? TBROK : TCONF;

This is wrong for two reasons:

We have to make sure to use the correct flag here. I suppose that we can treat the EOPNOTSUPP the same as the file to be missing. So we would change the outcome based on the TST_SR_*_MISSING flags.

All errnos but EOPNOTSUPP should be treated as a TBROK as they were before.

Quoted 10 lines
lib/tst_sys_conf.c +1 -0
+		tst_brk(ttype | TERRNO, "Failed to read anything from '%s'",
 			conf->path);
 	}
 
Signature · 5 lines
2.51.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
Signature · 5 lines
Cyril Hrubis
[email protected]

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#2 lore raw
In reply to Wei Gao via ltp

Hi,
I don't see any reason to make this change. You should remove the .save_restore in cpuset02 instead because it's pointless. You don't change the value in /proc/sys/vm/nr_hugepages as far as I can tell and the file doesn't need to be restored even if you did.

Quoted 24 lines · Wei Gao via ltp

We encounter EOPNOTSUPP error when read path in old sle power test env, the reason is hugepages are disabled. Detail error information such as:
TEST cpuset02:
tst_sys_conf.c:103: TBROK: Failed to read anything from '/proc/sys/vm/nr_hugepages': EOPNOTSUPP (95)

---
  lib/tst_sys_conf.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
lib/tst_sys_conf.c +2 -1
index 80cd83569..30b0b67a8 100644
@@ -99,7 +99,8 @@ int tst_sys_conf_save(const struct tst_path_val *conf)
  		if (conf->flags & TST_SR_IGNORE_ERR)
  			return 1;
 
-		tst_brk(TBROK | TERRNO, "Failed to read anything from '%s'",
+		ttype = conf->flags ? TBROK : TCONF;
+		tst_brk(ttype | TERRNO, "Failed to read anything from '%s'",
  			conf->path);
  	}
 
Signature · 10 lines
Martin Doucha   [email protected]
SW Quality Engineer
SUSE LINUX, s.r.o.
CORSO IIa
Krizikova 148/34
186 00 Prague 8
Czech Republic

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#3 lore raw

v2 cover tst_test.c: Add hugepage check in prepare_and_mount_hugetlb_fs

In reply to Wei Gao via ltp

Wei Gao (2):
tst_test.c: Add hugepage check in prepare_and_mount_hugetlb_fs cpuset02.c: Remove unnecessary .save_restore setting

 lib/tst_test.c                         | 4 ++++
 testcases/kernel/mem/cpuset/cpuset02.c | 4 ----
 2 files changed, 4 insertions(+), 4 deletions(-)
Signature · 5 lines
2.51.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#4 lore raw

PATCH v2 1/2 tst_test.c: Add hugepage check in prepare_and_mount_hugetlb_fs

If test case only enable .needs_hugetlbfs without .hugepages then will trigger mount error in prepare_and_mount_hugetlb_fs. So Add hugepage check within prepare_and_mount_hugetlb_fs.

---
 lib/tst_test.c | 4 ++++
 1 file changed, 4 insertions(+)
lib/tst_test.c +4 -0
index b8894f782..2217595e6 100644
@@ -38,6 +38,7 @@
 #include "old_device.h"
 #include "old_tmpdir.h"
 #include "ltp-version.h"
+#include "tst_hugepage.h"
 
 /*
  * Hack to get TCID defined in newlib tests
@@ -1192,6 +1193,9 @@ static void prepare_and_mount_dev_fs(const char *mntpoint)
 
 static void prepare_and_mount_hugetlb_fs(void)
 {
+	if (access(PATH_HUGEPAGES, F_OK))
+		tst_brk(TCONF, "hugetlbfs is not supported");
+
 	SAFE_MOUNT("none", tst_test->mntpoint, "hugetlbfs", 0, NULL);
 	context->mntpoint_mounted = 1;
 }
Signature · 5 lines
2.51.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#5 lore raw

PATCH v2 2/2 cpuset02.c: Remove unnecessary .save_restore setting

In reply to Wei Gao via ltp
---
 testcases/kernel/mem/cpuset/cpuset02.c | 4 ----
 1 file changed, 4 deletions(-)
testcases/kernel/mem/cpuset/cpuset02.c +0 -4
index 25f778806..ccfddd6a2 100644
@@ -121,10 +121,6 @@ static struct tst_test test = {
 	.forks_child = 1,
 	.test_all = run_test,
 	.needs_cgroup_ctrls = (const char *const []){ "cpuset", NULL },
-	.save_restore = (const struct tst_path_val[]) {
-		{"/proc/sys/vm/nr_hugepages", NULL, TST_SR_TCONF},
-		{}
-	},
 };
 
 #else
Signature · 5 lines
2.51.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp