From: Greg Kroah-Hartman Date: Thu, 18 Nov 2021 15:43:26 +0000 (+0100) Subject: 5.4-stable patches X-Git-Tag: v5.15.3~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f2266b716bb0869e85ff8b8ea129fdeff201c45b;p=thirdparty%2Fkernel%2Fstable-queue.git 5.4-stable patches added patches: scsi-ufs-fix-tm-request-when-non-fatal-error-happens.patch --- diff --git a/queue-5.4/scsi-ufs-fix-tm-request-when-non-fatal-error-happens.patch b/queue-5.4/scsi-ufs-fix-tm-request-when-non-fatal-error-happens.patch new file mode 100644 index 00000000000..4606c5ff691 --- /dev/null +++ b/queue-5.4/scsi-ufs-fix-tm-request-when-non-fatal-error-happens.patch @@ -0,0 +1,78 @@ +From eeb1b55b6e25c5f7265ff45cd050f3bc2cc423a4 Mon Sep 17 00:00:00 2001 +From: Jaegeuk Kim +Date: Thu, 7 Jan 2021 10:53:16 -0800 +Subject: scsi: ufs: Fix tm request when non-fatal error happens + +From: Jaegeuk Kim + +commit eeb1b55b6e25c5f7265ff45cd050f3bc2cc423a4 upstream. + +When non-fatal error like line-reset happens, ufshcd_err_handler() starts +to abort tasks by ufshcd_try_to_abort_task(). When it tries to issue a task +management request, we hit two warnings: + +WARNING: CPU: 7 PID: 7 at block/blk-core.c:630 blk_get_request+0x68/0x70 +WARNING: CPU: 4 PID: 157 at block/blk-mq-tag.c:82 blk_mq_get_tag+0x438/0x46c + +After fixing the above warnings we hit another tm_cmd timeout which may be +caused by unstable controller state: + +__ufshcd_issue_tm_cmd: task management cmd 0x80 timed-out + +Then, ufshcd_err_handler() enters full reset, and kernel gets stuck. It +turned out ufshcd_print_trs() printed too many messages on console which +requires CPU locks. Likewise hba->silence_err_logs, we need to avoid too +verbose messages. This is actually not an error case. + +Link: https://lore.kernel.org/r/20210107185316.788815-3-jaegeuk@kernel.org +Fixes: 69a6c269c097 ("scsi: ufs: Use blk_{get,put}_request() to allocate and free TMFs") +Reviewed-by: Can Guo +Signed-off-by: Jaegeuk Kim +Signed-off-by: Martin K. Petersen +[Zhai: remove an item of debug print not available in v5.4] +Signed-off-by: Orson Zhai +Signed-off-by: Greg Kroah-Hartman +--- + drivers/scsi/ufs/ufshcd.c | 17 ++++++++++++----- + 1 file changed, 12 insertions(+), 5 deletions(-) + +--- a/drivers/scsi/ufs/ufshcd.c ++++ b/drivers/scsi/ufs/ufshcd.c +@@ -4748,7 +4748,8 @@ ufshcd_transfer_rsp_status(struct ufs_hb + break; + } /* end of switch */ + +- if ((host_byte(result) != DID_OK) && !hba->silence_err_logs) ++ if ((host_byte(result) != DID_OK) && ++ (host_byte(result) != DID_REQUEUE) && !hba->silence_err_logs) + ufshcd_print_trs(hba, 1 << lrbp->task_tag, true); + return result; + } +@@ -5661,9 +5662,12 @@ static irqreturn_t ufshcd_intr(int irq, + intr_status = ufshcd_readl(hba, REG_INTERRUPT_STATUS); + } + +- if (enabled_intr_status && retval == IRQ_NONE) { +- dev_err(hba->dev, "%s: Unhandled interrupt 0x%08x\n", +- __func__, intr_status); ++ if (enabled_intr_status && retval == IRQ_NONE && ++ !ufshcd_eh_in_progress(hba)) { ++ dev_err(hba->dev, "%s: Unhandled interrupt 0x%08x (-, 0x%08x)\n", ++ __func__, ++ intr_status, ++ enabled_intr_status); + ufshcd_dump_regs(hba, 0, UFSHCI_REG_SPACE_SIZE, "host_regs: "); + } + +@@ -5705,7 +5709,10 @@ static int __ufshcd_issue_tm_cmd(struct + /* + * blk_get_request() is used here only to get a free tag. + */ +- req = blk_get_request(q, REQ_OP_DRV_OUT, BLK_MQ_REQ_RESERVED); ++ req = blk_get_request(q, REQ_OP_DRV_OUT, 0); ++ if (IS_ERR(req)) ++ return PTR_ERR(req); ++ + req->end_io_data = &wait; + ufshcd_hold(hba, false); + diff --git a/queue-5.4/series b/queue-5.4/series index 971cf00ed88..32436f2db1c 100644 --- a/queue-5.4/series +++ b/queue-5.4/series @@ -2,3 +2,4 @@ soc-tegra-pmc-fix-imbalanced-clock-disabling-in-error-code-path.patch scsi-ufs-fix-interrupt-error-message-for-shared-interrupts.patch mips-fix-assembly-error-from-mipsr2-code-used-within-mips_isa_arch_level.patch ext4-fix-lazy-initialization-next-schedule-time-computation-in-more-granular-unit.patch +scsi-ufs-fix-tm-request-when-non-fatal-error-happens.patch