]> www.infradead.org Git - nvme.git/commit
blk-mq: move cpuhp callback registering out of q->sysfs_lock
authorMing Lei <ming.lei@redhat.com>
Fri, 6 Dec 2024 11:16:07 +0000 (19:16 +0800)
committerJens Axboe <axboe@kernel.dk>
Fri, 6 Dec 2024 16:48:46 +0000 (09:48 -0700)
commit22465bbac53c821319089016f268a2437de9b00a
treeede441a86ad12f66b693f6852bbe6225776efe98
parent4bf485a7db5d82ddd0f3ad2b299893199090375e
blk-mq: move cpuhp callback registering out of q->sysfs_lock

Registering and unregistering cpuhp callback requires global cpu hotplug lock,
which is used everywhere. Meantime q->sysfs_lock is used in block layer
almost everywhere.

It is easy to trigger lockdep warning[1] by connecting the two locks.

Fix the warning by moving blk-mq's cpuhp callback registering out of
q->sysfs_lock. Add one dedicated global lock for covering registering &
unregistering hctx's cpuhp, and it is safe to do so because hctx is
guaranteed to be live if our request_queue is live.

[1] https://lore.kernel.org/lkml/Z04pz3AlvI4o0Mr8@agluck-desk3/

Cc: Reinette Chatre <reinette.chatre@intel.com>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: Peter Newman <peternewman@google.com>
Cc: Babu Moger <babu.moger@amd.com>
Reported-by: Luck Tony <tony.luck@intel.com>
Signed-off-by: Ming Lei <ming.lei@redhat.com>
Tested-by: Tony Luck <tony.luck@intel.com>
Link: https://lore.kernel.org/r/20241206111611.978870-3-ming.lei@redhat.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/blk-mq.c