[RAMEN9610-14574] [COMMON] scsi: ufs: Dump SFR move to ISR.
authorJaeHun Jung <jh0801.jung@samsung.com>
Tue, 23 Apr 2019 05:54:40 +0000 (14:54 +0900)
committerYoungmin Nam <youngmin.nam@samsung.com>
Tue, 21 May 2019 10:45:21 +0000 (19:45 +0900)
This is can make "Synchronous External Abort"
by SFR access race condition between ISR and workqueue.

Revert "[EKTROIKA-189][Troika][COMMON] scsi: ufs: Move SFR dump to workqueue from ISR."

=====================================================================
<3>[   21.625697] [pid:57,cpu0,in irq]Synchronous External Abort: synchronous external abort (0x96000210) at 0xffffff800b05d040
<0>[   21.625720] [pid:57,cpu0,in irq]Internal error: : 96000210 [#1] PREEMPT SMP
<4>[   21.625733] [pid:57,cpu0,in irq]Modules linked in:
<0>[   21.625767] [pid:57,cpu0,in irq]debug-snapshot: core register saved(CPU:0)
<2>[   21.625778] [pid:3963,cpu6,storaged]Bad mode in Error handler detected on CPU6, code 0xbf000002 -- SError
<0>[   21.625784] [pid:57,cpu0,in irq]L2ECTLR_EL1: 0000000000000007
<0>[   21.625803] [pid:57,cpu0,in irq]L2ECTLR_EL1 valid_bit(30) is NOT set (0x0)
<0>[   21.625818] [pid:57,cpu0,in irq]CPUMERRSR: 0000000008040321, L2MERRSR: 0000000012000000
<0>[   21.625833] [pid:57,cpu0,in irq]CPUMERRSR valid_bit(31) is NOT set (0x0)
<0>[   21.625847] [pid:57,cpu0,in irq]L2MERRSR valid_bit(31) is NOT set (0x0)
<0>[   21.625861] [pid:57,cpu0,in irq]debug-snapshot: context saved(CPU:0)
<6>[   21.625907] [pid:57,cpu0,in irq]debug-snapshot: item - log_kevents is disabled
<6>[   21.625918] [pid:57,cpu0,in irq]TIF_FOREIGN_FPSTATE: 0, FP/SIMD depth 0, cpu: 0
<4>[   21.625931] [pid:57,cpu0,in irq]CPU: 0 PID: 57 Comm: kworker/0:1 Tainted: G S              4.14.56-gb8dc9cd #1
<4>[   21.625938] [pid:57,cpu0,in irq]Hardware name: kane (DT)
<4>[   21.625955] [pid:57,cpu0,in irq]Workqueue: events ufshcd_err_handler
<4>[   21.625969] [pid:57,cpu0,in irq]task: ffffffc876beb680 task.stack: ffffff800b5e8000
<4>[   21.625982] [pid:57,cpu0,in irq]PC is at ufshcd_intr+0x19c/0x34c
<4>[   21.625991] [pid:57,cpu0,in irq]LR is at ufshcd_intr+0x120/0x34c
=====================================================================

This reverts commit c63c2451c3ecb705e7a23b361e8ca8d7e8a0b5e4.

Change-Id: I5baa3cb1a28271f0ee5f3ef4b3894a431fe4fdaa
Signed-off-by: JaeHun Jung <jh0801.jung@samsung.com>
drivers/scsi/ufs/ufshcd.c

index efb11b5fb852be6dfc1db24d39700f89990f4231..c2e1940e3f34b7fe609d1f4846a8dac37b7c2c93 100644 (file)
@@ -5459,21 +5459,6 @@ static void ufshcd_err_handler(struct work_struct *work)
        if (gpio_is_valid(info->ufs_reset_n_gpio))
                dev_info(hba->dev, "%s: RESET_N: 0x%08x\n", __func__, gpio_get_value(info->ufs_reset_n_gpio));
 
-       /* dump controller state before resetting */
-       if (hba->saved_err & (INT_FATAL_ERRORS | UIC_ERROR)) {
-               bool pr_prdt = !!(hba->saved_err &
-                               SYSTEM_BUS_FATAL_ERROR);
-
-               dev_err(hba->dev, "%s: saved_err 0x%x saved_uic_err 0x%x\n",
-                               __func__, hba->saved_err,
-                               hba->saved_uic_err);
-
-               ufshcd_print_host_regs(hba);
-               ufshcd_print_pwr_info(hba);
-               ufshcd_print_tmrs(hba, hba->outstanding_tasks);
-               ufshcd_print_trs(hba, hba->outstanding_reqs, pr_prdt);
-       }
-
        spin_lock_irqsave(hba->host->host_lock, flags);
        if (hba->ufshcd_state == UFSHCD_STATE_RESET)
                goto out;
@@ -5707,6 +5692,21 @@ static void ufshcd_check_errors(struct ufs_hba *hba)
 
                        hba->ufshcd_state = UFSHCD_STATE_EH_SCHEDULED;
 
+                       /* dump controller state before resetting */
+                       if (hba->saved_err & (INT_FATAL_ERRORS | UIC_ERROR)) {
+                               bool pr_prdt = !!(hba->saved_err &
+                                               SYSTEM_BUS_FATAL_ERROR);
+
+                               dev_err(hba->dev, "%s: saved_err 0x%x saved_uic_err 0x%x\n",
+                                       __func__, hba->saved_err,
+                                       hba->saved_uic_err);
+
+                               ufshcd_print_host_regs(hba);
+                               ufshcd_print_pwr_info(hba);
+                               ufshcd_print_tmrs(hba, hba->outstanding_tasks);
+                               ufshcd_print_trs(hba, hba->outstanding_reqs,
+                                                       pr_prdt);
+                       }
                        schedule_work(&hba->eh_work);
                }
        }