On 8/14/24 4:35 AM, Li Lingfeng wrote:
When interrupt is turned on while a lock holding by spin_lock_irq it throws a warning because of potential deadlock.
Which tool reported the warning? Please mention this in the patch description.
blk_mq_mark_tag_wait spin_lock_irq(&wq->lock) --> turn off interrupt and get lockA blk_mq_get_driver_tag __blk_mq_tag_busy spin_lock_irq(&tags->lock) spin_unlock_irq(&tags->lock) --> release lockB and turn on interrupt accidentally
The above call chain does not match the code in Linus' master tree. Please fix this.
Fix it by using spin_lock_irqsave to get lockB instead of spin_lock_irq. Fixes: 4f1731df60f9 ("blk-mq: fix potential io hang by wrong 'wake_batch'") Signed-off-by: Li Lingfeng <lilingfeng3@xxxxxxxxxx>
Please leave a blank line between the patch description and the section with tags.
- spin_lock_irq(&tags->lock); + spin_lock_irqsave(&tags->lock, flags); users = tags->active_queues + 1; WRITE_ONCE(tags->active_queues, users); blk_mq_update_wake_batch(tags, users); - spin_unlock_irq(&tags->lock); + spin_unlock_irqrestore(&tags->lock, flags); }
The code changes however look good to me. Thanks, Bart.