From: Damien Le Moal <dlemoal@kernel.org>
To: Nilay Shroff <nilay@linux.ibm.com>,
Ming Lei <ming.lei@redhat.com>,
"Martin K . Petersen" <martin.petersen@oracle.com>,
linux-scsi@vger.kernel.org
Cc: linux-block@vger.kernel.org, Christoph Hellwig <hch@lst.de>
Subject: Re: [PATCH] scsi: avoid to send scsi command with ->queue_limits lock held
Date: Sat, 4 Jan 2025 21:50:53 +0900 [thread overview]
Message-ID: <84b856a9-482a-45ac-974b-61bbe619b588@kernel.org> (raw)
In-Reply-To: <89b19b37-3e47-4914-aed0-83e5602c3ab8@linux.ibm.com>
On 1/4/25 20:28, Nilay Shroff wrote:
>
>
> On 1/4/25 12:47 PM, Damien Le Moal wrote:
>> On 12/31/24 13:22, Ming Lei wrote:
>>> Block request queue is often frozen before acquiring the queue
>>> ->limits_lock.
>>
>> "often" is rather vague. What cases are we talking about here beside the block
>> layer sysfs ->store() operations ? Fixing these is easy and does not need this
>> change.
> Other than sysfs ->store(), I see there're few call sites in NVMe driver (nvme_update_
> ns_info_block(), nvme_update_ns_info_generic(), nvme_update_ns_info() etc.) which first
> freezes queue and then acquire limits lock. Also there's one call site (__blk_mq_update_
> nr_hw_queues) in block layer which does the same.
I sent a patch to address the block layer sysfs. Starting looking into these
other calls with the reversed locking.
>> Furthermore, this change almost feels like a layering violation as it replicates
>> most of the queue limits structure inside sd. This introducing a strong
>> dependency to the block layer internals which we should avoid.
>>
> In theory, we don't need to hold limits lock while sd_revalidate_disk() reads various
> limits from hardware. However can't we make this one exception (till we find a better
> solution) for sd_revalidate_disk() and allow it to acquire limits lock while blk-mq
> request is processed?
Sure, but issuing IOs to probe a device with the limits lock held is also *not*
an issue. All that can cause is a slight delay for user initiated changes
through sysfs. The fundamental issue is not issuing IOs with the limits lock
held, it is the inconsistent ordering of the calls to blk_mq_freeze_queue and
queue_limits_start_update().
My take on this is that we should always freeze the queue only once the limits
lock is held, with the queue freeze only around queue_limits_commit_update(). If
the consensus is to do the reverse, that's fine with me as well, but probably
will be more work to change (as this large patch tends to indicate).
--
Damien Le Moal
Western Digital Research
next prev parent reply other threads:[~2025-01-04 12:50 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-31 4:22 [PATCH] scsi: avoid to send scsi command with ->queue_limits lock held Ming Lei
2025-01-01 11:16 ` Nilay Shroff
2025-01-02 1:09 ` Ming Lei
2025-01-04 7:17 ` Damien Le Moal
2025-01-04 11:28 ` Nilay Shroff
2025-01-04 12:50 ` Damien Le Moal [this message]
2025-01-06 1:02 ` Ming Lei
2025-01-06 1:30 ` Damien Le Moal
2025-01-06 3:01 ` Ming Lei
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=84b856a9-482a-45ac-974b-61bbe619b588@kernel.org \
--to=dlemoal@kernel.org \
--cc=hch@lst.de \
--cc=linux-block@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=ming.lei@redhat.com \
--cc=nilay@linux.ibm.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.