All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH v2 0/5] Add support for .max_kver
@ 2026-07-29  9:57 Petr Vorel
  2026-07-29  9:57 ` [LTP] [PATCH v2 1/5] lib: Rename function check_kver() => check_min_kver() Petr Vorel
                   ` (5 more replies)
  0 siblings, 6 replies; 10+ messages in thread
From: Petr Vorel @ 2026-07-29  9:57 UTC (permalink / raw)
  To: ltp

Changes v1->v2:
* Fixed version 6.11 => 6.10 (execve04, creat07)
* Fixed version 7.2 => 7.1 (fanotify20)

Link to v1:
https://lore.kernel.org/ltp/20260729091717.23042-1-pvorel@suse.cz/T/#t
https://patchwork.ozlabs.org/project/ltp/list/?series=516120&state=*

More changes needed => v2. I'm sorry for the noise.

Petr Vorel (5):
  lib: Rename function check_kver() => check_min_kver()
  lib: Add support for max_kver to struct tst_test and tst_fs
  execve04: Use .max_kver
  creat07: Use .max_kver
  fanotify20: Skip on v7.2

 include/tst_test.h                            |  9 +++-
 lib/tst_test.c                                | 49 +++++++++++++++++--
 testcases/kernel/syscalls/creat/creat07.c     | 14 ++----
 testcases/kernel/syscalls/execve/execve04.c   | 14 ++----
 .../kernel/syscalls/fanotify/fanotify20.c     |  4 ++
 5 files changed, 64 insertions(+), 26 deletions(-)

-- 
2.55.0


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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [LTP] [PATCH v2 1/5] lib: Rename function check_kver() => check_min_kver()
  2026-07-29  9:57 [LTP] [PATCH v2 0/5] Add support for .max_kver Petr Vorel
@ 2026-07-29  9:57 ` Petr Vorel
  2026-07-29  9:57 ` [LTP] [PATCH v2 2/5] lib: Add support for max_kver to struct tst_test and tst_fs Petr Vorel
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 10+ messages in thread
From: Petr Vorel @ 2026-07-29  9:57 UTC (permalink / raw)
  To: ltp

Preparation for a next commit.

Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
The same as v1.

 lib/tst_test.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/lib/tst_test.c b/lib/tst_test.c
index 5c3607016e..778a1fed40 100644
--- a/lib/tst_test.c
+++ b/lib/tst_test.c
@@ -1058,11 +1058,11 @@ static void do_exit(int ret)
 }
 
 /*
- * Check for the required kernel version.
+ * Check for the minimal required kernel version.
  *
  * return: true if the kernel version is high enough, false otherwise.
  */
-static bool check_kver(const char *min_kver, const int brk_nosupp)
+static bool check_min_kver(const char *min_kver, const int brk_nosupp)
 {
 	char *msg;
 	int v1, v2, v3;
@@ -1461,7 +1461,7 @@ static void do_setup(int argc, char *argv[])
 		tst_brk(TCONF, "Test needs to be run as root");
 
 	if (tst_test->min_kver)
-		check_kver(tst_test->min_kver, 1);
+		check_min_kver(tst_test->min_kver, 1);
 
 	if (tst_test->skip_in_lockdown && tst_lockdown_enabled() > 0)
 		tst_brk(TCONF, "Kernel is locked down, skipping test");
@@ -1584,7 +1584,7 @@ static void do_setup(int argc, char *argv[])
 				tst_check_cmd(tst_test->filesystems->mkfs_ver, 1);
 
 			if (tst_test->filesystems && tst_test->filesystems->min_kver)
-				check_kver(tst_test->filesystems->min_kver, 1);
+				check_min_kver(tst_test->filesystems->min_kver, 1);
 
 			prepare_device(tst_test->filesystems);
 		}
@@ -1988,7 +1988,7 @@ static void run_tcase_on_fs(struct tst_fs *fs, const char *fs_type)
 	if (fs->mkfs_ver && !tst_check_cmd(fs->mkfs_ver, 0))
 		return;
 
-	if (fs->min_kver && !check_kver(fs->min_kver, 0))
+	if (fs->min_kver && !check_min_kver(fs->min_kver, 0))
 		return;
 
 	prepare_device(fs);
-- 
2.55.0


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

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [LTP] [PATCH v2 2/5] lib: Add support for max_kver to struct tst_test and tst_fs
  2026-07-29  9:57 [LTP] [PATCH v2 0/5] Add support for .max_kver Petr Vorel
  2026-07-29  9:57 ` [LTP] [PATCH v2 1/5] lib: Rename function check_kver() => check_min_kver() Petr Vorel
@ 2026-07-29  9:57 ` Petr Vorel
  2026-07-29 10:40   ` Avinesh Kumar via ltp
  2026-07-29  9:57 ` [LTP] [PATCH v2 3/5] execve04: Use .max_kver Petr Vorel
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 10+ messages in thread
From: Petr Vorel @ 2026-07-29  9:57 UTC (permalink / raw)
  To: ltp

Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
The same as v1.

 include/tst_test.h |  9 ++++++++-
 lib/tst_test.c     | 39 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 47 insertions(+), 1 deletion(-)

diff --git a/include/tst_test.h b/include/tst_test.h
index c69362485e..0910660827 100644
--- a/include/tst_test.h
+++ b/include/tst_test.h
@@ -280,6 +280,9 @@ struct tst_ulimit_val {
  *
  * @min_kver: A minimum kernel version supporting the filesystem which has been
  *            created with mkfs.
+ *
+ * @max_kver: A maximum kernel version supporting the filesystem which has been
+ *            created with mkfs.
  */
 struct tst_fs {
 	const char *type;
@@ -292,6 +295,7 @@ struct tst_fs {
 	const void *mnt_data;
 
 	const char *min_kver;
+	const char *max_kver;
 };
 
 /**
@@ -301,7 +305,9 @@ struct tst_fs {
  *        and each time passed an increasing counter value.
  * @options: An NULL optstr terminated array of struct tst_option.
  *
- * @min_kver: A minimal kernel version the test can run on. e.g. "3.10".
+ * @min_kver: A minimal kernel version the test can run on. e.g. "4.4".
+ *
+ * @max_kver: A maximal kernel version the test can run on. e.g. "7.2".
  *
  * @supported_archs: A NULL terminated array of architectures the test runs on
  *                   e.g. {"x86_64, "x86", NULL}. Calls tst_is_on_arch() to
@@ -551,6 +557,7 @@ struct tst_fs {
 	struct tst_option *options;
 
 	const char *min_kver;
+	const char *max_kver;
 
 	const char *const *supported_archs;
 
diff --git a/lib/tst_test.c b/lib/tst_test.c
index 778a1fed40..fa38b3a7a3 100644
--- a/lib/tst_test.c
+++ b/lib/tst_test.c
@@ -1087,6 +1087,36 @@ static bool check_min_kver(const char *min_kver, const int brk_nosupp)
 	return true;
 }
 
+/*
+ * Check for the maximal required kernel version.
+ *
+ * return: true if the kernel version is low enough, false otherwise.
+ */
+static bool check_max_kver(const char *max_kver, const int brk_nosupp)
+{
+	char *msg;
+	int v1, v2, v3;
+
+	if (tst_parse_kver(max_kver, &v1, &v2, &v3)) {
+		tst_res(TWARN,
+			"Invalid kernel version %s, expected %%d.%%d.%%d",
+			max_kver);
+	}
+
+	if (tst_kvercmp(v1, v2, v3) > 0) {
+		msg = "The test requires kernel %s or older";
+
+		if (brk_nosupp)
+			tst_brk(TCONF, msg, max_kver);
+		else
+			tst_res(TCONF, msg, max_kver);
+
+		return false;
+	}
+
+	return true;
+}
+
 /*
  * Checks if the struct results values are equal.
  *
@@ -1463,6 +1493,9 @@ static void do_setup(int argc, char *argv[])
 	if (tst_test->min_kver)
 		check_min_kver(tst_test->min_kver, 1);
 
+	if (tst_test->max_kver)
+		check_max_kver(tst_test->max_kver, 1);
+
 	if (tst_test->skip_in_lockdown && tst_lockdown_enabled() > 0)
 		tst_brk(TCONF, "Kernel is locked down, skipping test");
 
@@ -1586,6 +1619,9 @@ static void do_setup(int argc, char *argv[])
 			if (tst_test->filesystems && tst_test->filesystems->min_kver)
 				check_min_kver(tst_test->filesystems->min_kver, 1);
 
+			if (tst_test->filesystems && tst_test->filesystems->max_kver)
+				check_max_kver(tst_test->filesystems->max_kver, 1);
+
 			prepare_device(tst_test->filesystems);
 		}
 	}
@@ -1991,6 +2027,9 @@ static void run_tcase_on_fs(struct tst_fs *fs, const char *fs_type)
 	if (fs->min_kver && !check_min_kver(fs->min_kver, 0))
 		return;
 
+	if (fs->max_kver && !check_max_kver(fs->max_kver, 0))
+		return;
+
 	prepare_device(fs);
 
 	fork_testrun();
-- 
2.55.0


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

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [LTP] [PATCH v2 3/5] execve04: Use .max_kver
  2026-07-29  9:57 [LTP] [PATCH v2 0/5] Add support for .max_kver Petr Vorel
  2026-07-29  9:57 ` [LTP] [PATCH v2 1/5] lib: Rename function check_kver() => check_min_kver() Petr Vorel
  2026-07-29  9:57 ` [LTP] [PATCH v2 2/5] lib: Add support for max_kver to struct tst_test and tst_fs Petr Vorel
@ 2026-07-29  9:57 ` Petr Vorel
  2026-07-29  9:57 ` [LTP] [PATCH v2 4/5] creat07: " Petr Vorel
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 10+ messages in thread
From: Petr Vorel @ 2026-07-29  9:57 UTC (permalink / raw)
  To: ltp

Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
Changes v1->v2:
* Fixed version 6.11 => 6.10

 testcases/kernel/syscalls/execve/execve04.c | 14 ++++----------
 1 file changed, 4 insertions(+), 10 deletions(-)

diff --git a/testcases/kernel/syscalls/execve/execve04.c b/testcases/kernel/syscalls/execve/execve04.c
index 35ec882a07..6f06a4a4cc 100644
--- a/testcases/kernel/syscalls/execve/execve04.c
+++ b/testcases/kernel/syscalls/execve/execve04.c
@@ -11,6 +11,9 @@
 /*\
  * Attempt to :manpage:`execve(2)` a file which is being opened by another process for
  * writing fails with ETXTBSY.
+ *
+ * NOTE: write to executed file is allowed since 6.11-rc1:
+ * 2a010c412853 ("fs: don't block i_writecount during exec")
  */
 
 #define _GNU_SOURCE
@@ -62,19 +65,10 @@ static void do_child(void)
 	exit(0);
 }
 
-static void setup(void)
-{
-	if ((tst_kvercmp(6, 11, 0)) >= 0) {
-		tst_brk(TCONF, "Skipping test, write to executed file is "
-			"allowed since 6.11-rc1.\n"
-			"2a010c412853 (\"fs: don't block i_writecount during exec\")");
-	}
-}
-
 static struct tst_test test = {
-	.setup = setup,
 	.test_all = verify_execve,
 	.forks_child = 1,
+	.max_kver = "6.10",
 	.child_needs_reinit = 1,
 	.needs_checkpoints = 1,
 	.resource_files = (const char *const []) {
-- 
2.55.0


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

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [LTP] [PATCH v2 4/5] creat07: Use .max_kver
  2026-07-29  9:57 [LTP] [PATCH v2 0/5] Add support for .max_kver Petr Vorel
                   ` (2 preceding siblings ...)
  2026-07-29  9:57 ` [LTP] [PATCH v2 3/5] execve04: Use .max_kver Petr Vorel
@ 2026-07-29  9:57 ` Petr Vorel
  2026-07-29  9:57 ` [LTP] [PATCH v2 5/5] fanotify20: Skip on v7.2 Petr Vorel
  2026-07-29 15:47 ` [LTP] [PATCH v2 0/5] Add support for .max_kver Andrea Cervesato via ltp
  5 siblings, 0 replies; 10+ messages in thread
From: Petr Vorel @ 2026-07-29  9:57 UTC (permalink / raw)
  To: ltp

Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
Changes v1->v2:
* Fixed version 6.11 => 6.10

 testcases/kernel/syscalls/creat/creat07.c | 14 ++++----------
 1 file changed, 4 insertions(+), 10 deletions(-)

diff --git a/testcases/kernel/syscalls/creat/creat07.c b/testcases/kernel/syscalls/creat/creat07.c
index c7b85ee694..2b15d79b47 100644
--- a/testcases/kernel/syscalls/creat/creat07.c
+++ b/testcases/kernel/syscalls/creat/creat07.c
@@ -6,6 +6,9 @@
 
 /*\
  * Check that :manpage:`creat(2)` sets ETXTBSY correctly.
+ *
+ * NOTE: write to executed file is allowed since 6.11-rc1:
+ * 2a010c412853 ("fs: don't block i_writecount during exec")
  */
 
 #include <sys/types.h>
@@ -47,19 +50,10 @@ static void verify_creat(void)
 	SAFE_WAITPID(pid, NULL, 0);
 }
 
-static void setup(void)
-{
-	if ((tst_kvercmp(6, 11, 0)) >= 0) {
-		tst_brk(TCONF, "Skipping test, write to executed file is "
-			"allowed since 6.11-rc1.\n"
-			"2a010c412853 (\"fs: don't block i_writecount during exec\")");
-	}
-}
-
 static struct tst_test test = {
-	.setup = setup,
 	.test_all = verify_creat,
 	.needs_checkpoints = 1,
+	.max_kver = "6.10",
 	.forks_child = 1,
 	.resource_files = (const char *const []) {
 		TEST_APP,
-- 
2.55.0


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

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [LTP] [PATCH v2 5/5] fanotify20: Skip on v7.2
  2026-07-29  9:57 [LTP] [PATCH v2 0/5] Add support for .max_kver Petr Vorel
                   ` (3 preceding siblings ...)
  2026-07-29  9:57 ` [LTP] [PATCH v2 4/5] creat07: " Petr Vorel
@ 2026-07-29  9:57 ` Petr Vorel
  2026-07-29 10:26   ` Jan Kara
  2026-07-29 15:47 ` [LTP] [PATCH v2 0/5] Add support for .max_kver Andrea Cervesato via ltp
  5 siblings, 1 reply; 10+ messages in thread
From: Petr Vorel @ 2026-07-29  9:57 UTC (permalink / raw)
  To: ltp; +Cc: Jan Kara, Amir Goldstein, AnonymeMeow

fanotify_init() used to reject FAN_REPORT_PIDFD combined with
FAN_REPORT_TID with EINVAL. Since Linux v7.2, fanotify supports
reporting pidfds for thread IDs, so this combination is expected to
succeed.

The test that these flag combinations are allowed:
                FLAGS_DESC(FAN_REPORT_PIDFD | FAN_REPORT_TID),
		FLAGS_DESC(FAN_REPORT_PIDFD | FAN_REPORT_FID |
			   FAN_REPORT_DFID_NAME),

Because the above flag combinations are already "tested" by the tests
that use them and we don't have any tests that >= 5.10 has support for
FAN_MARK_FILESYSTEM etc just simply skip the test on v7.2.

Reported-by: AnonymeMeow <anonymemeow@gmail.com>
Suggested-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
Changes v1->v2:
* Fixed version 7.2 => 7.1

More changes needed => v2. I'm sorry for the noise.

 testcases/kernel/syscalls/fanotify/fanotify20.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/testcases/kernel/syscalls/fanotify/fanotify20.c b/testcases/kernel/syscalls/fanotify/fanotify20.c
index b32ecf6aa3..db4a5ba63b 100644
--- a/testcases/kernel/syscalls/fanotify/fanotify20.c
+++ b/testcases/kernel/syscalls/fanotify/fanotify20.c
@@ -15,6 +15,9 @@
  *
  * NOTE: FAN_REPORT_PIDFD support was added in v5.15-rc1 in
  * af579beb666a ("fanotify: add pidfd support to the fanotify API").
+ *
+ * NOTE: since v7.2, fanotify supports reporting pidfds for thread IDs => skip
+ * the test.
  */
 
 #define _GNU_SOURCE
@@ -75,6 +78,7 @@ static void do_cleanup(void)
 
 static struct tst_test test = {
 	.setup = do_setup,
+	.max_kver = "7.1",
 	.test = do_test,
 	.tcnt = ARRAY_SIZE(test_cases),
 	.cleanup = do_cleanup,
-- 
2.55.0


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

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [LTP] [PATCH v2 5/5] fanotify20: Skip on v7.2
  2026-07-29  9:57 ` [LTP] [PATCH v2 5/5] fanotify20: Skip on v7.2 Petr Vorel
@ 2026-07-29 10:26   ` Jan Kara
  0 siblings, 0 replies; 10+ messages in thread
From: Jan Kara @ 2026-07-29 10:26 UTC (permalink / raw)
  To: Petr Vorel; +Cc: Jan Kara, Amir Goldstein, AnonymeMeow, ltp

On Wed 29-07-26 11:57:30, Petr Vorel wrote:
> fanotify_init() used to reject FAN_REPORT_PIDFD combined with
> FAN_REPORT_TID with EINVAL. Since Linux v7.2, fanotify supports
> reporting pidfds for thread IDs, so this combination is expected to
> succeed.
> 
> The test that these flag combinations are allowed:
>                 FLAGS_DESC(FAN_REPORT_PIDFD | FAN_REPORT_TID),
> 		FLAGS_DESC(FAN_REPORT_PIDFD | FAN_REPORT_FID |
> 			   FAN_REPORT_DFID_NAME),
> 
> Because the above flag combinations are already "tested" by the tests
> that use them and we don't have any tests that >= 5.10 has support for
> FAN_MARK_FILESYSTEM etc just simply skip the test on v7.2.
> 
> Reported-by: AnonymeMeow <anonymemeow@gmail.com>
> Suggested-by: Amir Goldstein <amir73il@gmail.com>
> Signed-off-by: Petr Vorel <pvorel@suse.cz>

Looks good. Feel free to add:

Reviewed-by: Jan Kara <jack@suse.cz>

								Honza

> ---
> Changes v1->v2:
> * Fixed version 7.2 => 7.1
> 
> More changes needed => v2. I'm sorry for the noise.
> 
>  testcases/kernel/syscalls/fanotify/fanotify20.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/testcases/kernel/syscalls/fanotify/fanotify20.c b/testcases/kernel/syscalls/fanotify/fanotify20.c
> index b32ecf6aa3..db4a5ba63b 100644
> --- a/testcases/kernel/syscalls/fanotify/fanotify20.c
> +++ b/testcases/kernel/syscalls/fanotify/fanotify20.c
> @@ -15,6 +15,9 @@
>   *
>   * NOTE: FAN_REPORT_PIDFD support was added in v5.15-rc1 in
>   * af579beb666a ("fanotify: add pidfd support to the fanotify API").
> + *
> + * NOTE: since v7.2, fanotify supports reporting pidfds for thread IDs => skip
> + * the test.
>   */
>  
>  #define _GNU_SOURCE
> @@ -75,6 +78,7 @@ static void do_cleanup(void)
>  
>  static struct tst_test test = {
>  	.setup = do_setup,
> +	.max_kver = "7.1",
>  	.test = do_test,
>  	.tcnt = ARRAY_SIZE(test_cases),
>  	.cleanup = do_cleanup,
> -- 
> 2.55.0
> 
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [LTP] [PATCH v2 2/5] lib: Add support for max_kver to struct tst_test and tst_fs
  2026-07-29  9:57 ` [LTP] [PATCH v2 2/5] lib: Add support for max_kver to struct tst_test and tst_fs Petr Vorel
@ 2026-07-29 10:40   ` Avinesh Kumar via ltp
  2026-07-29 13:36     ` Petr Vorel
  0 siblings, 1 reply; 10+ messages in thread
From: Avinesh Kumar via ltp @ 2026-07-29 10:40 UTC (permalink / raw)
  To: Petr Vorel; +Cc: ltp

Hi Petr,

few comments below

On 7/29/26 11:57 AM, Petr Vorel wrote:
> Signed-off-by: Petr Vorel <pvorel@suse.cz>
> ---
> The same as v1.
> 
>   include/tst_test.h |  9 ++++++++-
>   lib/tst_test.c     | 39 +++++++++++++++++++++++++++++++++++++++
>   2 files changed, 47 insertions(+), 1 deletion(-)
> 
> diff --git a/include/tst_test.h b/include/tst_test.h
> index c69362485e..0910660827 100644
> --- a/include/tst_test.h
> +++ b/include/tst_test.h
> @@ -280,6 +280,9 @@ struct tst_ulimit_val {
>    *
>    * @min_kver: A minimum kernel version supporting the filesystem which has been
>    *            created with mkfs.
> + *
> + * @max_kver: A maximum kernel version supporting the filesystem which has been
> + *            created with mkfs.
>    */
>   struct tst_fs {
>   	const char *type;
> @@ -292,6 +295,7 @@ struct tst_fs {
>   	const void *mnt_data;
>   
>   	const char *min_kver;
> +	const char *max_kver;
>   };
>   
>   /**
> @@ -301,7 +305,9 @@ struct tst_fs {
>    *        and each time passed an increasing counter value.
>    * @options: An NULL optstr terminated array of struct tst_option.
>    *
> - * @min_kver: A minimal kernel version the test can run on. e.g. "3.10".
> + * @min_kver: A minimal kernel version the test can run on. e.g. "4.4".
s/minimal/minimum
> + *
> + * @max_kver: A maximal kernel version the test can run on. e.g. "7.2".
s/maximal/maximum

Also, I assume test will *not be skipped* on kernel versions
7.1.1, 7.1.2 etc just with
.max_kver="7.1"

maybe we should clarify.

>    *
>    * @supported_archs: A NULL terminated array of architectures the test runs on
>    *                   e.g. {"x86_64, "x86", NULL}. Calls tst_is_on_arch() to
> @@ -551,6 +557,7 @@ struct tst_fs {
>   	struct tst_option *options;
>   
>   	const char *min_kver;
> +	const char *max_kver;
>   
>   	const char *const *supported_archs;
>   
> diff --git a/lib/tst_test.c b/lib/tst_test.c
> index 778a1fed40..fa38b3a7a3 100644
> --- a/lib/tst_test.c
> +++ b/lib/tst_test.c
> @@ -1087,6 +1087,36 @@ static bool check_min_kver(const char *min_kver, const int brk_nosupp)
>   	return true;
>   }
>   
> +/*
> + * Check for the maximal required kernel version.
> + *
> + * return: true if the kernel version is low enough, false otherwise.

This sounds a bit confusing. How about-

Check the running kernel against the last version the test applies to.

return: true if the kernel is old enough, false otherwise.

> + */
> +static bool check_max_kver(const char *max_kver, const int brk_nosupp)
> +{
> +	char *msg;
> +	int v1, v2, v3;
> +
> +	if (tst_parse_kver(max_kver, &v1, &v2, &v3)) {
> +		tst_res(TWARN,
> +			"Invalid kernel version %s, expected %%d.%%d.%%d",
I wouldn't say 'kernel version is invalid'. maybe test isn't
supported/applicable on..

> +			max_kver);
> +	}
> +
> +	if (tst_kvercmp(v1, v2, v3) > 0) {
> +		msg = "The test requires kernel %s or older";
> +
> +		if (brk_nosupp)
> +			tst_brk(TCONF, msg, max_kver);
> +		else
> +			tst_res(TCONF, msg, max_kver);
> +
> +		return false;
> +	}
> +
> +	return true;
> +}
> +
>   /*
>    * Checks if the struct results values are equal.
>    *
> @@ -1463,6 +1493,9 @@ static void do_setup(int argc, char *argv[])
>   	if (tst_test->min_kver)
>   		check_min_kver(tst_test->min_kver, 1);
>   
> +	if (tst_test->max_kver)
> +		check_max_kver(tst_test->max_kver, 1);
> +
>   	if (tst_test->skip_in_lockdown && tst_lockdown_enabled() > 0)
>   		tst_brk(TCONF, "Kernel is locked down, skipping test");
>   
> @@ -1586,6 +1619,9 @@ static void do_setup(int argc, char *argv[])
>   			if (tst_test->filesystems && tst_test->filesystems->min_kver)
>   				check_min_kver(tst_test->filesystems->min_kver, 1);
>   
> +			if (tst_test->filesystems && tst_test->filesystems->max_kver)
> +				check_max_kver(tst_test->filesystems->max_kver, 1);
> +
>   			prepare_device(tst_test->filesystems);
>   		}
>   	}
> @@ -1991,6 +2027,9 @@ static void run_tcase_on_fs(struct tst_fs *fs, const char *fs_type)
>   	if (fs->min_kver && !check_min_kver(fs->min_kver, 0))
>   		return;
>   
> +	if (fs->max_kver && !check_max_kver(fs->max_kver, 0))
> +		return;
> +
>   	prepare_device(fs);
>   
>   	fork_testrun();

Thanks,
Avinesh

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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [LTP] [PATCH v2 2/5] lib: Add support for max_kver to struct tst_test and tst_fs
  2026-07-29 10:40   ` Avinesh Kumar via ltp
@ 2026-07-29 13:36     ` Petr Vorel
  0 siblings, 0 replies; 10+ messages in thread
From: Petr Vorel @ 2026-07-29 13:36 UTC (permalink / raw)
  To: Avinesh Kumar; +Cc: ltp

Hi Avinesh,

> Hi Petr,

> few comments below
Thanks!

> On 7/29/26 11:57 AM, Petr Vorel wrote:
> > Signed-off-by: Petr Vorel <pvorel@suse.cz>
> > ---
> > The same as v1.

> >   include/tst_test.h |  9 ++++++++-
> >   lib/tst_test.c     | 39 +++++++++++++++++++++++++++++++++++++++
> >   2 files changed, 47 insertions(+), 1 deletion(-)

> > diff --git a/include/tst_test.h b/include/tst_test.h
> > index c69362485e..0910660827 100644
> > --- a/include/tst_test.h
> > +++ b/include/tst_test.h
> > @@ -280,6 +280,9 @@ struct tst_ulimit_val {
> >    *
> >    * @min_kver: A minimum kernel version supporting the filesystem which has been
> >    *            created with mkfs.
> > + *
> > + * @max_kver: A maximum kernel version supporting the filesystem which has been
> > + *            created with mkfs.
> >    */
> >   struct tst_fs {
> >   	const char *type;
> > @@ -292,6 +295,7 @@ struct tst_fs {
> >   	const void *mnt_data;
> >   	const char *min_kver;
> > +	const char *max_kver;
> >   };
> >   /**
> > @@ -301,7 +305,9 @@ struct tst_fs {
> >    *        and each time passed an increasing counter value.
> >    * @options: An NULL optstr terminated array of struct tst_option.
> >    *
> > - * @min_kver: A minimal kernel version the test can run on. e.g. "3.10".
> > + * @min_kver: A minimal kernel version the test can run on. e.g. "4.4".
> s/minimal/minimum

You spotted more grammar errors so I trust you :). But can you please double
check that it'đ really correct? Minimal is an adjective, minimum is an adjective
but also a noun and an adverb.

When googling I even found use of both in the same document :)
https://kubernetes.io/docs/reference/node/kernel-version-requirements/
"have minimum kernel version requirements"
"minimal kernel version requirement"

> > + *
> > + * @max_kver: A maximal kernel version the test can run on. e.g. "7.2".
> s/maximal/maximum
dtto

> Also, I assume test will *not be skipped* on kernel versions
> 7.1.1, 7.1.2 etc just with
> .max_kver="7.1"

Good point, thanks => v3 (sigh).

check_max_kver() needs to have this condition to take an account the sublevel.

-if (tst_kvercmp(v1, v2, v3) > 0) {
+if (tst_kvercmp(v1, v2, v3) >= 1024) {
		msg = "The test requires kernel %s or older";
...

Sublevel can be above 255 since 4.4.256
https://lwn.net/ml/linux-kernel/20210208145805.898658055@linuxfoundation.org/
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=9b82f13e7ef3

But it should be below 1024 (practically the highest sublevel has been 337).

Kind regards,
Petr

> maybe we should clarify.

> >    *
> >    * @supported_archs: A NULL terminated array of architectures the test runs on
> >    *                   e.g. {"x86_64, "x86", NULL}. Calls tst_is_on_arch() to
> > @@ -551,6 +557,7 @@ struct tst_fs {
> >   	struct tst_option *options;
> >   	const char *min_kver;
> > +	const char *max_kver;
> >   	const char *const *supported_archs;
> > diff --git a/lib/tst_test.c b/lib/tst_test.c
> > index 778a1fed40..fa38b3a7a3 100644
> > --- a/lib/tst_test.c
> > +++ b/lib/tst_test.c
> > @@ -1087,6 +1087,36 @@ static bool check_min_kver(const char *min_kver, const int brk_nosupp)
> >   	return true;
> >   }
> > +/*
> > + * Check for the maximal required kernel version.
> > + *
> > + * return: true if the kernel version is low enough, false otherwise.

> This sounds a bit confusing. How about-

> Check the running kernel against the last version the test applies to.

Makes sense. Based on check_min_kver(), which was renamed from check_kver() in
the previous commit. Could you have look on these as well. Anyway, if you have
time, having a look on docs wording as a separate effort would help.

> return: true if the kernel is old enough, false otherwise.

+1

> > + */
> > +static bool check_max_kver(const char *max_kver, const int brk_nosupp)
> > +{
> > +	char *msg;
> > +	int v1, v2, v3;
> > +
> > +	if (tst_parse_kver(max_kver, &v1, &v2, &v3)) {
> > +		tst_res(TWARN,
> > +			"Invalid kernel version %s, expected %%d.%%d.%%d",
> I wouldn't say 'kernel version is invalid'. maybe test isn't
> supported/applicable on..

tst_parse_kver() returns 1 on error => this is really an error check.
Other thing is that the same error handling is on both places, but that's very
minor.

Kind regards,
Petr
...

> Thanks,
> Avinesh

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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [LTP] [PATCH v2 0/5] Add support for .max_kver
  2026-07-29  9:57 [LTP] [PATCH v2 0/5] Add support for .max_kver Petr Vorel
                   ` (4 preceding siblings ...)
  2026-07-29  9:57 ` [LTP] [PATCH v2 5/5] fanotify20: Skip on v7.2 Petr Vorel
@ 2026-07-29 15:47 ` Andrea Cervesato via ltp
  5 siblings, 0 replies; 10+ messages in thread
From: Andrea Cervesato via ltp @ 2026-07-29 15:47 UTC (permalink / raw)
  To: Petr Vorel; +Cc: ltp

Hi Petr,

feel free to add to all patch-set:

Reviewed-by: Andrea Cervesato <andrea.cervesato@suse.com>

--
Andrea Cervesato
SUSE QE Automation Engineer Linux
andrea.cervesato@suse.com

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

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2026-07-29 15:47 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-29  9:57 [LTP] [PATCH v2 0/5] Add support for .max_kver Petr Vorel
2026-07-29  9:57 ` [LTP] [PATCH v2 1/5] lib: Rename function check_kver() => check_min_kver() Petr Vorel
2026-07-29  9:57 ` [LTP] [PATCH v2 2/5] lib: Add support for max_kver to struct tst_test and tst_fs Petr Vorel
2026-07-29 10:40   ` Avinesh Kumar via ltp
2026-07-29 13:36     ` Petr Vorel
2026-07-29  9:57 ` [LTP] [PATCH v2 3/5] execve04: Use .max_kver Petr Vorel
2026-07-29  9:57 ` [LTP] [PATCH v2 4/5] creat07: " Petr Vorel
2026-07-29  9:57 ` [LTP] [PATCH v2 5/5] fanotify20: Skip on v7.2 Petr Vorel
2026-07-29 10:26   ` Jan Kara
2026-07-29 15:47 ` [LTP] [PATCH v2 0/5] Add support for .max_kver Andrea Cervesato via ltp

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.