From: "Asutosh Das (asd)" <asutoshd@codeaurora.org>
To: Bart Van Assche <bvanassche@acm.org>,
Adrian Hunter <adrian.hunter@intel.com>,
"Martin K . Petersen" <martin.petersen@oracle.com>
Cc: "James E . J . Bottomley" <jejb@linux.ibm.com>,
Bean Huo <huobean@gmail.com>, Avri Altman <avri.altman@wdc.com>,
Alim Akhtar <alim.akhtar@samsung.com>,
Can Guo <cang@codeaurora.org>,
Daejun Park <daejun7.park@samsung.com>,
Stanley Chu <stanley.chu@mediatek.com>,
Luca Porzio <lporzio@micron.com>,
linux-scsi@vger.kernel.org
Subject: Re: [PATCH RFC] scsi: ufs-core: Do not use clk_scaling_lock in ufshcd_queuecommand()
Date: Mon, 8 Nov 2021 10:06:14 -0800 [thread overview]
Message-ID: <715a04b2-1791-1884-22a8-4ed8c680cfb8@codeaurora.org> (raw)
In-Reply-To: <c06be499-fc66-1260-400c-0458eb6de7cf@acm.org>
On 11/4/2021 10:10 AM, Bart Van Assche wrote:
> On 11/4/21 7:23 AM, Asutosh Das (asd) wrote:
>> In the current clock scaling code, the expectation is to scale up as
>> soon as possible.
>>
>> For e.g. say, the current gear is G1 and there're pending requests in
>> the queue but the DBR is empty and there's a decision to scale up.
>> During scale-up, if the queues are frozen, wouldn't those requests be
>> issued to the driver and executed in G1 instead of G4?
>> I think this would lead to higher run to run variance in performance.
>
> Hi Asutosh,
>
> My understanding of the current clock scaling implementation is as
> follows (please correct me if I got anything wrong):
> * ufshcd_clock_scaling_prepare() is called before clock scaling happens
> and ufshcd_clock_scaling_unprepare() is called after clock scaling has
> finished.
> * ufshcd_clock_scaling_prepare() calls ufshcd_scsi_block_requests() and
> ufshcd_wait_for_doorbell_clr().
> * ufshcd_wait_for_doorbell_clr() waits until both the UTP Transfer
> Request List Doorbell Register and UTP Task Management Request List
> DoorBell Register are zero. Hence, it waits until all pending SCSI
> commands, task management commands and device commands have finished.
>
> As far as I can see from a conceptual viewpoint there is no difference
> between calling ufshcd_wait_for_doorbell_clr() or freezing the request
> queues. There is an implementation difference however:
> blk_mq_freeze_queue() waits for an RCU grace period. This can introduce
> an additional delay of several milliseconds compared to
> ufshcd_wait_for_doorbell_clr(). If this is a concern I can look into
> expediting the RCU grace period during clock scaling.
>
> Thanks,
>
> Bart.
Hi Bart,
The current scaling code invokes scsi_block_request() which would block
incoming requests right away in prepare. So any un-issued requests
wouldn't be issued.
I'm not sure if this exact behavior would manifest if
blk_freeze_queue_start() is used and scsi_block_request() is removed.
I see that it invokes - blk_mq_run_hw_queues().
void blk_freeze_queue_start(struct request_queue *q)
{
mutex_lock(&q->mq_freeze_lock);
if (++q->mq_freeze_depth == 1) {
percpu_ref_kill(&q->q_usage_counter);
mutex_unlock(&q->mq_freeze_lock);
if (queue_is_mq(q))
blk_mq_run_hw_queues(q, false);
} else {
mutex_unlock(&q->mq_freeze_lock);
}
}
Would blk_mq_run_hw_queues() issue any pending requests in the queue? If
so, then these requests would be completed in the unchanged power-mode
which is not what we want.
-asd
--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
Linux Foundation Collaborative Project
next prev parent reply other threads:[~2021-11-08 18:06 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-29 13:37 [PATCH RFC] scsi: ufs-core: Do not use clk_scaling_lock in ufshcd_queuecommand() Adrian Hunter
2021-10-29 16:31 ` Bart Van Assche
2021-11-01 9:16 ` Adrian Hunter
2021-11-01 18:35 ` Bart Van Assche
2021-11-02 6:11 ` Adrian Hunter
2021-11-02 20:49 ` Bart Van Assche
2021-11-03 7:46 ` Adrian Hunter
2021-11-03 17:06 ` Bart Van Assche
2021-11-04 14:23 ` Asutosh Das (asd)
2021-11-04 17:10 ` Bart Van Assche
2021-11-08 18:06 ` Asutosh Das (asd) [this message]
2021-11-08 18:24 ` Bart Van Assche
2021-11-03 16:29 ` Asutosh Das (asd)
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=715a04b2-1791-1884-22a8-4ed8c680cfb8@codeaurora.org \
--to=asutoshd@codeaurora.org \
--cc=adrian.hunter@intel.com \
--cc=alim.akhtar@samsung.com \
--cc=avri.altman@wdc.com \
--cc=bvanassche@acm.org \
--cc=cang@codeaurora.org \
--cc=daejun7.park@samsung.com \
--cc=huobean@gmail.com \
--cc=jejb@linux.ibm.com \
--cc=linux-scsi@vger.kernel.org \
--cc=lporzio@micron.com \
--cc=martin.petersen@oracle.com \
--cc=stanley.chu@mediatek.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