From: Bart Van Assche <bvanassche@acm.org>
To: Li Lingfeng <lilingfeng@huaweicloud.com>,
axboe@kernel.dk, hch@lst.de, jack@suse.cz,
linux-block@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: yukuai1@huaweicloud.com, yukuai3@huawei.com, houtao1@huawei.com,
yi.zhang@huawei.com, yangerkun@huawei.com,
lilingfeng3@huawei.com
Subject: Re: [PATCH] block: Fix potential deadlock warning in blk_mq_mark_tag_wait
Date: Wed, 14 Aug 2024 12:52:36 -0700 [thread overview]
Message-ID: <ad92f738-9ba5-4cfc-aef5-3918a35e77ec@acm.org> (raw)
In-Reply-To: <20240814113542.911023-1-lilingfeng@huaweicloud.com>
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@huawei.com>
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.
next prev parent reply other threads:[~2024-08-14 19:52 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-14 11:35 Li Lingfeng
2024-08-14 19:52 ` Bart Van Assche [this message]
2024-08-14 20:22 ` Jens Axboe
2024-08-15 1:54 ` Yu Kuai
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ad92f738-9ba5-4cfc-aef5-3918a35e77ec@acm.org \
--to=bvanassche@acm.org \
--cc=axboe@kernel.dk \
--cc=hch@lst.de \
--cc=houtao1@huawei.com \
--cc=jack@suse.cz \
--cc=lilingfeng3@huawei.com \
--cc=lilingfeng@huaweicloud.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=yangerkun@huawei.com \
--cc=yi.zhang@huawei.com \
--cc=yukuai1@huaweicloud.com \
--cc=yukuai3@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®