Thread (13 messages) flat view 13 messages, 3 authors, 2021-05-21

Re: [PATCH 2/2] blk: Fix lock inversion between ioc lock and bfqd lock

From: Khazhy Kumykov <hidden>
Date: 2021-05-21 03:30:26

On Thu, May 20, 2021 at 5:57 PM Ming Lei [off-list ref] wrote:
On Fri, May 21, 2021 at 12:33:53AM +0200, Jan Kara wrote:
quoted
Lockdep complains about lock inversion between ioc->lock and bfqd->lock:

bfqd -> ioc:
 put_io_context+0x33/0x90 -> ioc->lock grabbed
 blk_mq_free_request+0x51/0x140
 blk_put_request+0xe/0x10
 blk_attempt_req_merge+0x1d/0x30
 elv_attempt_insert_merge+0x56/0xa0
 blk_mq_sched_try_insert_merge+0x4b/0x60
 bfq_insert_requests+0x9e/0x18c0 -> bfqd->lock grabbed
We could move blk_put_request() into scheduler code, then the lock
inversion is avoided. So far only mq-deadline and bfq calls into
blk_mq_sched_try_insert_merge(), and this change should be small.
We'd potentially be putting multiple requests if we keep the recursive merge.

Could we move backmerge loop to the schedulers, perhaps?

Thanks,
Ming

Attachments

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help