public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ufs: core: Use a host-wide tagset in SDB mode
@ 2026-01-16 18:07 Bart Van Assche
  2026-01-21  7:21 ` Peter Wang (王信友)
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Bart Van Assche @ 2026-01-16 18:07 UTC (permalink / raw)
  To: Martin K . Petersen
  Cc: linux-scsi, Bart Van Assche, James E.J. Bottomley, Peter Wang,
	Manivannan Sadhasivam, Alok Tiwari, Chenyuan Yang, vamshi gajjela,
	ping.gao, Bean Huo, Can Guo, Bao D. Nguyen, Avri Altman,
	Adrian Hunter

In single-doorbell (SDB) mode there is only a single request queue. Hence,
it doesn't matter whether or not the SCSI host tagset is configured as
host-wide. Configure the host tagset as host-wide in SDB mode because
this enables a simplification of the hot path.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/ufs/core/ufs-mcq.c     | 2 --
 drivers/ufs/core/ufshcd-priv.h | 7 +------
 drivers/ufs/core/ufshcd.c      | 1 +
 3 files changed, 2 insertions(+), 8 deletions(-)

diff --git a/drivers/ufs/core/ufs-mcq.c b/drivers/ufs/core/ufs-mcq.c
index 64c234096e23..18a95b728633 100644
--- a/drivers/ufs/core/ufs-mcq.c
+++ b/drivers/ufs/core/ufs-mcq.c
@@ -444,7 +444,6 @@ EXPORT_SYMBOL_GPL(ufshcd_mcq_config_esi);
 
 int ufshcd_mcq_init(struct ufs_hba *hba)
 {
-	struct Scsi_Host *host = hba->host;
 	struct ufs_hw_queue *hwq;
 	int ret, i;
 
@@ -478,7 +477,6 @@ int ufshcd_mcq_init(struct ufs_hba *hba)
 		mutex_init(&hwq->sq_mutex);
 	}
 
-	host->host_tagset = 1;
 	return 0;
 }
 
diff --git a/drivers/ufs/core/ufshcd-priv.h b/drivers/ufs/core/ufshcd-priv.h
index 4259f499382f..7d6d19361af9 100644
--- a/drivers/ufs/core/ufshcd-priv.h
+++ b/drivers/ufs/core/ufshcd-priv.h
@@ -374,12 +374,7 @@ static inline bool ufs_is_valid_unit_desc_lun(struct ufs_dev_info *dev_info, u8
  */
 static inline struct scsi_cmnd *ufshcd_tag_to_cmd(struct ufs_hba *hba, u32 tag)
 {
-	/*
-	 * Host-wide tags are enabled in MCQ mode only. See also the
-	 * host->host_tagset assignment in ufs-mcq.c.
-	 */
-	struct blk_mq_tags *tags = hba->host->tag_set.shared_tags ?:
-					   hba->host->tag_set.tags[0];
+	struct blk_mq_tags *tags = hba->host->tag_set.shared_tags;
 	struct request *rq = blk_mq_tag_to_rq(tags, tag);
 
 	if (WARN_ON_ONCE(!rq))
diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
index 057678f4c50a..889da15a61f0 100644
--- a/drivers/ufs/core/ufshcd.c
+++ b/drivers/ufs/core/ufshcd.c
@@ -9320,6 +9320,7 @@ static const struct scsi_host_template ufshcd_driver_template = {
 	.max_segment_size	= PRDT_DATA_BYTE_COUNT_MAX,
 	.max_sectors		= SZ_1M / SECTOR_SIZE,
 	.max_host_blocked	= 1,
+	.host_tagset		= true,
 	.track_queue_depth	= 1,
 	.skip_settle_delay	= 1,
 	.sdev_groups		= ufshcd_driver_groups,

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] ufs: core: Use a host-wide tagset in SDB mode
  2026-01-16 18:07 [PATCH] ufs: core: Use a host-wide tagset in SDB mode Bart Van Assche
@ 2026-01-21  7:21 ` Peter Wang (王信友)
  2026-01-21 17:27   ` Bart Van Assche
  2026-02-04  2:57 ` Martin K. Petersen
  2026-02-08  2:01 ` Martin K. Petersen
  2 siblings, 1 reply; 6+ messages in thread
From: Peter Wang (王信友) @ 2026-01-21  7:21 UTC (permalink / raw)
  To: bvanassche@acm.org, martin.petersen@oracle.com
  Cc: beanhuo@micron.com, vamshigajjela@google.com,
	alok.a.tiwari@oracle.com, quic_cang@quicinc.com,
	linux-scsi@vger.kernel.org, chenyuan0y@gmail.com,
	quic_nguyenb@quicinc.com, adrian.hunter@intel.com,
	ping.gao@samsung.com, avri.altman@sandisk.com, mani@kernel.org,
	James.Bottomley@HansenPartnership.com

On Fri, 2026-01-16 at 10:07 -0800, Bart Van Assche wrote:
> In single-doorbell (SDB) mode there is only a single request queue.
> Hence,
> it doesn't matter whether or not the SCSI host tagset is configured
> as
> host-wide. Configure the host tagset as host-wide in SDB mode because
> this enables a simplification of the hot path.
> 

Hi Bart,

Would this affect the performance of the SDB mode?


> 
> diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
> index 057678f4c50a..889da15a61f0 100644
> --- a/drivers/ufs/core/ufshcd.c
> +++ b/drivers/ufs/core/ufshcd.c
> @@ -9320,6 +9320,7 @@ static const struct scsi_host_template
> ufshcd_driver_template = {
>         .max_segment_size       = PRDT_DATA_BYTE_COUNT_MAX,
>         .max_sectors            = SZ_1M / SECTOR_SIZE,
>         .max_host_blocked       = 1,
> +       .host_tagset            = true,

Should be = 1?

Thanks
Peter

>         .track_queue_depth      = 1,
>         .skip_settle_delay      = 1,
>         .sdev_groups            = ufshcd_driver_groups,


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] ufs: core: Use a host-wide tagset in SDB mode
  2026-01-21  7:21 ` Peter Wang (王信友)
@ 2026-01-21 17:27   ` Bart Van Assche
  2026-01-27  6:36     ` Peter Wang (王信友)
  0 siblings, 1 reply; 6+ messages in thread
From: Bart Van Assche @ 2026-01-21 17:27 UTC (permalink / raw)
  To: Peter Wang (王信友), martin.petersen@oracle.com
  Cc: beanhuo@micron.com, vamshigajjela@google.com,
	alok.a.tiwari@oracle.com, quic_cang@quicinc.com,
	linux-scsi@vger.kernel.org, chenyuan0y@gmail.com,
	quic_nguyenb@quicinc.com, adrian.hunter@intel.com,
	ping.gao@samsung.com, avri.altman@sandisk.com, mani@kernel.org,
	James.Bottomley@HansenPartnership.com

On 1/20/26 11:21 PM, Peter Wang (王信友) wrote:
> On Fri, 2026-01-16 at 10:07 -0800, Bart Van Assche wrote:
>> In single-doorbell (SDB) mode there is only a single request queue.
>> Hence,
>> it doesn't matter whether or not the SCSI host tagset is configured
>> as
>> host-wide. Configure the host tagset as host-wide in SDB mode because
>> this enables a simplification of the hot path.
> 
> Would this affect the performance of the SDB mode?

Hi Peter,

I reviewed all the blk_mq_is_shared_tags() calls in the block layer.
Based on that analysis I don't expect a measurable performance impact.

>> diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
>> index 057678f4c50a..889da15a61f0 100644
>> --- a/drivers/ufs/core/ufshcd.c
>> +++ b/drivers/ufs/core/ufshcd.c
>> @@ -9320,6 +9320,7 @@ static const struct scsi_host_template
>> ufshcd_driver_template = {
>>         .max_segment_size       = PRDT_DATA_BYTE_COUNT_MAX,
>>         .max_sectors            = SZ_1M / SECTOR_SIZE,
>>         .max_host_blocked       = 1,
>> +       .host_tagset            = true,
> 
> Should be = 1?
.host_tagset is used as a boolean and the compiler converts 'true' into 
'1' if used as an integer so I think 'true' is fine.

Thanks,

Bart.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] ufs: core: Use a host-wide tagset in SDB mode
  2026-01-21 17:27   ` Bart Van Assche
@ 2026-01-27  6:36     ` Peter Wang (王信友)
  0 siblings, 0 replies; 6+ messages in thread
From: Peter Wang (王信友) @ 2026-01-27  6:36 UTC (permalink / raw)
  To: bvanassche@acm.org, martin.petersen@oracle.com
  Cc: beanhuo@micron.com, vamshigajjela@google.com,
	quic_cang@quicinc.com, alok.a.tiwari@oracle.com,
	linux-scsi@vger.kernel.org, chenyuan0y@gmail.com,
	quic_nguyenb@quicinc.com, adrian.hunter@intel.com,
	ping.gao@samsung.com, avri.altman@sandisk.com, mani@kernel.org,
	James.Bottomley@HansenPartnership.com

On Wed, 2026-01-21 at 09:27 -0800, Bart Van Assche wrote:
> On 1/20/26 11:21 PM, Peter Wang (王信友) wrote:
> > On Fri, 2026-01-16 at 10:07 -0800, Bart Van Assche wrote:
> > > In single-doorbell (SDB) mode there is only a single request
> > > queue.
> > > Hence,
> > > it doesn't matter whether or not the SCSI host tagset is
> > > configured
> > > as
> > > host-wide. Configure the host tagset as host-wide in SDB mode
> > > because
> > > this enables a simplification of the hot path.
> > 
> > Would this affect the performance of the SDB mode?
> 
> Hi Peter,
> 
> I reviewed all the blk_mq_is_shared_tags() calls in the block layer.
> Based on that analysis I don't expect a measurable performance
> impact.
> 

Hi Bart,

After testing, it indeed does not impact performance.


> > > diff --git a/drivers/ufs/core/ufshcd.c
> > > b/drivers/ufs/core/ufshcd.c
> > > index 057678f4c50a..889da15a61f0 100644
> > > --- a/drivers/ufs/core/ufshcd.c
> > > +++ b/drivers/ufs/core/ufshcd.c
> > > @@ -9320,6 +9320,7 @@ static const struct scsi_host_template
> > > ufshcd_driver_template = {
> > >         .max_segment_size       = PRDT_DATA_BYTE_COUNT_MAX,
> > >         .max_sectors            = SZ_1M / SECTOR_SIZE,
> > >         .max_host_blocked       = 1,
> > > +       .host_tagset            = true,
> > 
> > Should be = 1?
> .host_tagset is used as a boolean and the compiler converts 'true'
> into
> '1' if used as an integer so I think 'true' is fine.
> 
> Thanks,
> 
> Bart.

Reviewed-by: Peter Wang <peter.wang@mediatek.com>



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] ufs: core: Use a host-wide tagset in SDB mode
  2026-01-16 18:07 [PATCH] ufs: core: Use a host-wide tagset in SDB mode Bart Van Assche
  2026-01-21  7:21 ` Peter Wang (王信友)
@ 2026-02-04  2:57 ` Martin K. Petersen
  2026-02-08  2:01 ` Martin K. Petersen
  2 siblings, 0 replies; 6+ messages in thread
From: Martin K. Petersen @ 2026-02-04  2:57 UTC (permalink / raw)
  To: Bart Van Assche
  Cc: Martin K . Petersen, linux-scsi, James E.J. Bottomley, Peter Wang,
	Manivannan Sadhasivam, Alok Tiwari, Chenyuan Yang, vamshi gajjela,
	ping.gao, Bean Huo, Can Guo, Bao D. Nguyen, Avri Altman,
	Adrian Hunter


Bart,

> In single-doorbell (SDB) mode there is only a single request queue.
> Hence, it doesn't matter whether or not the SCSI host tagset is
> configured as host-wide. Configure the host tagset as host-wide in SDB
> mode because this enables a simplification of the hot path.

Applied to 6.20/scsi-staging, thanks!

-- 
Martin K. Petersen

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] ufs: core: Use a host-wide tagset in SDB mode
  2026-01-16 18:07 [PATCH] ufs: core: Use a host-wide tagset in SDB mode Bart Van Assche
  2026-01-21  7:21 ` Peter Wang (王信友)
  2026-02-04  2:57 ` Martin K. Petersen
@ 2026-02-08  2:01 ` Martin K. Petersen
  2 siblings, 0 replies; 6+ messages in thread
From: Martin K. Petersen @ 2026-02-08  2:01 UTC (permalink / raw)
  To: Bart Van Assche
  Cc: Martin K . Petersen, linux-scsi, James E.J. Bottomley, Peter Wang,
	Manivannan Sadhasivam, Alok Tiwari, Chenyuan Yang, vamshi gajjela,
	ping.gao, Bean Huo, Can Guo, Bao D. Nguyen, Avri Altman,
	Adrian Hunter

On Fri, 16 Jan 2026 10:07:51 -0800, Bart Van Assche wrote:

> In single-doorbell (SDB) mode there is only a single request queue. Hence,
> it doesn't matter whether or not the SCSI host tagset is configured as
> host-wide. Configure the host tagset as host-wide in SDB mode because
> this enables a simplification of the hot path.
> 
> 

Applied to 6.20/scsi-queue, thanks!

[1/1] ufs: core: Use a host-wide tagset in SDB mode
      https://git.kernel.org/mkp/scsi/c/4d0538dd5d7e

-- 
Martin K. Petersen

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-02-08  2:02 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-16 18:07 [PATCH] ufs: core: Use a host-wide tagset in SDB mode Bart Van Assche
2026-01-21  7:21 ` Peter Wang (王信友)
2026-01-21 17:27   ` Bart Van Assche
2026-01-27  6:36     ` Peter Wang (王信友)
2026-02-04  2:57 ` Martin K. Petersen
2026-02-08  2:01 ` Martin K. Petersen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox