lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <fecc63de-9477-cad4-79f3-bdb1f1e3ab5f@linux.dev>
Date:   Fri, 12 May 2023 17:59:43 +0800
From:   Chengming Zhou <chengming.zhou@...ux.dev>
To:     Yu Kuai <yukuai1@...weicloud.com>
Cc:     hch@....de, tj@...nel.org, josef@...icpanda.com, axboe@...nel.dk,
        yukuai3@...wei.com, lukas.bulwahn@...il.com,
        cgroups@...r.kernel.org, linux-block@...r.kernel.org,
        linux-kernel@...r.kernel.org, yi.zhang@...wei.com,
        yangerkun@...wei.com
Subject: Re: [PATCH -next v2 1/6] blk-wbt: fix that wbt can't be disabled by
 default

On 2023/5/12 17:35, Yu Kuai wrote:
> From: Yu Kuai <yukuai3@...wei.com>
> 
> commit b11d31ae01e6 ("blk-wbt: remove unnecessary check in
> wbt_enable_default()") removes the checking of CONFIG_BLK_WBT_MQ by
> mistake, which is used to control enable or disable wbt by default.
> 
> Fix the problem by adding back the checking. This patch also do a litter
> cleanup to make related code more readable.
> 
> Fixes: b11d31ae01e6 ("blk-wbt: remove unnecessary check in wbt_enable_default()")
> Reported-by: Lukas Bulwahn <lukas.bulwahn@...il.com>
> Link: https://lore.kernel.org/lkml/CAKXUXMzfKq_J9nKHGyr5P5rvUETY4B-fxoQD4sO+NYjFOfVtZA@mail.gmail.com/t/
> Signed-off-by: Yu Kuai <yukuai3@...wei.com>
> ---
>  block/blk-wbt.c | 12 +++++++-----
>  1 file changed, 7 insertions(+), 5 deletions(-)
> 
> diff --git a/block/blk-wbt.c b/block/blk-wbt.c
> index e49a48684532..9ec2a2f1eda3 100644
> --- a/block/blk-wbt.c
> +++ b/block/blk-wbt.c
> @@ -730,14 +730,16 @@ void wbt_enable_default(struct gendisk *disk)
>  {
>  	struct request_queue *q = disk->queue;
>  	struct rq_qos *rqos;
> -	bool disable_flag = q->elevator &&
> -		    test_bit(ELEVATOR_FLAG_DISABLE_WBT, &q->elevator->flags);
> +	bool enable = IS_ENABLED(CONFIG_BLK_WBT_MQ);
> +
> +	if (q->elevator &&
> +	    test_bit(ELEVATOR_FLAG_DISABLE_WBT, &q->elevator->flags))
> +		enable = false;

Why not just early return, so "enable" is not needed at all?

I have another question that CONFIG_BLK_WBT_MQ is not much flexible, can we
just get rid of it? (I'm not sure when to disable it in the config)

Thanks.

>  
>  	/* Throttling already enabled? */
>  	rqos = wbt_rq_qos(q);
>  	if (rqos) {
> -		if (!disable_flag &&
> -		    RQWB(rqos)->enable_state == WBT_STATE_OFF_DEFAULT)
> +		if (enable && RQWB(rqos)->enable_state == WBT_STATE_OFF_DEFAULT)
>  			RQWB(rqos)->enable_state = WBT_STATE_ON_DEFAULT;
>  		return;
>  	}
> @@ -746,7 +748,7 @@ void wbt_enable_default(struct gendisk *disk)
>  	if (!blk_queue_registered(q))
>  		return;
>  
> -	if (queue_is_mq(q) && !disable_flag)
> +	if (queue_is_mq(q) && enable)
>  		wbt_init(disk);
>  }
>  EXPORT_SYMBOL_GPL(wbt_enable_default);

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ