From: John Garry <john.garry@huawei.com>
To: Bart Van Assche <bvanassche@acm.org>, <hare@suse.de>,
<ming.lei@redhat.com>, <axboe@kernel.dk>, <hch@lst.de>
Cc: <linux-block@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<pragalla@codeaurora.org>, <kashyap.desai@broadcom.com>,
<yuyufen@huawei.com>
Subject: Re: [RFC PATCH v3 2/3] blk-mq: Freeze and quiesce all queues for tagset in elevator_exit()
Date: Mon, 8 Mar 2021 10:50:55 +0000 [thread overview]
Message-ID: <3c6cbe11-ac31-9a47-0096-17fbd584b83e@huawei.com> (raw)
In-Reply-To: <52618092-07ca-ecb5-320f-957af26ab146@acm.org>
On 06/03/2021 04:32, Bart Van Assche wrote:
> On 3/5/21 7:14 AM, John Garry wrote:
>> diff --git a/block/blk.h b/block/blk.h
>> index 3b53e44b967e..1a948bfd91e4 100644
>> --- a/block/blk.h
>> +++ b/block/blk.h
>> @@ -201,10 +201,29 @@ void elv_unregister_queue(struct request_queue *q);
>> static inline void elevator_exit(struct request_queue *q,
>> struct elevator_queue *e)
>> {
>> + struct blk_mq_tag_set *set = q->tag_set;
>> + struct request_queue *tmp;
>> +
>> lockdep_assert_held(&q->sysfs_lock);
>>
>> + mutex_lock(&set->tag_list_lock);
>> + list_for_each_entry(tmp, &set->tag_list, tag_set_list) {
>> + if (tmp == q)
>> + continue;
>> + blk_mq_freeze_queue(tmp);
>> + blk_mq_quiesce_queue(tmp);
>> + }
>> +
>> blk_mq_sched_free_requests(q);
>> __elevator_exit(q, e);
>> +
>> + list_for_each_entry(tmp, &set->tag_list, tag_set_list) {
>> + if (tmp == q)
>> + continue;
>> + blk_mq_unquiesce_queue(tmp);
>> + blk_mq_unfreeze_queue(tmp);
>> + }
>> + mutex_unlock(&set->tag_list_lock);
>> }
Hi Bart,
> This patch introduces nesting of tag_list_lock inside sysfs_lock. The
> latter is per request queue while the former can be shared across
> multiple request queues. Has it been analyzed whether this is safe?
Firstly - ignoring implementation details for a moment - this patch is
to ensure that the concept is consistent with your suggestion and
whether it is sound.
As for nested locking, I can analyze more, but I did assume that we
don't care about locking-out sysfs intervention during this time. And it
seems pretty difficult to avoid nesting the locks.
And further to this, I see that
https://lore.kernel.org/linux-block/3aa5407c-0800-2482-597b-4264781a7eac@grimberg.me/T/#mc3e3175642660578c0ae2a6c32185b1e34ec4b8a
has a new interface for tagset quiesce, which could make this process
more efficient.
Please let me know further thoughts.
Thanks,
John
next prev parent reply other threads:[~2021-03-08 10:53 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-05 15:14 [RFC PATCH v3 0/3] blk-mq: Avoid use-after-free for accessing old requests John Garry
2021-03-05 15:14 ` [RFC PATCH v3 1/3] blk-mq: Clean up references to old requests when freeing rqs John Garry
2021-03-06 2:52 ` Khazhy Kumykov
2021-03-08 11:18 ` John Garry
2021-03-06 18:13 ` Bart Van Assche
2021-03-08 10:37 ` John Garry
2021-03-05 15:14 ` [RFC PATCH v3 2/3] blk-mq: Freeze and quiesce all queues for tagset in elevator_exit() John Garry
2021-03-06 4:32 ` Bart Van Assche
2021-03-08 10:50 ` John Garry [this message]
2021-03-08 19:35 ` Bart Van Assche
2021-03-10 15:57 ` Bart Van Assche
2021-03-11 0:58 ` Ming Lei
2021-03-11 8:21 ` John Garry
2021-03-12 23:05 ` Bart Van Assche
2021-03-16 16:15 ` John Garry
2021-03-16 17:00 ` Bart Van Assche
2021-03-16 17:43 ` John Garry
2021-03-16 19:59 ` Bart Van Assche
2021-03-19 18:19 ` John Garry
2021-03-19 18:32 ` Bart Van Assche
2021-03-05 15:14 ` [RFC PATCH v3 3/3] blk-mq: Lockout tagset iterator when exiting elevator John Garry
2021-03-06 4:43 ` Bart Van Assche
2021-03-08 11:17 ` John Garry
2021-03-08 19:59 ` Bart Van Assche
2021-03-09 17:47 ` John Garry
2021-03-09 19:21 ` Bart Van Assche
2021-03-10 8:52 ` John Garry
2021-03-10 16:00 ` Bart Van Assche
2021-03-10 17:26 ` John Garry
2021-03-18 10:26 ` [RFC PATCH v3 0/3] blk-mq: Avoid use-after-free for accessing old requests Shinichiro Kawasaki
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=3c6cbe11-ac31-9a47-0096-17fbd584b83e@huawei.com \
--to=john.garry@huawei.com \
--cc=axboe@kernel.dk \
--cc=bvanassche@acm.org \
--cc=hare@suse.de \
--cc=hch@lst.de \
--cc=kashyap.desai@broadcom.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ming.lei@redhat.com \
--cc=pragalla@codeaurora.org \
--cc=yuyufen@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
all inboxes | Powered by JetHome®