From patchwork Thu Aug 6 05:06:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Can Guo X-Patchwork-Id: 11702753 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 36A68181C for ; Thu, 6 Aug 2020 11:04:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2EF2622D0B for ; Thu, 6 Aug 2020 11:04:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728190AbgHFFHA (ORCPT ); Thu, 6 Aug 2020 01:07:00 -0400 Received: from labrats.qualcomm.com ([199.106.110.90]:12667 "EHLO labrats.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726093AbgHFFGz (ORCPT ); Thu, 6 Aug 2020 01:06:55 -0400 IronPort-SDR: FAHgbgPTKvcWaV0e9NEWR7VXQzVazHk1wI+oTO1hCLsVT6om4718CchCPILPS6PmgS/9mN65Fd KeXNo15l8soOZ33btb55yHifA9FeBE/rOrIO7GXcaxFoVn9cJl0anIF0+G/uLy30l65QsxId7q regwKovhjCfT8lm35vO2hpp2lxFrhB+Jxv1SaxPlagQJDYHwh4i0SGngW6nz5VQCQYkuD8JSrj BJCiv2ruC+mmijeauBHawETV3N+lEMz3Aub0ByellHFKcRRE3UagLYeniGrQxuN0rHIZcF0+WL Ig8= X-IronPort-AV: E=Sophos;i="5.75,440,1589266800"; d="scan'208";a="29068259" Received: from unknown (HELO ironmsg02-sd.qualcomm.com) ([10.53.140.142]) by labrats.qualcomm.com with ESMTP; 05 Aug 2020 22:06:53 -0700 Received: from stor-presley.qualcomm.com ([192.168.140.85]) by ironmsg02-sd.qualcomm.com with ESMTP; 05 Aug 2020 22:06:51 -0700 Received: by stor-presley.qualcomm.com (Postfix, from userid 359480) id C257B21562; Wed, 5 Aug 2020 22:06:51 -0700 (PDT) From: Can Guo To: asutoshd@codeaurora.org, nguyenb@codeaurora.org, hongwus@codeaurora.org, rnayak@codeaurora.org, linux-scsi@vger.kernel.org, kernel-team@android.com, saravanak@google.com, salyzyn@google.com, cang@codeaurora.org Cc: Alim Akhtar , Avri Altman , "James E.J. Bottomley" , "Martin K. Petersen" , Stanley Chu , Bean Huo , Bart Van Assche , linux-kernel@vger.kernel.org (open list) Subject: [PATCH 7/9] scsi: ufs: Move dumps in IRQ handler to error handler Date: Wed, 5 Aug 2020 22:06:18 -0700 Message-Id: <1596690383-16438-8-git-send-email-cang@codeaurora.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1596690383-16438-1-git-send-email-cang@codeaurora.org> References: <1596690383-16438-1-git-send-email-cang@codeaurora.org> Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Sometime dumps in IRQ handler are heavy enough to cause system stability issues, move them to error handler and only print basic host regs here. Signed-off-by: Can Guo Reviewed-by: Bean Huo diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index 6a10003..a79fbbd 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -5696,6 +5696,19 @@ static void ufshcd_err_handler(struct work_struct *work) UFSHCD_UIC_DL_TCx_REPLAY_ERROR)))) needs_reset = true; + if (hba->saved_err & (INT_FATAL_ERRORS | UIC_ERROR | + UFSHCD_UIC_HIBERN8_MASK)) { + bool pr_prdt = !!(hba->saved_err & SYSTEM_BUS_FATAL_ERROR); + + spin_unlock_irqrestore(hba->host->host_lock, flags); + ufshcd_print_host_state(hba); + ufshcd_print_pwr_info(hba); + ufshcd_print_host_regs(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 host reset is required then skip clearing the pending * transfers forcefully because they will get cleared during @@ -5915,18 +5928,12 @@ static irqreturn_t ufshcd_check_errors(struct ufs_hba *hba) /* 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_dump_regs(hba, 0, UFSHCI_REG_SPACE_SIZE, + "host_regs: "); ufshcd_print_pwr_info(hba); - ufshcd_print_tmrs(hba, hba->outstanding_tasks); - ufshcd_print_trs(hba, hba->outstanding_reqs, - pr_prdt); } ufshcd_schedule_eh_work(hba); retval |= IRQ_HANDLED;