From: John Garry <john.garry@huawei.com>
To: Bart Van Assche <bvanassche@acm.org>, <axboe@kernel.dk>,
<ming.lei@redhat.com>
Cc: <linux-block@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<hch@lst.de>, <hare@suse.de>, <kashyap.desai@broadcom.com>,
<linuxarm@huawei.com>, <pragalla@codeaurora.org>
Subject: Re: [RFC PATCH v2 2/2] blk-mq: Lockout tagset iter when freeing rqs
Date: Wed, 10 Feb 2021 14:39:53 +0000 [thread overview]
Message-ID: <fbeb7dc0-8091-51a2-78e1-5f563a3ed53d@huawei.com> (raw)
In-Reply-To: <760304b3-dcbc-5b9d-0c70-627b7ff5b4eb@huawei.com>
+
On 04/01/2021 18:37, John Garry wrote:
Hi Bart,
>
>> Right, what I proposed is unrelated to the use-after-free triggered by
>> disabling I/O scheduling.
>>
>> Regarding the races triggered by disabling I/O scheduling: can these be
>> fixed by quiescing all request queues associated with a tag set before
>> changing the I/O scheduler instead of only the request queue for which
>> the
>> I/O scheduler is changed? I think we already do this before updating the
>> number of hardware queues.
>
> Maybe quiescing all request queues could solve the issue in
> blk_mq_queue_tag_busy_iter(), as that issue involves interaction of 2x
> request queues.
>
> But the blk_mq_tagset_busy_iter() issue, above, it is related to only a
> single request queue, so not sure how it could help.
>
> But let me consider this more.
I have looked at this proposal again, that being to quiesce all (other)
request queues prior to freeing the IO scheduler tags+requests. I tried
this and it seems to work (changes not shown), in terms of solving the
issue of blk_mq_queue_tag_busy_iter() and freeing the requests+tags
racing. However, I am still not sure if it is acceptable to quiesce all
request queues like this just when changing IO scheduler, even if it is
done elsewhere.
In addition, this still leaves the blk_mq_tagset_busy_iter() issue; that
being that freeing requests+tags can race against that same function.
There is nothing to stop blk_mq_tagset_busy_iter() taking a reference to
a request and that request being freed in parallel when switching IO
scheduler, however unlikely.
Solving that becomes trickier. As Ming pointed out, that function can be
called from softirq and even hard irq context - like
ufshcd_tmv_handler() -> blk_mq_tagset_busy_iter() - so there is a
locking context issue.
Thanks,
John
next prev parent reply other threads:[~2021-02-10 14:42 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-17 11:07 [RFC PATCH v2 0/2] blk-mq: Avoid use-after-free for accessing old requests John Garry
2020-12-17 11:07 ` [RFC PATCH v2 1/2] blk-mq: Clean up references to old requests when freeing rqs John Garry
2020-12-17 11:07 ` [RFC PATCH v2 2/2] blk-mq: Lockout tagset iter " John Garry
2020-12-18 1:55 ` Bart Van Assche
2020-12-18 9:30 ` John Garry
2020-12-18 3:31 ` Ming Lei
2020-12-18 10:01 ` John Garry
2020-12-18 22:43 ` Bart Van Assche
2020-12-21 12:06 ` John Garry
2020-12-21 18:09 ` Bart Van Assche
2020-12-21 18:47 ` John Garry
2020-12-22 2:13 ` Bart Van Assche
2020-12-22 11:15 ` John Garry
2020-12-22 16:16 ` Bart Van Assche
2020-12-23 11:10 ` John Garry
2020-12-23 11:40 ` John Garry
2020-12-23 15:47 ` Bart Van Assche
2021-01-04 15:33 ` John Garry
2021-01-04 17:22 ` Bart Van Assche
2021-01-04 18:43 ` John Garry
[not found] ` <760304b3-dcbc-5b9d-0c70-627b7ff5b4eb@huawei.com>
2021-02-10 14:39 ` John Garry [this message]
2020-12-22 11:22 ` John Garry
2020-12-22 13:24 ` 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:
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=fbeb7dc0-8091-51a2-78e1-5f563a3ed53d@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=linuxarm@huawei.com \
--cc=ming.lei@redhat.com \
--cc=pragalla@codeaurora.org \
/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®