Thread (7 messages) flat view 7 messages, 3 authors, 2021-08-10

Re: [PATCH] blk-iocost: fix lockdep warning on blkcg->lock

From: Jens Axboe <axboe@kernel.dk>
Date: 2021-08-03 13:03:22

On 8/3/21 7:02 AM, Jens Axboe wrote:
On 8/3/21 1:06 AM, Ming Lei wrote:
quoted
blkcg->lock depends on q->queue_lock which may depend on another driver
lock required in irq context, one example is dm-thin:

	Chain exists of:
	  &pool->lock#3 --> &q->queue_lock --> &blkcg->lock

	 Possible interrupt unsafe locking scenario:

	       CPU0                    CPU1
	       ----                    ----
	  lock(&blkcg->lock);
	                               local_irq_disable();
	                               lock(&pool->lock#3);
	                               lock(&q->queue_lock);
	  <Interrupt>
	    lock(&pool->lock#3);

Fix the issue by using spin_lock_irq(&blkcg->lock) in ioc_weight_write().
This looks fine to me for blk-iocost, but block/blk-cgroup.c:blkg_create()
also looks like it gets the IRQ state of the same lock wrong?
Ah, that one is under the queue lock, so irqs are already disabled.

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