Commit 2ef23e4b authored by Martin K. Petersen's avatar Martin K. Petersen
Browse files

Merge patch series "ufs: Do not requeue while ungating the clock"

Bart Van Assche <bvanassche@acm.org> says:

In the traces we recorded while testing zoned storage we noticed that UFS
commands are requeued while the clock is being ungated. Command requeueing
makes it harder than necessary to preserve the command order. Hence this
patch series that modifies the SCSI core and also the UFS driver such that
clock ungating does not trigger command requeueing.

Link: https://lore.kernel.org/r/20230529202640.11883-1-bvanassche@acm.org


Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parents 0e5e41ee 078f4f4b
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -441,6 +441,7 @@ struct Scsi_Host *scsi_host_alloc(const struct scsi_host_template *sht, int priv
	shost->cmd_per_lun = sht->cmd_per_lun;
	shost->no_write_same = sht->no_write_same;
	shost->host_tagset = sht->host_tagset;
	shost->queuecommand_may_block = sht->queuecommand_may_block;

	if (shost_eh_deadline == -1 || !sht->eh_host_reset_handler)
		shost->eh_deadline = -1;
+16 −11
Original line number Diff line number Diff line
@@ -1984,6 +1984,8 @@ int scsi_mq_setup_tags(struct Scsi_Host *shost)
	tag_set->flags = BLK_MQ_F_SHOULD_MERGE;
	tag_set->flags |=
		BLK_ALLOC_POLICY_TO_MQ_FLAG(shost->hostt->tag_alloc_policy);
	if (shost->queuecommand_may_block)
		tag_set->flags |= BLK_MQ_F_BLOCKING;
	tag_set->driver_data = shost;
	if (shost->host_tagset)
		tag_set->flags |= BLK_MQ_F_TAG_HCTX_SHARED;
@@ -2943,11 +2945,20 @@ scsi_target_unblock(struct device *dev, enum scsi_device_state new_state)
}
EXPORT_SYMBOL_GPL(scsi_target_unblock);

/**
 * scsi_host_block - Try to transition all logical units to the SDEV_BLOCK state
 * @shost: device to block
 *
 * Pause SCSI command processing for all logical units associated with the SCSI
 * host and wait until pending scsi_queue_rq() calls have finished.
 *
 * Returns zero if successful or a negative error code upon failure.
 */
int
scsi_host_block(struct Scsi_Host *shost)
{
	struct scsi_device *sdev;
	int ret = 0;
	int ret;

	/*
	 * Call scsi_internal_device_block_nowait so we can avoid
@@ -2959,20 +2970,14 @@ scsi_host_block(struct Scsi_Host *shost)
		mutex_unlock(&sdev->state_mutex);
		if (ret) {
			scsi_device_put(sdev);
			break;
			return ret;
		}
	}

	/*
	 * SCSI never enables blk-mq's BLK_MQ_F_BLOCKING flag so
	 * calling synchronize_rcu() once is enough.
	 */
	WARN_ON_ONCE(shost->tag_set.flags & BLK_MQ_F_BLOCKING);

	if (!ret)
		synchronize_rcu();
	/* Wait for ongoing scsi_queue_rq() calls to finish. */
	blk_mq_wait_quiesce_done(&shost->tag_set);

	return ret;
	return 0;
}
EXPORT_SYMBOL_GPL(scsi_host_block);

+1 −1
Original line number Diff line number Diff line
@@ -168,7 +168,7 @@ static ssize_t auto_hibern8_show(struct device *dev,
	}

	pm_runtime_get_sync(hba->dev);
	ufshcd_hold(hba, false);
	ufshcd_hold(hba);
	ahit = ufshcd_readl(hba, REG_AUTO_HIBERNATE_IDLE_TIMER);
	ufshcd_release(hba);
	pm_runtime_put_sync(hba->dev);
+1 −1
Original line number Diff line number Diff line
@@ -24,7 +24,7 @@ static int ufshcd_program_key(struct ufs_hba *hba,
	u32 slot_offset = hba->crypto_cfg_register + slot * sizeof(*cfg);
	int err = 0;

	ufshcd_hold(hba, false);
	ufshcd_hold(hba);

	if (hba->vops && hba->vops->program_key) {
		err = hba->vops->program_key(hba, cfg, slot);
+0 −3
Original line number Diff line number Diff line
@@ -84,9 +84,6 @@ unsigned long ufshcd_mcq_poll_cqe_lock(struct ufs_hba *hba,
int ufshcd_read_string_desc(struct ufs_hba *hba, u8 desc_index,
			    u8 **buf, bool ascii);

int ufshcd_hold(struct ufs_hba *hba, bool async);
void ufshcd_release(struct ufs_hba *hba);

int ufshcd_send_uic_cmd(struct ufs_hba *hba, struct uic_command *uic_cmd);

int ufshcd_exec_raw_upiu_cmd(struct ufs_hba *hba,
Loading