From patchwork Fri Jul 31 14:07:55 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Can Guo X-Patchwork-Id: 11695041 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 7375B913 for ; Fri, 31 Jul 2020 14:08:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6193E22D05 for ; Fri, 31 Jul 2020 14:08:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387533AbgGaOI1 (ORCPT ); Fri, 31 Jul 2020 10:08:27 -0400 Received: from labrats.qualcomm.com ([199.106.110.90]:12145 "EHLO labrats.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387526AbgGaOI1 (ORCPT ); Fri, 31 Jul 2020 10:08:27 -0400 IronPort-SDR: yNlKDWRRZ0qJ3kT/3Nnk4Y5plJSVwMrzrKlMnqfhCK2jWz++3Xjcu/56kJp5gFl0WxPaHPKAMZ f1JUy+AH7xGRs+gqSBpeaIdDxIugTzZddcN+54BS2uRF4qtfQSq2K2au/CwMv9FUdBBGp0rBJB fNjEXkQPsyqOFsucYwWWP7mYUp29Pfhghw9oP4O0VHMemYNqmzNfith526/bZOuINYoj7C7qq+ E4OeV7Vp6vuhJvB0rA4TcRnWVMjB0geTQ1UR8QsYN0ZVabPlrCtEq9QlldwYjB9rzqXNpX1HZb l40= X-IronPort-AV: E=Sophos;i="5.75,418,1589266800"; d="scan'208";a="47235774" Received: from unknown (HELO ironmsg-SD-alpha.qualcomm.com) ([10.53.140.30]) by labrats.qualcomm.com with ESMTP; 31 Jul 2020 07:08:27 -0700 Received: from pacamara-linux.qualcomm.com ([192.168.140.135]) by ironmsg-SD-alpha.qualcomm.com with ESMTP; 31 Jul 2020 07:08:26 -0700 Received: by pacamara-linux.qualcomm.com (Postfix, from userid 359480) id 2E10B22E5A; Fri, 31 Jul 2020 07:08:26 -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 , Tomas Winkler , linux-kernel@vger.kernel.org (open list) Subject: [PATCH 7/8] scsi: ufs: Move dumps in IRQ handler to error handler Date: Fri, 31 Jul 2020 07:07:55 -0700 Message-Id: <1596204478-5420-8-git-send-email-cang@codeaurora.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1596204478-5420-1-git-send-email-cang@codeaurora.org> References: <1596204478-5420-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 6bdf2bf..523b771 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;