From: Ziqi Chen <quic_ziqichen@quicinc.com>
To: Bart Van Assche <bvanassche@acm.org>, <quic_cang@quicinc.com>,
<mani@kernel.org>, <beanhuo@micron.com>, <avri.altman@wdc.com>,
<junwoo80.lee@samsung.com>, <martin.petersen@oracle.com>,
<quic_nguyenb@quicinc.com>, <quic_nitirawa@quicinc.com>,
<quic_rampraka@quicinc.com>
Cc: <linux-scsi@vger.kernel.org>,
Alim Akhtar <alim.akhtar@samsung.com>,
"James E.J. Bottomley" <jejb@linux.ibm.com>,
Peter Wang <peter.wang@mediatek.com>,
Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>,
Maramaina Naresh <quic_mnaresh@quicinc.com>,
Asutosh Das <quic_asutoshd@quicinc.com>,
"open list" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] scsi: ufs: core: quiesce request queues before check pending cmds
Date: Mon, 24 Jun 2024 17:56:52 +0800 [thread overview]
Message-ID: <efc80348-46c0-4307-a363-a242a7b44d94@quicinc.com> (raw)
In-Reply-To: <d3fc4d2b-81b0-4ab2-9606-5f4a5fb8b867@acm.org>
On 6/21/2024 4:57 AM, Bart Van Assche wrote:
> On 6/7/24 3:06 AM, Ziqi Chen wrote:
>> Fix this race condition by quiescing the request queues before calling
>> ufshcd_pending_cmds() so that block layer won't touch the budget map
>> when ufshcd_pending_cmds() is working on it. In addition, remove the
>> scsi layer blocking/unblocking to reduce redundancies and latencies.
>
> Can you please help with testing whether the patch below would be a good
> alternative to your patch (compile-tested only)?
>
> Thanks,
>
> Bart.
Hi Bart,
Compile-tested is OK, but I don't think it is a better alternative way.
1. Why do we need to call blk_mq_quiesce_tagset() into
ufshcd_scsi_block_requests() instead directly replace all
ufshcd_scsi_block_requests() with blk_mq_quiesce_tagset()?
2. This patch need to to do long-term stress test, I think many OEMs
can't wait as it is a blocker issue for them.
BRs
Ziqi
>
> diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
> index aa00978c6c0e..1d981283b03c 100644
> --- a/drivers/ufs/core/ufshcd.c
> +++ b/drivers/ufs/core/ufshcd.c
> @@ -332,14 +332,12 @@ static void ufshcd_configure_wb(struct ufs_hba *hba)
>
> static void ufshcd_scsi_unblock_requests(struct ufs_hba *hba)
> {
> - if (atomic_dec_and_test(&hba->scsi_block_reqs_cnt))
> - scsi_unblock_requests(hba->host);
> + blk_mq_quiesce_tagset(&hba->host->tag_set);
> }
>
> static void ufshcd_scsi_block_requests(struct ufs_hba *hba)
> {
> - if (atomic_inc_return(&hba->scsi_block_reqs_cnt) == 1)
> - scsi_block_requests(hba->host);
> + blk_mq_unquiesce_tagset(&hba->host->tag_set);
> }
>
> static void ufshcd_add_cmd_upiu_trace(struct ufs_hba *hba, unsigned
> int tag,
> @@ -10590,7 +10588,7 @@ int ufshcd_init(struct ufs_hba *hba, void
> __iomem *mmio_base, unsigned int irq)
>
> /* Hold auto suspend until async scan completes */
> pm_runtime_get_sync(dev);
> - atomic_set(&hba->scsi_block_reqs_cnt, 0);
> +
> /*
> * We are assuming that device wasn't put in sleep/power-down
> * state exclusively during the boot stage before kernel.
> diff --git a/include/ufs/ufshcd.h b/include/ufs/ufshcd.h
> index 443afb97a637..58705994fc46 100644
> --- a/include/ufs/ufshcd.h
> +++ b/include/ufs/ufshcd.h
> @@ -889,7 +889,6 @@ enum ufshcd_mcq_opr {
> * @wb_mutex: used to serialize devfreq and sysfs write booster toggling
> * @clk_scaling_lock: used to serialize device commands and clock scaling
> * @desc_size: descriptor sizes reported by device
> - * @scsi_block_reqs_cnt: reference counting for scsi block requests
> * @bsg_dev: struct device associated with the BSG queue
> * @bsg_queue: BSG queue associated with the UFS controller
> * @rpm_dev_flush_recheck_work: used to suspend from RPM (runtime power
> @@ -1050,7 +1049,6 @@ struct ufs_hba {
>
> struct mutex wb_mutex;
> struct rw_semaphore clk_scaling_lock;
> - atomic_t scsi_block_reqs_cnt;
>
> struct device bsg_dev;
> struct request_queue *bsg_queue;
>
next prev parent reply other threads:[~2024-06-24 9:57 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-07 10:06 Ziqi Chen
2024-06-07 12:33 ` Bart Van Assche
2024-06-11 11:02 ` Ziqi Chen
2024-06-11 13:51 ` Bart Van Assche
2024-06-12 6:07 ` Ziqi Chen
2024-06-11 13:54 ` Bart Van Assche
2024-06-20 20:57 ` Bart Van Assche
2024-06-24 9:56 ` Ziqi Chen [this message]
2024-06-24 16:29 ` Bart Van Assche
2024-06-25 3:38 ` Peter Wang (王信友)
2024-06-25 16:13 ` Bart Van Assche
2024-06-26 3:52 ` Peter Wang (王信友)
2024-06-26 13:18 ` Ziqi Chen
2024-06-26 16:33 ` 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=efc80348-46c0-4307-a363-a242a7b44d94@quicinc.com \
--to=quic_ziqichen@quicinc.com \
--cc=alim.akhtar@samsung.com \
--cc=avri.altman@wdc.com \
--cc=beanhuo@micron.com \
--cc=bvanassche@acm.org \
--cc=jejb@linux.ibm.com \
--cc=junwoo80.lee@samsung.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=mani@kernel.org \
--cc=manivannan.sadhasivam@linaro.org \
--cc=martin.petersen@oracle.com \
--cc=peter.wang@mediatek.com \
--cc=quic_asutoshd@quicinc.com \
--cc=quic_cang@quicinc.com \
--cc=quic_mnaresh@quicinc.com \
--cc=quic_nguyenb@quicinc.com \
--cc=quic_nitirawa@quicinc.com \
--cc=quic_rampraka@quicinc.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®