mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: Yu Kuai <yukuai1@huaweicloud.com>
Cc: josef@toxicpanda.com, axboe@kernel.dk, cgroups@vger.kernel.org,
	linux-block@vger.kernel.org, linux-kernel@vger.kernel.org,
	yukuai3@huawei.com, yi.zhang@huawei.com, yangerkun@huawei.com
Subject: Re: [PATCH -next] blk-iocost: fix sleeping in atomic warning for wbt_enable_default()
Date: Wed, 8 Feb 2023 09:06:01 -1000	[thread overview]
Message-ID: <Y+PymbdtPVONbQAq@slm.duckdns.org> (raw)
In-Reply-To: <20230208034803.2818155-1-yukuai1@huaweicloud.com>

On Wed, Feb 08, 2023 at 11:48:03AM +0800, Yu Kuai wrote:
> diff --git a/block/blk-iocost.c b/block/blk-iocost.c
> index 7a2dc9dc8e3b..03bfe1dda07c 100644
> --- a/block/blk-iocost.c
> +++ b/block/blk-iocost.c
> @@ -3279,11 +3279,9 @@ static ssize_t ioc_qos_write(struct kernfs_open_file *of, char *input,
>  		blk_stat_enable_accounting(disk->queue);
>  		blk_queue_flag_set(QUEUE_FLAG_RQ_ALLOC_TIME, disk->queue);
>  		ioc->enabled = true;
> -		wbt_disable_default(disk);
>  	} else {
>  		blk_queue_flag_clear(QUEUE_FLAG_RQ_ALLOC_TIME, disk->queue);
>  		ioc->enabled = false;
> -		wbt_enable_default(disk);
>  	}
>  
>  	if (user) {
> @@ -3296,6 +3294,10 @@ static ssize_t ioc_qos_write(struct kernfs_open_file *of, char *input,
>  	ioc_refresh_params(ioc, true);
>  	spin_unlock_irq(&ioc->lock);
>  
> +	if (enable)
> +		wbt_disable_default(disk);
> +	else
> +		wbt_enable_default(disk);

Wouldn't this allow two competiting config attempts to race each other and
leave wbt in an unexpected state?

	task1				task2

	ioc_qos_write()			ioc_qos_write()
	lock()
	enable
	unlock()
					lock()
					disable
					unlock()
					wbt_enable_default()
	wbt_disable_default()

Thanks.

-- 
tejun

      reply	other threads:[~2023-02-08 19:06 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-08  3:48 Yu Kuai
2023-02-08 19:06 ` Tejun Heo [this message]

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=Y+PymbdtPVONbQAq@slm.duckdns.org \
    --to=tj@kernel.org \
    --cc=axboe@kernel.dk \
    --cc=cgroups@vger.kernel.org \
    --cc=josef@toxicpanda.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=yangerkun@huawei.com \
    --cc=yi.zhang@huawei.com \
    --cc=yukuai1@huaweicloud.com \
    --cc=yukuai3@huawei.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome