From patchwork Sun Aug 9 12:15:53 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Can Guo X-Patchwork-Id: 11706689 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 1E1681392 for ; Sun, 9 Aug 2020 12:20:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0EC89206D8 for ; Sun, 9 Aug 2020 12:20:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726426AbgHIMQo (ORCPT ); Sun, 9 Aug 2020 08:16:44 -0400 Received: from labrats.qualcomm.com ([199.106.110.90]:28989 "EHLO labrats.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726335AbgHIMQk (ORCPT ); Sun, 9 Aug 2020 08:16:40 -0400 IronPort-SDR: Lm1UeYQPCvuG1NTvN13LOM0YExeKKeb8sdRg6irHFkvpsB1B7lWeuYwZqytohvd2Bism7rDX4N jYI/Iju5guCvpxrFj7WdbzXEXGY19H8mX0z+J3LzpA3nP2E6woOJcf7SOvpk0H0PE/IuFfcYXP 4aksfmpCqpmgQpVMPjnRm3MAjUDHPWuf90nCmGLET1Tj//t6xg4XemDYodhqxDb8saMftX+ELL cJ8JhqZsKqhJDS9u/OP/Imr2YT8RfrqMF273D80ZoSKiQ7VRpZcLkXdhL5MoWq6QA8PjgYIDE9 QLA= X-IronPort-AV: E=Sophos;i="5.75,453,1589266800"; d="scan'208";a="29073794" Received: from unknown (HELO ironmsg03-sd.qualcomm.com) ([10.53.140.143]) by labrats.qualcomm.com with ESMTP; 09 Aug 2020 05:16:30 -0700 Received: from stor-presley.qualcomm.com ([192.168.140.85]) by ironmsg03-sd.qualcomm.com with ESMTP; 09 Aug 2020 05:16:29 -0700 Received: by stor-presley.qualcomm.com (Postfix, from userid 359480) id A2D722156E; Sun, 9 Aug 2020 05:16:29 -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: Sun, 9 Aug 2020 05:15:53 -0700 Message-Id: <1596975355-39813-8-git-send-email-cang@codeaurora.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1596975355-39813-1-git-send-email-cang@codeaurora.org> References: <1596975355-39813-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 Reviewed-by: Asutosh Das diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index ed24582..602c746 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;