archive mirror
 help / color / mirror / Atom feed
From: Ming Lei <>
To: Bart Van Assche <>
Cc: Jens Axboe <>, Christoph Hellwig <>,, Yi Zhang <>
Subject: Re: [PATCH 2/4] block: move wbt allocation into blk_alloc_queue
Date: Fri, 4 Jun 2021 09:22:08 +0800	[thread overview]
Message-ID: <YLmAQIy7kkPqdTz1@T590> (raw)
In-Reply-To: <>

On Thu, Jun 03, 2021 at 05:44:00PM -0700, Bart Van Assche wrote:
> On 5/25/21 1:04 AM, Ming Lei wrote:
> > wbt_init() calls wbt_alloc() which adds allocated wbt instance into
> > q->rq_qos. This way is very dangerous because q->rq_qos is accessed in
> > IO fast path.
> > 
> > So far wbt_init() is called in the two code paths:
> > 
> > 1) blk_register_queue(), when the block device has been exposed to
> > usespace, so IO may come when adding wbt into q->rq_qos
> > 
> > 2) sysfs attribute store, in which normal IO is definitely allowed
> > 
> > Move wbt allocation into blk_alloc_queue() for avoiding to add wbt
> > instance dynamically to q->rq_qos. And before calling wbt_init(), the
> > wbt is disabled, so functionally it works as expected.
> I don't like this change since it is not generic - it only helps the WBT
> implementation.

OK, actually except for wbt, the only one left is iocost which adds
rq_qos via cgroup attribute. 

> All rq-qos policies call rq_qos_add() and all these policies take effect
> before rq_qos_add() returns. Does the q->rq_qos list perhaps have to be
> protected with RCU? Would that be sufficient to fix the crashes reported
> in the cover letter?

Freezing queue should be easier for providing the protection, and I will try
that approach.


  reply	other threads:[~2021-06-04  1:22 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-25  8:04 [PATCH 0/4] block: fix race between adding wbt and normal IO Ming Lei
2021-05-25  8:04 ` [PATCH 1/4] block: split wbt_init() into two parts Ming Lei
2021-06-04  0:32   ` Bart Van Assche
2021-05-25  8:04 ` [PATCH 2/4] block: move wbt allocation into blk_alloc_queue Ming Lei
2021-06-04  0:44   ` Bart Van Assche
2021-06-04  1:22     ` Ming Lei [this message]
2021-05-25  8:04 ` [PATCH 3/4] block: reuse wbt_set_min_lat for setting wbt->min_lat_nsec Ming Lei
2021-05-25  8:04 ` [PATCH 4/4] block: mark queue init done at the end of blk_register_queue Ming Lei
2021-06-04  0:03 ` [PATCH 0/4] block: fix race between adding wbt and normal IO Ming Lei

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:

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

  git send-email \
    --in-reply-to=YLmAQIy7kkPqdTz1@T590 \ \ \ \ \ \ \

* 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;
as well as URLs for NNTP newsgroup(s).