mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Bart Van Assche <bvanassche@acm.org>
To: Ziqi Chen <quic_ziqichen@quicinc.com>,
	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: Thu, 20 Jun 2024 13:57:42 -0700	[thread overview]
Message-ID: <d3fc4d2b-81b0-4ab2-9606-5f4a5fb8b867@acm.org> (raw)
In-Reply-To: <1717754818-39863-1-git-send-email-quic_ziqichen@quicinc.com>

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.

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;


  parent reply	other threads:[~2024-06-20 20:58 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 [this message]
2024-06-24  9:56   ` Ziqi Chen
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=d3fc4d2b-81b0-4ab2-9606-5f4a5fb8b867@acm.org \
    --to=bvanassche@acm.org \
    --cc=alim.akhtar@samsung.com \
    --cc=avri.altman@wdc.com \
    --cc=beanhuo@micron.com \
    --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 \
    --cc=quic_ziqichen@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®