Re: [PATCH 1/1] block: Use RCU in blk_mq_[un]quiesce_tagset() instead of set->tag_list_lock

Mohamed Khalfella
2025-12-04T19:16:00Z

On Thu 2025-12-04 09:06:47 -1000, Bart Van Assche wrote:
> On 12/4/25 8:42 AM, Mohamed Khalfella wrote:
> > Is blk_mq_del_queue_tag_set() performance sensitive such that it can not
> > take synchronize_rcu()? It is not in IO codepath, right?
>
> Introducing a new synchronize_rcu() call almost always slows down some
> workload so it should be avoided if possible.
>
> > I can not think of an easy way to do that. Suggestions are welcomed.
>
> I can't find the implementation of nvme_dev_disable_locked(). What
> kernel tree does your patch apply to?
>
> $ git grep -w nvme_dev_disable_locked axboe-block/for-next | wc -l
> 0

The stacktraces are from old 6.6.9 kernel. However, the issue is still
applicable to recent kernels. This is an example from 6.13 kernel.

Oct 1 15:19:30 hostname kernel: INFO: task kworker/151:1H:2442 blocked for more than 122 seconds.
Oct 1 15:19:30 hostname kernel: Tainted: G E 6.13.2-ge5f37b497f62 #1
Oct 1 15:19:30 hostname kernel: "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
Oct 1 15:19:30 hostname kernel: task:kworker/151:1H state:D stack:0 pid:2442 tgid:2442 ppid:2 flags:0x00004000
Oct 1 15:19:30 hostname kernel: Workqueue: kblockd blk_mq_timeout_work
Oct 1 15:19:30 hostname kernel: Call Trace:
Oct 1 15:19:30 hostname kernel: <TASK>
Oct 1 15:19:30 hostname kernel: __schedule+0x47c/0xbb0
Oct 1 15:19:30 hostname kernel: ? timerqueue_add+0x66/0xb0
Oct 1 15:19:30 hostname kernel: schedule+0x1c/0xa0
Oct 1 15:19:30 hostname kernel: schedule_preempt_disabled+0xa/0x10
Oct 1 15:19:30 hostname kernel: __mutex_lock.constprop.0+0x271/0x600
Oct 1 15:19:30 hostname kernel: blk_mq_quiesce_tagset+0x25/0xc0
Oct 1 15:19:30 hostname kernel: nvme_dev_disable+0x9c/0x250
Oct 1 15:19:30 hostname kernel: nvme_timeout+0x1fc/0x520
Oct 1 15:19:30 hostname kernel: blk_mq_handle_expired+0x5c/0x90
Oct 1 15:19:30 hostname kernel: bt_iter+0x7e/0x90
Oct 1 15:19:30 hostname kernel: blk_mq_queue_tag_busy_iter+0x27e/0x550
Oct 1 15:19:30 hostname kernel: ? __blk_mq_complete_request_remote+0x10/0x10
Oct 1 15:19:30 hostname kernel: ? __blk_mq_complete_request_remote+0x10/0x10
Oct 1 15:19:30 hostname kernel: ? __call_rcu_common.constprop.0+0x1c0/0x210
Oct 1 15:19:30 hostname kernel: blk_mq_timeout_work+0x12d/0x170
Oct 1 15:19:30 hostname kernel: process_one_work+0x12e/0x2d0
Oct 1 15:19:30 hostname kernel: worker_thread+0x288/0x3a0
Oct 1 15:19:30 hostname kernel: ? rescuer_thread+0x480/0x480
Oct 1 15:19:30 hostname kernel: kthread+0xb8/0xe0
Oct 1 15:19:30 hostname kernel: ? kthread_park+0x80/0x80
Oct 1 15:19:30 hostname kernel: ret_from_fork+0x2d/0x50
Oct 1 15:19:30 hostname kernel: ? kthread_park+0x80/0x80
Oct 1 15:19:30 hostname kernel: ret_from_fork_asm+0x11/0x20
Oct 1 15:19:30 hostname kernel: </TASK>
Oct 1 15:19:30 hostname kernel: INFO: task python:37330 blocked for more than 122 seconds.
Oct 1 15:19:30 hostname kernel: Tainted: G E 6.13.2-ge5f37b497f62 #1
Oct 1 15:19:30 hostname kernel: "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
Oct 1 15:19:30 hostname kernel: task:python state:D stack:0 pid:37330 tgid:37330 ppid:37329 flags:0x00004002
Oct 1 15:19:30 hostname kernel: Call Trace:
Oct 1 15:19:30 hostname kernel: <TASK>
Oct 1 15:19:30 hostname kernel: __schedule+0x47c/0xbb0
Oct 1 15:19:30 hostname kernel: ? xas_find+0x161/0x1a0
Oct 1 15:19:30 hostname kernel: schedule+0x1c/0xa0
Oct 1 15:19:30 hostname kernel: blk_mq_freeze_queue_wait+0x3d/0x70
Oct 1 15:19:30 hostname kernel: ? destroy_sched_domains_rcu+0x30/0x30
Oct 1 15:19:30 hostname kernel: blk_mq_update_tag_set_shared+0x44/0x80
Oct 1 15:19:30 hostname kernel: blk_mq_exit_queue+0x141/0x150
Oct 1 15:19:30 hostname kernel: del_gendisk+0x25a/0x2d0
Oct 1 15:19:30 hostname kernel: nvme_ns_remove+0xc9/0x170
Oct 1 15:19:30 hostname kernel: nvme_remove_namespaces+0xc7/0x100
Oct 1 15:19:30 hostname kernel: nvme_remove+0x62/0x150
Oct 1 15:19:30 hostname kernel: pci_device_remove+0x23/0x60
Oct 1 15:19:30 hostname kernel: device_release_driver_internal+0x159/0x200
Oct 1 15:19:30 hostname kernel: unbind_store+0x99/0xa0
Oct 1 15:19:30 hostname kernel: kernfs_fop_write_iter+0x112/0x1e0
Oct 1 15:19:30 hostname kernel: vfs_write+0x2b1/0x3d0
Oct 1 15:19:30 hostname kernel: ksys_write+0x4e/0xb0
Oct 1 15:19:30 hostname kernel: do_syscall_64+0x5b/0x160
Oct 1 15:19:30 hostname kernel: entry_SYSCALL_64_after_hwframe+0x4b/0x53
Oct 1 15:19:30 hostname kernel: RIP: 0033:0x7f12cf2fe02f
Oct 1 15:19:30 hostname kernel: RSP: 002b:00007f12311f78e0 EFLAGS: 00000293 ORIG_RAX: 0000000000000001
Oct 1 15:19:30 hostname kernel: RAX: ffffffffffffffda RBX: 00007f12311ff5c8 RCX: 00007f12cf2fe02f
Oct 1 15:19:30 hostname kernel: RDX: 000000000000000c RSI: 00007f12081c19a0 RDI: 000000000000003b
Oct 1 15:19:30 hostname kernel: RBP: 000000000000000c R08: 0000000000000000 R09: 0000000000000002
Oct 1 15:19:30 hostname kernel: R10: 0000000000000002 R11: 0000000000000293 R12: 00007f12cae00700
Oct 1 15:19:30 hostname kernel: R13: 00007f12081c19a0 R14: 000000000000003b R15: 00007f1220219990
Oct 1 15:19:30 hostname kernel: </TASK>

>
> Thanks,
>
> Bart.