* [LTP] [PATCH] sys_block_queue01: Accept plain "none" in queue/scheduler
@ 2026-11-18 6:34 Darren Chang via ltp
2026-11-18 9:11 ` Cyril Hrubis
` (3 more replies)
0 siblings, 4 replies; 8+ messages in thread
From: Darren Chang via ltp @ 2026-11-18 6:34 UTC (permalink / raw)
To: ltp
On kernels older than 6.5, bio-based block devices (such as dm, ram,
zram, and pmem) expose queue/scheduler with plain "none" (without
brackets). Kernels before 6.14 also output plain "none" for blk-mq
devices with BLK_MQ_F_NO_SCHED.
These cases were removed in kernel 6.5 (commit 6d85ebf95c44) and
kernel 6.14 (commit e7602bb4f3a1), but older kernels still fail the
test because TST_SYSFS_ASSERT_CHOICE() expects one bracketed token:
TFAIL: /sys/block/dm-87/queue/scheduler has 0 selected tokens, expected exactly 1
Read queue/scheduler first and pass if the value is exact "none".
Keep TCONF when the file is missing, and use TST_SYSFS_ASSERT_CHOICE()
for all other values.
Fixes: f35242c9cc22 ("testcases: sysfs: Add sys_block_queue01")
Signed-off-by: Darren Chang <chihsheng@google.com>
---
.../kernel/sysfs/block/sys_block_queue01.c | 38 ++++++++++++++++---
1 file changed, 33 insertions(+), 5 deletions(-)
diff --git a/testcases/kernel/sysfs/block/sys_block_queue01.c b/testcases/kernel/sysfs/block/sys_block_queue01.c
index 38564139a..ce1f945fd 100644
--- a/testcases/kernel/sysfs/block/sys_block_queue01.c
+++ b/testcases/kernel/sysfs/block/sys_block_queue01.c
@@ -16,7 +16,13 @@
* - read_ahead_kb, nr_requests and discard_max_bytes are non-negative
* - nr_requests is greater than zero
* - rotational, add_random, iostats are boolean (0 or 1)
- * - scheduler is a valid bracketed-choice file with exactly one active scheduler
+ * - scheduler is a valid bracketed-choice file with exactly one active
+ * scheduler, or plain ``none`` without brackets for devices that do not
+ * support I/O schedulers (bio-based devices such as dm, ram, zram, pmem on
+ * kernels prior to 6.5 before commit 6d85ebf95c44 "blk-sysfs: add a new
+ * attr_group for blk_mq", and blk-mq queues with BLK_MQ_F_NO_SCHED prior to
+ * 6.14 before commit e7602bb4f3a1 "block: remove BLK_MQ_F_NO_SCHED", where
+ * elv_iosched_show() emits "none\n")
*
* All checks skip gracefully with TCONF when a particular attribute is not
* present, since the set of exported queue attributes differs between kernel
@@ -36,6 +42,31 @@ static const char *const sched_allowed[] = {
"kyber", "bfq", "anticipatory", NULL
};
+static void check_scheduler(const char *dev)
+{
+ char sched[64];
+
+ if (!TST_SYSFS_READ_STR(sched, sizeof(sched),
+ PATH_SYS_BLOCK "/%s/queue/scheduler", dev)) {
+ tst_res(TCONF, PATH_SYS_BLOCK "/%s/queue/scheduler does not exist",
+ dev);
+ return;
+ }
+
+ /*
+ * elv_iosched_show() emits plain "none\n" without brackets for queues
+ * that do not support I/O schedulers (bio-based devices prior to 6.5,
+ * and BLK_MQ_F_NO_SCHED devices prior to 6.14).
+ */
+ if (!strcmp(sched, "none")) {
+ tst_res(TPASS, PATH_SYS_BLOCK "/%s/queue/scheduler = 'none'", dev);
+ return;
+ }
+
+ TST_SYSFS_ASSERT_CHOICE(sched_allowed, NULL, 0,
+ PATH_SYS_BLOCK "/%s/queue/scheduler", dev);
+}
+
static void check_cross(const char *dev)
{
TST_SYSFS_ASSERT_LE_SUFFIX("logical_block_size", "physical_block_size",
@@ -50,8 +81,6 @@ static void check_cross(const char *dev)
static void check_device(const char *dev)
{
- char sched[64];
-
tst_res(TINFO, "Checking block device '%s'", dev);
TST_SYSFS_ASSERT_POW2(PATH_SYS_BLOCK "/%s/queue/logical_block_size", dev);
@@ -68,8 +97,7 @@ static void check_device(const char *dev)
TST_SYSFS_ASSERT_BOOL(PATH_SYS_BLOCK "/%s/queue/add_random", dev);
TST_SYSFS_ASSERT_BOOL(PATH_SYS_BLOCK "/%s/queue/iostats", dev);
- TST_SYSFS_ASSERT_CHOICE(sched_allowed, sched, sizeof(sched),
- PATH_SYS_BLOCK "/%s/queue/scheduler", dev);
+ check_scheduler(dev);
check_cross(dev);
}
--
2.56.1.703.gf848ed807c-goog
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [LTP] [PATCH] sys_block_queue01: Accept plain "none" in queue/scheduler
2026-11-18 6:34 [LTP] [PATCH] sys_block_queue01: Accept plain "none" in queue/scheduler Darren Chang via ltp
@ 2026-11-18 9:11 ` Cyril Hrubis
2026-11-18 16:33 ` Darren Chang via ltp
` (2 subsequent siblings)
3 siblings, 0 replies; 8+ messages in thread
From: Cyril Hrubis @ 2026-11-18 9:11 UTC (permalink / raw)
To: Darren Chang; +Cc: ltp
Hi!
> + /*
> + * elv_iosched_show() emits plain "none\n" without brackets for queues
> + * that do not support I/O schedulers (bio-based devices prior to 6.5,
> + * and BLK_MQ_F_NO_SCHED devices prior to 6.14).
> + */
> + if (!strcmp(sched, "none")) {
> + tst_res(TPASS, PATH_SYS_BLOCK "/%s/queue/scheduler = 'none'", dev);
> + return;
> + }
> +
> + TST_SYSFS_ASSERT_CHOICE(sched_allowed, NULL, 0,
> + PATH_SYS_BLOCK "/%s/queue/scheduler", dev);
This does not make any sense. Why haven't you simply added "none" to the
sched_allowed array instead?
--
Cyril Hrubis
chrubis@suse.cz
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [LTP] [PATCH] sys_block_queue01: Accept plain "none" in queue/scheduler
2026-11-18 6:34 [LTP] [PATCH] sys_block_queue01: Accept plain "none" in queue/scheduler Darren Chang via ltp
2026-11-18 9:11 ` Cyril Hrubis
@ 2026-11-18 16:33 ` Darren Chang via ltp
2026-11-19 11:21 ` Cyril Hrubis
2026-11-19 11:24 ` Cyril Hrubis
2026-11-19 16:25 ` [LTP] [PATCH v2] " Darren Chang via ltp
3 siblings, 1 reply; 8+ messages in thread
From: Darren Chang via ltp @ 2026-11-18 16:33 UTC (permalink / raw)
To: chrubis; +Cc: ltp
Hi Cyril,
> This does not make any sense. Why haven't you simply added "none" to the
> sched_allowed array instead?
"none" is already in sched_allowed[] (line 35 before this patch).
The test fails because elv_iosched_show() prints "none\n" without brackets,
not "[none]\n". TST_SYSFS_ASSERT_CHOICE() requires one bracketed token, so
it fails with "0 selected tokens, expected exactly 1".
Regards,
Darren
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [LTP] [PATCH] sys_block_queue01: Accept plain "none" in queue/scheduler
2026-11-18 16:33 ` Darren Chang via ltp
@ 2026-11-19 11:21 ` Cyril Hrubis
0 siblings, 0 replies; 8+ messages in thread
From: Cyril Hrubis @ 2026-11-19 11:21 UTC (permalink / raw)
To: Darren Chang; +Cc: ltp
Hi!
> > This does not make any sense. Why haven't you simply added "none" to the
> > sched_allowed array instead?
>
> "none" is already in sched_allowed[] (line 35 before this patch).
>
> The test fails because elv_iosched_show() prints "none\n" without brackets,
> not "[none]\n". TST_SYSFS_ASSERT_CHOICE() requires one bracketed token, so
> it fails with "0 selected tokens, expected exactly 1".
Sorry missed, that, I should have read the commit message better.
--
Cyril Hrubis
chrubis@suse.cz
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [LTP] [PATCH] sys_block_queue01: Accept plain "none" in queue/scheduler
2026-11-18 6:34 [LTP] [PATCH] sys_block_queue01: Accept plain "none" in queue/scheduler Darren Chang via ltp
2026-11-18 9:11 ` Cyril Hrubis
2026-11-18 16:33 ` Darren Chang via ltp
@ 2026-11-19 11:24 ` Cyril Hrubis
2026-11-19 16:25 ` [LTP] [PATCH v2] " Darren Chang via ltp
3 siblings, 0 replies; 8+ messages in thread
From: Cyril Hrubis @ 2026-11-19 11:24 UTC (permalink / raw)
To: Darren Chang; +Cc: ltp
Hi!
> Fixes: f35242c9cc22 ("testcases: sysfs: Add sys_block_queue01")
> Signed-off-by: Darren Chang <chihsheng@google.com>
> ---
> .../kernel/sysfs/block/sys_block_queue01.c | 38 ++++++++++++++++---
> 1 file changed, 33 insertions(+), 5 deletions(-)
>
> diff --git a/testcases/kernel/sysfs/block/sys_block_queue01.c b/testcases/kernel/sysfs/block/sys_block_queue01.c
> index 38564139a..ce1f945fd 100644
> --- a/testcases/kernel/sysfs/block/sys_block_queue01.c
> +++ b/testcases/kernel/sysfs/block/sys_block_queue01.c
> @@ -16,7 +16,13 @@
> * - read_ahead_kb, nr_requests and discard_max_bytes are non-negative
> * - nr_requests is greater than zero
> * - rotational, add_random, iostats are boolean (0 or 1)
> - * - scheduler is a valid bracketed-choice file with exactly one active scheduler
> + * - scheduler is a valid bracketed-choice file with exactly one active
> + * scheduler, or plain ``none`` without brackets for devices that do not
> + * support I/O schedulers (bio-based devices such as dm, ram, zram, pmem on
> + * kernels prior to 6.5 before commit 6d85ebf95c44 "blk-sysfs: add a new
> + * attr_group for blk_mq", and blk-mq queues with BLK_MQ_F_NO_SCHED prior to
> + * 6.14 before commit e7602bb4f3a1 "block: remove BLK_MQ_F_NO_SCHED", where
> + * elv_iosched_show() emits "none\n")
> *
> * All checks skip gracefully with TCONF when a particular attribute is not
> * present, since the set of exported queue attributes differs between kernel
> @@ -36,6 +42,31 @@ static const char *const sched_allowed[] = {
> "kyber", "bfq", "anticipatory", NULL
> };
>
> +static void check_scheduler(const char *dev)
> +{
> + char sched[64];
> +
> + if (!TST_SYSFS_READ_STR(sched, sizeof(sched),
> + PATH_SYS_BLOCK "/%s/queue/scheduler", dev)) {
> + tst_res(TCONF, PATH_SYS_BLOCK "/%s/queue/scheduler does not exist",
> + dev);
> + return;
> + }
> +
> + /*
> + * elv_iosched_show() emits plain "none\n" without brackets for queues
> + * that do not support I/O schedulers (bio-based devices prior to 6.5,
> + * and BLK_MQ_F_NO_SCHED devices prior to 6.14).
> + */
The description in the top level comment is enough, I wouldn't add this
comment here.
> + if (!strcmp(sched, "none")) {
> + tst_res(TPASS, PATH_SYS_BLOCK "/%s/queue/scheduler = 'none'", dev);
> + return;
> + }
If this happens only in older kernels the check should be done only on
older kernels too. So we need tst_kvercmp() in the test setup that would
set allow_plain_none flag.
> + TST_SYSFS_ASSERT_CHOICE(sched_allowed, NULL, 0,
> + PATH_SYS_BLOCK "/%s/queue/scheduler", dev);
> +}
> +
> static void check_cross(const char *dev)
> {
> TST_SYSFS_ASSERT_LE_SUFFIX("logical_block_size", "physical_block_size",
> @@ -50,8 +81,6 @@ static void check_cross(const char *dev)
>
> static void check_device(const char *dev)
> {
> - char sched[64];
> -
> tst_res(TINFO, "Checking block device '%s'", dev);
>
> TST_SYSFS_ASSERT_POW2(PATH_SYS_BLOCK "/%s/queue/logical_block_size", dev);
> @@ -68,8 +97,7 @@ static void check_device(const char *dev)
> TST_SYSFS_ASSERT_BOOL(PATH_SYS_BLOCK "/%s/queue/add_random", dev);
> TST_SYSFS_ASSERT_BOOL(PATH_SYS_BLOCK "/%s/queue/iostats", dev);
>
> - TST_SYSFS_ASSERT_CHOICE(sched_allowed, sched, sizeof(sched),
> - PATH_SYS_BLOCK "/%s/queue/scheduler", dev);
> + check_scheduler(dev);
>
> check_cross(dev);
> }
> --
> 2.56.1.703.gf848ed807c-goog
>
--
Cyril Hrubis
chrubis@suse.cz
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 8+ messages in thread
* [LTP] [PATCH v2] sys_block_queue01: Accept plain "none" in queue/scheduler
2026-11-18 6:34 [LTP] [PATCH] sys_block_queue01: Accept plain "none" in queue/scheduler Darren Chang via ltp
` (2 preceding siblings ...)
2026-11-19 11:24 ` Cyril Hrubis
@ 2026-11-19 16:25 ` Darren Chang via ltp
2026-11-19 21:03 ` [LTP] " linuxtestproject.agent
2026-11-20 9:47 ` [LTP] [PATCH v2] " Cyril Hrubis
3 siblings, 2 replies; 8+ messages in thread
From: Darren Chang via ltp @ 2026-11-19 16:25 UTC (permalink / raw)
To: ltp; +Cc: wakel
On kernels older than 6.5, bio-based block devices (such as dm, ram,
zram, and pmem) expose queue/scheduler with plain "none" (without
brackets). Kernels 6.2 to 6.13 also print plain "none" for blk-mq
devices with BLK_MQ_F_NO_SCHED.
These cases were removed in kernel 6.5 (commit 6d85ebf95c44) and
kernel 6.14 (commit e7602bb4f3a1), but older kernels still fail the
test because TST_SYSFS_ASSERT_CHOICE() expects one bracketed token:
TFAIL: /sys/block/dm-87/queue/scheduler has 0 selected tokens, expected exactly 1
Accept exact "none" on kernels older than 6.14. Newer kernels keep
the strict check.
Fixes: f35242c9cc22 ("testcases: sysfs: Add sys_block_queue01")
Signed-off-by: Darren Chang <chihsheng@google.com>
---
Changes in v2:
- Accept plain "none" only on kernels older than 6.14, using
tst_kvercmp() in setup() (Cyril)
- Drop the comment in check_scheduler() (Cyril)
---
.../kernel/sysfs/block/sys_block_queue01.c | 42 ++++++++++++++++---
1 file changed, 37 insertions(+), 5 deletions(-)
diff --git a/testcases/kernel/sysfs/block/sys_block_queue01.c b/testcases/kernel/sysfs/block/sys_block_queue01.c
index 38564139a..68af8462c 100644
--- a/testcases/kernel/sysfs/block/sys_block_queue01.c
+++ b/testcases/kernel/sysfs/block/sys_block_queue01.c
@@ -16,11 +16,22 @@
* - read_ahead_kb, nr_requests and discard_max_bytes are non-negative
* - nr_requests is greater than zero
* - rotational, add_random, iostats are boolean (0 or 1)
- * - scheduler is a valid bracketed-choice file with exactly one active scheduler
+ * - scheduler is a valid bracketed-choice file with exactly one active
+ * scheduler, or plain ``none`` without brackets on kernels older than 6.14
*
* All checks skip gracefully with TCONF when a particular attribute is not
* present, since the set of exported queue attributes differs between kernel
* versions and device types.
+ *
+ * Kernels older than 6.14 report plain ``none`` in scheduler for queues that
+ * do not support I/O schedulers:
+ *
+ * - bio-based devices (dm, ram, zram, pmem), until commit 6d85ebf95c44
+ * (``blk-sysfs: add a new attr_group for blk_mq``) in kernel 6.5 stopped
+ * exporting scheduler for them
+ * - blk-mq queues with BLK_MQ_F_NO_SCHED since kernel 6.2, until commit
+ * e7602bb4f3a1 (``block: remove BLK_MQ_F_NO_SCHED``) in kernel 6.14 removed
+ * the flag
*/
#include <string.h>
@@ -30,12 +41,30 @@
#include "tst_sysfs_assert.h"
#include "tst_path_defs.h"
+static int allow_plain_none;
+
/* schedulers that have existed in mainline over time */
static const char *const sched_allowed[] = {
"none", "noop", "deadline", "mq-deadline", "cfq",
"kyber", "bfq", "anticipatory", NULL
};
+static void check_scheduler(const char *dev)
+{
+ char sched[64];
+
+ if (allow_plain_none &&
+ TST_SYSFS_READ_STR(sched, sizeof(sched),
+ PATH_SYS_BLOCK "/%s/queue/scheduler", dev) &&
+ !strcmp(sched, "none")) {
+ tst_res(TPASS, PATH_SYS_BLOCK "/%s/queue/scheduler = 'none'", dev);
+ return;
+ }
+
+ TST_SYSFS_ASSERT_CHOICE(sched_allowed, NULL, 0,
+ PATH_SYS_BLOCK "/%s/queue/scheduler", dev);
+}
+
static void check_cross(const char *dev)
{
TST_SYSFS_ASSERT_LE_SUFFIX("logical_block_size", "physical_block_size",
@@ -50,8 +79,6 @@ static void check_cross(const char *dev)
static void check_device(const char *dev)
{
- char sched[64];
-
tst_res(TINFO, "Checking block device '%s'", dev);
TST_SYSFS_ASSERT_POW2(PATH_SYS_BLOCK "/%s/queue/logical_block_size", dev);
@@ -68,12 +95,16 @@ static void check_device(const char *dev)
TST_SYSFS_ASSERT_BOOL(PATH_SYS_BLOCK "/%s/queue/add_random", dev);
TST_SYSFS_ASSERT_BOOL(PATH_SYS_BLOCK "/%s/queue/iostats", dev);
- TST_SYSFS_ASSERT_CHOICE(sched_allowed, sched, sizeof(sched),
- PATH_SYS_BLOCK "/%s/queue/scheduler", dev);
+ check_scheduler(dev);
check_cross(dev);
}
+static void setup(void)
+{
+ allow_plain_none = tst_kvercmp(6, 14, 0) < 0;
+}
+
static void run(void)
{
DIR *dir;
@@ -101,5 +132,6 @@ static void run(void)
}
static struct tst_test test = {
+ .setup = setup,
.test_all = run,
};
--
2.56.1.708.g77570a6a1d-goog
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [LTP] sys_block_queue01: Accept plain "none" in queue/scheduler
2026-11-19 16:25 ` [LTP] [PATCH v2] " Darren Chang via ltp
@ 2026-11-19 21:03 ` linuxtestproject.agent
2026-11-20 9:47 ` [LTP] [PATCH v2] " Cyril Hrubis
1 sibling, 0 replies; 8+ messages in thread
From: linuxtestproject.agent @ 2026-11-19 21:03 UTC (permalink / raw)
To: Darren Chang; +Cc: ltp
Hi Darren,
On Thu, Nov 19, 2026 at 04:25:04PM +0000, Darren Chang wrote:
> sys_block_queue01: Accept plain "none" in queue/scheduler
Verdict - Reviewed
---
Note:
The agent can sometimes produce false positives although often its
findings are genuine. If you find issues with the review, please
comment this email or ignore the suggestions.
Regards,
LTP AI Reviewer
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [LTP] [PATCH v2] sys_block_queue01: Accept plain "none" in queue/scheduler
2026-11-19 16:25 ` [LTP] [PATCH v2] " Darren Chang via ltp
2026-11-19 21:03 ` [LTP] " linuxtestproject.agent
@ 2026-11-20 9:47 ` Cyril Hrubis
1 sibling, 0 replies; 8+ messages in thread
From: Cyril Hrubis @ 2026-11-20 9:47 UTC (permalink / raw)
To: Darren Chang; +Cc: wakel, ltp
Hi!
Pushed, thanks.
--
Cyril Hrubis
chrubis@suse.cz
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2026-11-20 9:47 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-18 6:34 [LTP] [PATCH] sys_block_queue01: Accept plain "none" in queue/scheduler Darren Chang via ltp
2026-11-18 9:11 ` Cyril Hrubis
2026-11-18 16:33 ` Darren Chang via ltp
2026-11-19 11:21 ` Cyril Hrubis
2026-11-19 11:24 ` Cyril Hrubis
2026-11-19 16:25 ` [LTP] [PATCH v2] " Darren Chang via ltp
2026-11-19 21:03 ` [LTP] " linuxtestproject.agent
2026-11-20 9:47 ` [LTP] [PATCH v2] " Cyril Hrubis
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox