From: Adrian Hunter <adrian.hunter@intel.com>
To: Bart Van Assche <bvanassche@acm.org>
Cc: linux-scsi@vger.kernel.org,
"Martin K . Petersen" <martin.petersen@oracle.com>
Subject: Re: [PATCH v2 3/4] scsi: ufs: Enable the BLK_MQ_F_BLOCKING flag
Date: Tue, 23 May 2023 22:19:07 +0300 [thread overview]
Message-ID: <cac55dea-ec77-2802-f975-89a1cb1c734f@intel.com> (raw)
In-Reply-To: <343be0eb-0650-cc5e-3154-ffe30f92c17d@acm.org>
On 23/05/23 20:10, Bart Van Assche wrote:
> On 5/23/23 09:39, Adrian Hunter wrote:
>> On 18/05/23 01:23, Bart Van Assche wrote:
>>> Prepare for adding code in ufshcd_queuecommand() that may sleep.
>>>
>>> Signed-off-by: Bart Van Assche <bvanassche@acm.org>
>>> ---
>>> drivers/ufs/core/ufshcd.c | 1 +
>>> 1 file changed, 1 insertion(+)
>>>
>>> diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
>>> index 7ee150d67d49..993034ac1696 100644
>>> --- a/drivers/ufs/core/ufshcd.c
>>> +++ b/drivers/ufs/core/ufshcd.c
>>> @@ -8756,6 +8756,7 @@ static const struct scsi_host_template ufshcd_driver_template = {
>>> .max_host_blocked = 1,
>>> .track_queue_depth = 1,
>>> .skip_settle_delay = 1,
>>> + .queuecommand_may_block = true,
>>
>> Shouldn't this only be for controllers that support
>> clock gating?
>
> Hi Adrian,
>
> The overhead of BLK_MQ_F_BLOCKING is small relative to the time required to
> queue a UFS command so I think enabling BLK_MQ_F_BLOCKING for all UFS host
> controllers is fine.
Doesn't it also force the queue to be run asynchronously always?
But in any case, it doesn't seem like something to force on drivers
just because it would take a bit more coding to make it optional.
> BLK_MQ_F_BLOCKING causes the block layer to use SRCU
> instead of RCU. The cost of the sleepable RCU primitives is dominated by
> the memory barrier (smp_mb()) in the srcu_read_lock() and srcu_read_unlock()
> calls. From kernel/rcu/srcutree.c:
>
> int __srcu_read_lock(struct srcu_struct *ssp)
> {
> int idx;
>
> idx = READ_ONCE(ssp->srcu_idx) & 0x1;
> this_cpu_inc(ssp->sda->srcu_lock_count[idx].counter);
> smp_mb(); /* B */ /* Avoid leaking the critical section. */
> return idx;
> }
> EXPORT_SYMBOL_GPL(__srcu_read_lock);
>
> void __srcu_read_unlock(struct srcu_struct *ssp, int idx)
> {
> smp_mb(); /* C */ /* Avoid leaking the critical section. */
> this_cpu_inc(ssp->sda->srcu_unlock_count[idx].counter);
> }
> EXPORT_SYMBOL_GPL(__srcu_read_unlock);
>
> The rcu_read_lock() and rcu_read_lock() implementations do not call
> smp_mb() as one can see in include/linux/rcupdate.h:
>
> static inline void __rcu_read_lock(void)
> {
> preempt_disable();
> }
>
> static inline void __rcu_read_unlock(void)
> {
> preempt_enable();
> if (IS_ENABLED(CONFIG_RCU_STRICT_GRACE_PERIOD))
> rcu_read_unlock_strict();
> }
>
> Thanks,
>
> Bart.
>
next prev parent reply other threads:[~2023-05-23 19:19 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-17 22:23 [PATCH v2 0/4] ufs: Do not requeue while ungating the clock Bart Van Assche
2023-05-17 22:23 ` [PATCH v2 1/4] scsi: core: Rework scsi_host_block() Bart Van Assche
2023-05-17 23:59 ` Ming Lei
2023-05-17 22:23 ` [PATCH v2 2/4] scsi: core: Support setting BLK_MQ_F_BLOCKING Bart Van Assche
2023-05-17 22:23 ` [PATCH v2 3/4] scsi: ufs: Enable the BLK_MQ_F_BLOCKING flag Bart Van Assche
2023-05-23 16:39 ` Adrian Hunter
2023-05-23 17:10 ` Bart Van Assche
2023-05-23 19:19 ` Adrian Hunter [this message]
2023-05-23 19:57 ` Bart Van Assche
2023-05-24 5:55 ` Adrian Hunter
2023-05-25 21:16 ` Bart Van Assche
2023-05-26 7:11 ` Adrian Hunter
2023-05-26 17:27 ` Bart Van Assche
2023-05-29 6:20 ` Adrian Hunter
2023-05-17 22:23 ` [PATCH v2 4/4] scsi: ufs: Ungate the clock synchronously Bart Van Assche
2023-05-22 19:33 ` [PATCH v2 0/4] ufs: Do not requeue while ungating the clock Bart Van Assche
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=cac55dea-ec77-2802-f975-89a1cb1c734f@intel.com \
--to=adrian.hunter@intel.com \
--cc=bvanassche@acm.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.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;
as well as URLs for NNTP newsgroup(s).