Skip to content

Commit 39b14c2

Browse files
bvanasschekawasaki
authored andcommitted
ufs: core: Inform the block layer about write ordering
From the UFSHCI 4.0 specification, about the MCQ mode: "Command Submission 1. Host SW writes an Entry to SQ 2. Host SW updates SQ doorbell tail pointer Command Processing 3. After fetching the Entry, Host Controller updates SQ doorbell head pointer 4. Host controller sends COMMAND UPIU to UFS device" In other words, in MCQ mode, UFS controllers are required to forward commands to the UFS device in the order these commands have been received from the host. This patch improves performance as follows on a test setup with UFSHCI 4.0 controller: - When not using an I/O scheduler: 2.3x more IOPS for small writes. - With the mq-deadline scheduler: 2.0x more IOPS for small writes. Reviewed-by: Avri Altman <[email protected]> Cc: Bao D. Nguyen <[email protected]> Cc: Can Guo <[email protected]> Cc: Martin K. Petersen <[email protected]> Signed-off-by: Bart Van Assche <[email protected]>
1 parent 78ba850 commit 39b14c2

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

drivers/ufs/core/ufshcd.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5324,6 +5324,13 @@ static int ufshcd_sdev_configure(struct scsi_device *sdev,
53245324
struct ufs_hba *hba = shost_priv(sdev->host);
53255325
struct request_queue *q = sdev->request_queue;
53265326

5327+
/*
5328+
* The write order is preserved per MCQ. Without MCQ, auto-hibernation
5329+
* may cause write reordering that results in unaligned write errors.
5330+
*/
5331+
if (hba->mcq_enabled)
5332+
lim->features |= BLK_FEAT_ORDERED_HWQ;
5333+
53275334
lim->dma_pad_mask = PRDT_DATA_BYTE_COUNT_PAD - 1;
53285335

53295336
/*

0 commit comments

Comments
 (0)