Skip to content

Commit 530ccae

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 26de477 commit 530ccae

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

drivers/ufs/core/ufshcd.c

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

5284+
/*
5285+
* The write order is preserved per MCQ. Without MCQ, auto-hibernation
5286+
* may cause write reordering that results in unaligned write errors.
5287+
*/
5288+
if (hba->mcq_enabled)
5289+
lim->features |= BLK_FEAT_ORDERED_HWQ;
5290+
52845291
lim->dma_pad_mask = PRDT_DATA_BYTE_COUNT_PAD - 1;
52855292

52865293
/*

0 commit comments

Comments
 (0)