From 306d827cfbb9633f5be11438b2fc8922bf4d2b3c Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Tue, 15 Mar 2022 11:05:26 -0700 Subject: [PATCH] Revert "BACKPORT: FROMLIST: scsi: core: Reserve one tag for the UFS driver" Revert commit ff748ee29819 since it is no longer needed now that commit a8f9df1ffcf2 ("FROMGIT: scsi: ufs: Fix a deadlock in the error handler") has been applied. This patch increases the UFS queue depth from 30 to 31. For the original patch, see also https://android-review.googlesource.com/q/I6273114ae8cc6c2a74c72f7bc090eb0319ec5772 Bug: 220258338 Test: $ adb shell cat /sys/devices/platform/*/host0/scsi_host/host0/can_queue Test: 31 Test: $ fio --bs=4096 --group_reporting=1 --gtod_reduce=1 --invalidate=1 --ioengine=io_uring --ioscheduler=none --norandommap --runtime=30 --rw=randread --thread --time_based=1 --numjobs=1 --iodepth=64 --iodepth_batch_submit=32 --iodepth_batch_complete=32 --name=/dev/block/sda --filename=/dev/block/sda Test: IOPS=28.6K (with a debug kernel) Change-Id: Ie6afb17fde2f688967e84c50161b4526bb7845e7 Signed-off-by: Bart Van Assche (cherry picked from commit 30180ef431768893926a5a8973c357b55ad228f5) --- drivers/scsi/hosts.c | 10 ++++------ drivers/scsi/scsi_lib.c | 4 ---- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c index 6d5a8c5835e1..d664c4650b2d 100644 --- a/drivers/scsi/hosts.c +++ b/drivers/scsi/hosts.c @@ -220,6 +220,10 @@ int scsi_add_host_with_dma(struct Scsi_Host *shost, struct device *dev, goto fail; } + /* Use min_t(int, ...) in case shost->can_queue exceeds SHRT_MAX */ + shost->cmd_per_lun = min_t(int, shost->cmd_per_lun, + shost->can_queue); + error = scsi_init_sense_cache(shost); if (error) goto fail; @@ -228,12 +232,6 @@ int scsi_add_host_with_dma(struct Scsi_Host *shost, struct device *dev, if (error) goto fail; - shost->can_queue = shost->tag_set.queue_depth; - - /* Use min_t(int, ...) in case shost->can_queue exceeds SHRT_MAX */ - shost->cmd_per_lun = min_t(int, shost->cmd_per_lun, - shost->can_queue); - if (!shost->shost_gendev.parent) shost->shost_gendev.parent = dev ? dev : &platform_bus; if (!dma_dev) diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 3dfdc7daa664..6f3d29d16d1f 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -1907,10 +1907,6 @@ int scsi_mq_setup_tags(struct Scsi_Host *shost) tag_set->ops = &scsi_mq_ops_no_commit; tag_set->nr_hw_queues = shost->nr_hw_queues ? : 1; tag_set->queue_depth = shost->can_queue; - if (shost->hostt->name && strcmp(shost->hostt->name, "ufshcd") == 0) { - tag_set->queue_depth--; - tag_set->reserved_tags++; - } tag_set->cmd_size = cmd_size; tag_set->numa_node = NUMA_NO_NODE; tag_set->flags = BLK_MQ_F_SHOULD_MERGE;