Skip to content

Commit d0b2b70

Browse files
bvanasschemartinkpetersen
authored andcommitted
scsi: ufs: core: Increase the usable queue depth
With the current implementation of the UFS driver active_queues is 1 instead of 0 if all UFS request queues are idle. That causes hctx_may_queue() to divide the queue depth by 2 when queueing a request and hence reduces the usable queue depth. The shared tag set code in the block layer keeps track of the number of active request queues. blk_mq_tag_busy() is called before a request is queued onto a hwq and blk_mq_tag_idle() is called some time after the hwq became idle. blk_mq_tag_idle() is called from inside blk_mq_timeout_work(). Hence, blk_mq_tag_idle() is only called if a timer is associated with each request that is submitted to a request queue that shares a tag set with another request queue. Adds a blk_mq_start_request() call in ufshcd_exec_dev_cmd(). This doubles the queue depth on my test setup from 16 to 32. In addition to increasing the usable queue depth, also fix the documentation of the 'timeout' parameter in the header above ufshcd_exec_dev_cmd(). Link: https://lore.kernel.org/r/[email protected] Fixes: 7252a36 ("scsi: ufs: Avoid busy-waiting by eliminating tag conflicts") Cc: Can Guo <[email protected]> Cc: Alim Akhtar <[email protected]> Cc: Avri Altman <[email protected]> Cc: Stanley Chu <[email protected]> Cc: Bean Huo <[email protected]> Cc: Adrian Hunter <[email protected]> Reviewed-by: Can Guo <[email protected]> Signed-off-by: Bart Van Assche <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent 56f3961 commit d0b2b70

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

drivers/scsi/ufs/ufshcd.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2842,7 +2842,7 @@ static int ufshcd_wait_for_dev_cmd(struct ufs_hba *hba,
28422842
* ufshcd_exec_dev_cmd - API for sending device management requests
28432843
* @hba: UFS hba
28442844
* @cmd_type: specifies the type (NOP, Query...)
2845-
* @timeout: time in seconds
2845+
* @timeout: timeout in milliseconds
28462846
*
28472847
* NOTE: Since there is only one available tag for device management commands,
28482848
* it is expected you hold the hba->dev_cmd.lock mutex.
@@ -2872,6 +2872,9 @@ static int ufshcd_exec_dev_cmd(struct ufs_hba *hba,
28722872
}
28732873
tag = req->tag;
28742874
WARN_ON_ONCE(!ufshcd_valid_tag(hba, tag));
2875+
/* Set the timeout such that the SCSI error handler is not activated. */
2876+
req->timeout = msecs_to_jiffies(2 * timeout);
2877+
blk_mq_start_request(req);
28752878

28762879
init_completion(&wait);
28772880
lrbp = &hba->lrb[tag];

0 commit comments

Comments
 (0)