* [PATCH] scsi: ufs: ufs-mediatek: configure individual LU queue flags
@ 2024-10-08 6:59 ed.tsai
2024-10-08 17:38 ` Bart Van Assche
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: ed.tsai @ 2024-10-08 6:59 UTC (permalink / raw)
To: peter.wang, Alim Akhtar, Avri Altman, Bart Van Assche,
James E.J. Bottomley, Martin K. Petersen, Stanley Jhu,
Matthias Brugger, AngeloGioacchino Del Regno
Cc: wsd_upstream, chun-hung.wu, Ed Tsai, linux-scsi, linux-kernel,
linux-mediatek, linux-arm-kernel
From: Ed Tsai <ed.tsai@mediatek.com>
Previously, ufs vops config_scsi_dev was removed because there were no
users. ufs-mediatek needs it to configure the queue flags for each LU
individually. Therefore, bring it back and customize the queue flag as
we required.
Signed-off-by: Ed Tsai <ed.tsai@mediatek.com>
---
drivers/ufs/core/ufshcd.c | 3 +++
drivers/ufs/host/ufs-mediatek.c | 10 ++++++++++
include/ufs/ufshcd.h | 1 +
3 files changed, 14 insertions(+)
diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
index 7cab103112e1..be50b86269bf 100644
--- a/drivers/ufs/core/ufshcd.c
+++ b/drivers/ufs/core/ufshcd.c
@@ -5253,6 +5253,9 @@ static int ufshcd_device_configure(struct scsi_device *sdev,
*/
sdev->silence_suspend = 1;
+ if (hba->vops && hba->vops->config_scsi_dev)
+ hba->vops->config_scsi_dev(sdev);
+
ufshcd_crypto_register(hba, q);
return 0;
diff --git a/drivers/ufs/host/ufs-mediatek.c b/drivers/ufs/host/ufs-mediatek.c
index 9a5919434c4e..0b57623edca5 100644
--- a/drivers/ufs/host/ufs-mediatek.c
+++ b/drivers/ufs/host/ufs-mediatek.c
@@ -1780,6 +1780,15 @@ static int ufs_mtk_config_esi(struct ufs_hba *hba)
return ufs_mtk_config_mcq(hba, true);
}
+static void ufs_mtk_config_scsi_dev(struct scsi_device *sdev)
+{
+ struct ufs_hba *hba = shost_priv(sdev->host);
+
+ dev_dbg(hba->dev, "lu %llu scsi device configured", sdev->lun);
+ if (sdev->lun == 2)
+ blk_queue_flag_set(QUEUE_FLAG_SAME_FORCE, sdev->reqeust_queue);
+}
+
/*
* struct ufs_hba_mtk_vops - UFS MTK specific variant operations
*
@@ -1809,6 +1818,7 @@ static const struct ufs_hba_variant_ops ufs_hba_mtk_vops = {
.op_runtime_config = ufs_mtk_op_runtime_config,
.mcq_config_resource = ufs_mtk_mcq_config_resource,
.config_esi = ufs_mtk_config_esi,
+ .config_scsi_dev = ufs_mtk_config_scsi_dev,
};
/**
diff --git a/include/ufs/ufshcd.h b/include/ufs/ufshcd.h
index a95282b9f743..800d79dc91fc 100644
--- a/include/ufs/ufshcd.h
+++ b/include/ufs/ufshcd.h
@@ -383,6 +383,7 @@ struct ufs_hba_variant_ops {
int (*get_outstanding_cqs)(struct ufs_hba *hba,
unsigned long *ocqs);
int (*config_esi)(struct ufs_hba *hba);
+ void (*config_scsi_dev)(struct scsi_device *sdev);
};
/* clock gating state */
--
2.45.2
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] scsi: ufs: ufs-mediatek: configure individual LU queue flags
2024-10-08 6:59 [PATCH] scsi: ufs: ufs-mediatek: configure individual LU queue flags ed.tsai
@ 2024-10-08 17:38 ` Bart Van Assche
2024-10-08 23:47 ` Ed Tsai (蔡宗軒)
2024-10-09 5:09 ` kernel test robot
2024-11-14 2:49 ` Martin K. Petersen
2 siblings, 1 reply; 5+ messages in thread
From: Bart Van Assche @ 2024-10-08 17:38 UTC (permalink / raw)
To: ed.tsai, peter.wang, Alim Akhtar, Avri Altman,
James E.J. Bottomley, Martin K. Petersen, Stanley Jhu,
Matthias Brugger, AngeloGioacchino Del Regno
Cc: wsd_upstream, chun-hung.wu, linux-scsi, linux-kernel,
linux-mediatek, linux-arm-kernel
On 10/7/24 11:59 PM, ed.tsai@mediatek.com wrote:
> +static void ufs_mtk_config_scsi_dev(struct scsi_device *sdev)
> +{
> + struct ufs_hba *hba = shost_priv(sdev->host);
> +
> + dev_dbg(hba->dev, "lu %llu scsi device configured", sdev->lun);
> + if (sdev->lun == 2)
> + blk_queue_flag_set(QUEUE_FLAG_SAME_FORCE, sdev->reqeust_queue);
> +}
There are no block drivers in the upstream kernel that set
QUEUE_FLAG_SAME_FORCE. An explanation is missing from the patch
description why this flag is set from the UFS driver instead of by
writing the value "2" into /sys/class/block/$bdev/queue/rq_affinity.
Additionally, an explanation is missing why QUEUE_FLAG_SAME_FORCE is
set but QUEUE_FLAG_SAME_COMP not.
Bart.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] scsi: ufs: ufs-mediatek: configure individual LU queue flags
2024-10-08 17:38 ` Bart Van Assche
@ 2024-10-08 23:47 ` Ed Tsai (蔡宗軒)
0 siblings, 0 replies; 5+ messages in thread
From: Ed Tsai (蔡宗軒) @ 2024-10-08 23:47 UTC (permalink / raw)
To: Peter Wang (王信友), avri.altman@wdc.com,
bvanassche@acm.org, martin.petersen@oracle.com,
alim.akhtar@samsung.com, chu.stanley@gmail.com,
James.Bottomley@HansenPartnership.com, matthias.bgg@gmail.com,
AngeloGioacchino Del Regno
Cc: linux-scsi@vger.kernel.org, wsd_upstream,
linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org,
Chun-Hung Wu (巫駿宏),
linux-arm-kernel@lists.infradead.org
On Tue, 2024-10-08 at 10:38 -0700, Bart Van Assche wrote:
> On 10/7/24 11:59 PM, ed.tsai@mediatek.com wrote:
> > +static void ufs_mtk_config_scsi_dev(struct scsi_device *sdev)
> > +{
> > +struct ufs_hba *hba = shost_priv(sdev->host);
> > +
> > +dev_dbg(hba->dev, "lu %llu scsi device configured", sdev->lun);
> > +if (sdev->lun == 2)
> > +blk_queue_flag_set(QUEUE_FLAG_SAME_FORCE, sdev->reqeust_queue);
> > +}
>
> There are no block drivers in the upstream kernel that set
> QUEUE_FLAG_SAME_FORCE. An explanation is missing from the patch
> description why this flag is set from the UFS driver instead of by
> writing the value "2" into /sys/class/block/$bdev/queue/rq_affinity.
The LU probing is completed asynchronously by another thread, which
means that "sdc" cannot be guaranteed to be LU2. We do not need to
change the queue settings at runtime. Therefore, a simpler and more
intuitive approach is to set its flag once the SCSI device is confirmed
to be ready.
> Additionally, an explanation is missing why QUEUE_FLAG_SAME_FORCE is
> set but QUEUE_FLAG_SAME_COMP not.
QUEUE_FLAG_SAME_COMP is the default flag for blk mq queue. As this
stage, it should be set by default.
>
> Bart.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] scsi: ufs: ufs-mediatek: configure individual LU queue flags
2024-10-08 6:59 [PATCH] scsi: ufs: ufs-mediatek: configure individual LU queue flags ed.tsai
2024-10-08 17:38 ` Bart Van Assche
@ 2024-10-09 5:09 ` kernel test robot
2024-11-14 2:49 ` Martin K. Petersen
2 siblings, 0 replies; 5+ messages in thread
From: kernel test robot @ 2024-10-09 5:09 UTC (permalink / raw)
To: ed.tsai, peter.wang, Alim Akhtar, Avri Altman, Bart Van Assche,
James E.J. Bottomley, Martin K. Petersen, Stanley Jhu,
Matthias Brugger, AngeloGioacchino Del Regno
Cc: oe-kbuild-all, wsd_upstream, chun-hung.wu, Ed Tsai, linux-scsi,
linux-kernel, linux-mediatek, linux-arm-kernel
Hi,
kernel test robot noticed the following build errors:
[auto build test ERROR on mkp-scsi/for-next]
[also build test ERROR on jejb-scsi/for-next linus/master v6.12-rc2 next-20241008]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/ed-tsai-mediatek-com/scsi-ufs-ufs-mediatek-configure-individual-LU-queue-flags/20241008-153700
base: https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git for-next
patch link: https://lore.kernel.org/r/20241008065950.23431-1-ed.tsai%40mediatek.com
patch subject: [PATCH] scsi: ufs: ufs-mediatek: configure individual LU queue flags
config: arm-allyesconfig (https://download.01.org/0day-ci/archive/20241009/202410091257.SE04cckD-lkp@intel.com/config)
compiler: arm-linux-gnueabi-gcc (GCC) 14.1.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241009/202410091257.SE04cckD-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202410091257.SE04cckD-lkp@intel.com/
All errors (new ones prefixed by >>):
drivers/ufs/host/ufs-mediatek.c: In function 'ufs_mtk_config_scsi_dev':
>> drivers/ufs/host/ufs-mediatek.c:1789:65: error: 'struct scsi_device' has no member named 'reqeust_queue'; did you mean 'request_queue'?
1789 | blk_queue_flag_set(QUEUE_FLAG_SAME_FORCE, sdev->reqeust_queue);
| ^~~~~~~~~~~~~
| request_queue
Kconfig warnings: (for reference only)
WARNING: unmet direct dependencies detected for GET_FREE_REGION
Depends on [n]: SPARSEMEM [=n]
Selected by [y]:
- RESOURCE_KUNIT_TEST [=y] && RUNTIME_TESTING_MENU [=y] && KUNIT [=y]
vim +1789 drivers/ufs/host/ufs-mediatek.c
1782
1783 static void ufs_mtk_config_scsi_dev(struct scsi_device *sdev)
1784 {
1785 struct ufs_hba *hba = shost_priv(sdev->host);
1786
1787 dev_dbg(hba->dev, "lu %llu scsi device configured", sdev->lun);
1788 if (sdev->lun == 2)
> 1789 blk_queue_flag_set(QUEUE_FLAG_SAME_FORCE, sdev->reqeust_queue);
1790 }
1791
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] scsi: ufs: ufs-mediatek: configure individual LU queue flags
2024-10-08 6:59 [PATCH] scsi: ufs: ufs-mediatek: configure individual LU queue flags ed.tsai
2024-10-08 17:38 ` Bart Van Assche
2024-10-09 5:09 ` kernel test robot
@ 2024-11-14 2:49 ` Martin K. Petersen
2 siblings, 0 replies; 5+ messages in thread
From: Martin K. Petersen @ 2024-11-14 2:49 UTC (permalink / raw)
To: peter.wang, Alim Akhtar, Avri Altman, Bart Van Assche,
James E.J. Bottomley, Stanley Jhu, Matthias Brugger,
AngeloGioacchino Del Regno, ed.tsai
Cc: Martin K . Petersen, wsd_upstream, chun-hung.wu, linux-scsi,
linux-kernel, linux-mediatek, linux-arm-kernel
On Tue, 08 Oct 2024 14:59:42 +0800, ed.tsai@mediatek.com wrote:
> Previously, ufs vops config_scsi_dev was removed because there were no
> users. ufs-mediatek needs it to configure the queue flags for each LU
> individually. Therefore, bring it back and customize the queue flag as
> we required.
>
>
Applied to 6.13/scsi-queue, thanks!
[1/1] scsi: ufs: ufs-mediatek: configure individual LU queue flags
https://git.kernel.org/mkp/scsi/c/7670e74ff319
--
Martin K. Petersen Oracle Linux Engineering
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2024-11-14 2:53 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-08 6:59 [PATCH] scsi: ufs: ufs-mediatek: configure individual LU queue flags ed.tsai
2024-10-08 17:38 ` Bart Van Assche
2024-10-08 23:47 ` Ed Tsai (蔡宗軒)
2024-10-09 5:09 ` kernel test robot
2024-11-14 2:49 ` 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;
as well as URLs for NNTP newsgroup(s).