Commit 127fd07d authored by Ziqi Chen's avatar Ziqi Chen Committed by Martin K. Petersen
Browse files

scsi: ufs: core: Print trs for pending requests in MCQ mode



We don't have outstanding_reqs bitmap in MCQ mode. Considering that the
queue depth may increase beyond 64 in the future, rework ufshcd_print_trs()
to get rid of bitmap usage so that we can print trs for pending requests in
both SDB and MCQ mode.

Signed-off-by: default avatarZiqi Chen <quic_ziqichen@quicinc.com>
Link: https://lore.kernel.org/r/1678865517-43139-1-git-send-email-quic_ziqichen@quicinc.com


Reviewed-by: default avatarBart Van Assche <bvanassche@acm.org>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent cb38845d
Loading
Loading
Loading
Loading
+57 −39
Original line number Diff line number Diff line
@@ -533,13 +533,11 @@ static void ufshcd_print_evt_hist(struct ufs_hba *hba)
}

static
void ufshcd_print_trs(struct ufs_hba *hba, unsigned long bitmap, bool pr_prdt)
void ufshcd_print_tr(struct ufs_hba *hba, int tag, bool pr_prdt)
{
	const struct ufshcd_lrb *lrbp;
	int prdt_length;
	int tag;

	for_each_set_bit(tag, &bitmap, hba->nutrs) {
	lrbp = &hba->lrb[tag];

	dev_err(hba->dev, "UPIU[%d] - issue time %lld us\n",
@@ -575,6 +573,26 @@ void ufshcd_print_trs(struct ufs_hba *hba, unsigned long bitmap, bool pr_prdt)
		ufshcd_hex_dump("UPIU PRDT: ", lrbp->ucd_prdt_ptr,
			ufshcd_sg_entry_size(hba) * prdt_length);
}

static bool ufshcd_print_tr_iter(struct request *req, void *priv)
{
	struct scsi_device *sdev = req->q->queuedata;
	struct Scsi_Host *shost = sdev->host;
	struct ufs_hba *hba = shost_priv(shost);

	ufshcd_print_tr(hba, req->tag, *(bool *)priv);

	return true;
}

/**
 * ufshcd_print_trs_all - print trs for all started requests.
 * @hba: per-adapter instance.
 * @pr_prdt: need to print prdt or not.
 */
static void ufshcd_print_trs_all(struct ufs_hba *hba, bool pr_prdt)
{
	blk_mq_tagset_busy_iter(&hba->host->tag_set, ufshcd_print_tr_iter, &pr_prdt);
}

static void ufshcd_print_tmrs(struct ufs_hba *hba, unsigned long bitmap)
@@ -5331,7 +5349,7 @@ ufshcd_transfer_rsp_status(struct ufs_hba *hba, struct ufshcd_lrb *lrbp,

	if ((host_byte(result) != DID_OK) &&
	    (host_byte(result) != DID_REQUEUE) && !hba->silence_err_logs)
		ufshcd_print_trs(hba, 1 << lrbp->task_tag, true);
		ufshcd_print_tr(hba, lrbp->task_tag, true);
	return result;
}

@@ -6415,7 +6433,7 @@ static void ufshcd_err_handler(struct work_struct *work)
		ufshcd_print_pwr_info(hba);
		ufshcd_print_evt_hist(hba);
		ufshcd_print_tmrs(hba, hba->outstanding_tasks);
		ufshcd_print_trs(hba, hba->outstanding_reqs, pr_prdt);
		ufshcd_print_trs_all(hba, pr_prdt);
		spin_lock_irqsave(hba->host->host_lock, flags);
	}

@@ -7444,9 +7462,9 @@ static int ufshcd_abort(struct scsi_cmnd *cmd)
		ufshcd_print_evt_hist(hba);
		ufshcd_print_host_state(hba);
		ufshcd_print_pwr_info(hba);
		ufshcd_print_trs(hba, 1 << tag, true);
		ufshcd_print_tr(hba, tag, true);
	} else {
		ufshcd_print_trs(hba, 1 << tag, false);
		ufshcd_print_tr(hba, tag, false);
	}
	hba->req_abort_count++;