All of lore.kernel.org
 help / color / mirror / Atom feed
From: Cyril Hrubis <chrubis@suse.cz>
To: Darren Chang <chihsheng@google.com>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH] sys_block_queue01: Accept plain "none" in queue/scheduler
Date: Thu, 19 Nov 2026 12:24:10 +0100	[thread overview]
Message-ID: <av7cWu2pjC_2yqWx@yuki.lan> (raw)
In-Reply-To: <20261118063445.2137150-1-chihsheng@google.com>

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

  parent reply	other threads:[~2026-11-19 11:24 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=av7cWu2pjC_2yqWx@yuki.lan \
    --to=chrubis@suse.cz \
    --cc=chihsheng@google.com \
    --cc=ltp@lists.linux.it \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.