Received: by 2002:a25:ca44:0:0:0:0:0 with SMTP id a65csp22055ybg; Mon, 27 Jul 2020 22:05:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxb+NJ37owqquQJW/8CxN93JpR3xbvNgGr8AwkdsRtNw0/9k8nJa+tELV7tQEBEAfs+T5wm X-Received: by 2002:a05:6402:31b5:: with SMTP id dj21mr4169705edb.154.1595912726555; Mon, 27 Jul 2020 22:05:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595912726; cv=none; d=google.com; s=arc-20160816; b=oYtMrPSU5/US+bLKiiIJ/zOHaGvcVX+eqZUE4+0IEV7YKeQdRZPyhUz/pm4Clv8f8C MYUQ4ljXeVJvRg214rlmsI1s06S1bmCpPnTewnHFqQkbPf1hPqNpKaxSpIDLJoYhRt5f bZN/FOXOynipsjR2todMhAFCUxc/wykSNG4OeT/8/by+ZlcCsfxKY1Jib0eHfIVqW5rj Ha11CyBif18RQ4xIbVqb9hKTwBE0RGy8EsS74sG0BxHkU2GtXgyaHTq4BYzKHQKBHg4x lEWF2bJh+y6GginVBMvJBYts5PL8vPQwYNMXdn8upSWWimlWu5JAyaZcVK9RQwf0mOSi UoyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:ironport-sdr; bh=k7EoZyH4phDgzvomaJoaai8HLFzqP/XcvcSMA32IQsk=; b=firSiAEPXOq3+PNiAU07tL5VEpOS95oJ7hStKz401zwxSuMIDC4oEHG7i7C1jL/t0/ uIlOLV4XdsHaPhDwyA+2jTJaQzA501n6dGhdryFdZzTSS/XkkswM5K6IlUdUMzyPQqrj qp9/fd/jbTKctKGmX8K0FovnbBlkwOVk+meRHOMEBURuaWjGTHqbjQIFoWSn8Bl9/Gna 8pHa4g42CPHUODi/p14UfLrvE/Vq5ZZ8qR0L55/Ir0emh7INWFVZltCaWfCgLyEFs2Zy MeQY68oolo/owvqw8tSYfYlbIwF5QsyF/B6Sd5wmSqTwZvP2RtrRr4c//lhRiD/lAIW5 TVEg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l2si6242608edf.34.2020.07.27.22.05.04; Mon, 27 Jul 2020 22:05:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727044AbgG1FCa (ORCPT + 99 others); Tue, 28 Jul 2020 01:02:30 -0400 Received: from labrats.qualcomm.com ([199.106.110.90]:7761 "EHLO labrats.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726868AbgG1FCA (ORCPT ); Tue, 28 Jul 2020 01:02:00 -0400 IronPort-SDR: OWZfybUmKjy0cSZXWmi2bpzVpiCpcvchrFUPX/2G4t6Gu0nggJ3TBItb9Cm2UuYMSm2EkOR/Fr Qd8u7PDspB6HvYZq2gPwOjt/OrS+bjQHjURoafcZiV9vx9r5M+2CbIjsGYLoApJlNla3P4zeHT woqu3fP6BVnf0i9HUK+INWFQE1NworLcSGYzd7ge8NnJi4bnnNvKcV0eGUPDTrCBpBjvXyxb65 SPzzvUgKKnh+rOb8Zum/kCjMs/hBaVFxjQFg4bx9mV2TnCNnsWloGg9waHKhrM2hvG2bxrqTel QPY= X-IronPort-AV: E=Sophos;i="5.75,405,1589266800"; d="scan'208";a="29056442" Received: from unknown (HELO ironmsg01-sd.qualcomm.com) ([10.53.140.141]) by labrats.qualcomm.com with ESMTP; 27 Jul 2020 22:01:14 -0700 Received: from pacamara-linux.qualcomm.com ([192.168.140.135]) by ironmsg01-sd.qualcomm.com with ESMTP; 27 Jul 2020 22:01:14 -0700 Received: by pacamara-linux.qualcomm.com (Postfix, from userid 359480) id 7B8B822DA6; Mon, 27 Jul 2020 22:01:14 -0700 (PDT) From: Can Guo To: asutoshd@codeaurora.org, nguyenb@codeaurora.org, hongwus@codeaurora.org, rnayak@codeaurora.org, sh425.lee@samsung.com, 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 , Satya Tangirala , linux-kernel@vger.kernel.org (open list) Subject: [PATCH v7 4/8] scsi: ufs: Add some debug infos to ufshcd_print_host_state Date: Mon, 27 Jul 2020 22:00:55 -0700 Message-Id: <1595912460-8860-5-git-send-email-cang@codeaurora.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1595912460-8860-1-git-send-email-cang@codeaurora.org> References: <1595912460-8860-1-git-send-email-cang@codeaurora.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The infos of the last interrupt status and its timestamp are very helpful when debug system stability issues, e.g. IRQ starvation, so add them to ufshcd_print_host_state. Meanwhile, UFS device infos like model name and its FW version also come in handy during debug. In addition, this change makes cleanup to some prints in ufshcd_print_host_regs as similar prints are already available in ufshcd_print_host_state. Signed-off-by: Can Guo Reviewed-by: Avri Altman --- drivers/scsi/ufs/ufshcd.c | 31 ++++++++++++++++++------------- drivers/scsi/ufs/ufshcd.h | 5 +++++ 2 files changed, 23 insertions(+), 13 deletions(-) diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index 99bd3e4..eda4dc6 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -411,15 +411,6 @@ static void ufshcd_print_err_hist(struct ufs_hba *hba, static void ufshcd_print_host_regs(struct ufs_hba *hba) { ufshcd_dump_regs(hba, 0, UFSHCI_REG_SPACE_SIZE, "host_regs: "); - dev_err(hba->dev, "hba->ufs_version = 0x%x, hba->capabilities = 0x%x\n", - hba->ufs_version, hba->capabilities); - dev_err(hba->dev, - "hba->outstanding_reqs = 0x%x, hba->outstanding_tasks = 0x%x\n", - (u32)hba->outstanding_reqs, (u32)hba->outstanding_tasks); - dev_err(hba->dev, - "last_hibern8_exit_tstamp at %lld us, hibern8_exit_cnt = %d\n", - ktime_to_us(hba->ufs_stats.last_hibern8_exit_tstamp), - hba->ufs_stats.hibern8_exit_cnt); ufshcd_print_err_hist(hba, &hba->ufs_stats.pa_err, "pa_err"); ufshcd_print_err_hist(hba, &hba->ufs_stats.dl_err, "dl_err"); @@ -438,8 +429,6 @@ static void ufshcd_print_host_regs(struct ufs_hba *hba) ufshcd_print_err_hist(hba, &hba->ufs_stats.host_reset, "host_reset"); ufshcd_print_err_hist(hba, &hba->ufs_stats.task_abort, "task_abort"); - ufshcd_print_clk_freqs(hba); - ufshcd_vops_dbg_register_dump(hba); } @@ -499,6 +488,8 @@ static void ufshcd_print_tmrs(struct ufs_hba *hba, unsigned long bitmap) static void ufshcd_print_host_state(struct ufs_hba *hba) { + struct scsi_device *sdev_ufs = hba->sdev_ufs_device; + dev_err(hba->dev, "UFS Host state=%d\n", hba->ufshcd_state); dev_err(hba->dev, "outstanding reqs=0x%lx tasks=0x%lx\n", hba->outstanding_reqs, hba->outstanding_tasks); @@ -511,12 +502,24 @@ static void ufshcd_print_host_state(struct ufs_hba *hba) dev_err(hba->dev, "Auto BKOPS=%d, Host self-block=%d\n", hba->auto_bkops_enabled, hba->host->host_self_blocked); dev_err(hba->dev, "Clk gate=%d\n", hba->clk_gating.state); + dev_err(hba->dev, + "last_hibern8_exit_tstamp at %lld us, hibern8_exit_cnt=%d\n", + ktime_to_us(hba->ufs_stats.last_hibern8_exit_tstamp), + hba->ufs_stats.hibern8_exit_cnt); + dev_err(hba->dev, "last intr at %lld us, last intr status=0x%x\n", + ktime_to_us(hba->ufs_stats.last_intr_ts), + hba->ufs_stats.last_intr_status); dev_err(hba->dev, "error handling flags=0x%x, req. abort count=%d\n", hba->eh_flags, hba->req_abort_count); - dev_err(hba->dev, "Host capabilities=0x%x, caps=0x%x\n", - hba->capabilities, hba->caps); + dev_err(hba->dev, "hba->ufs_version=0x%x, Host capabilities=0x%x, caps=0x%x\n", + hba->ufs_version, hba->capabilities, hba->caps); dev_err(hba->dev, "quirks=0x%x, dev. quirks=0x%x\n", hba->quirks, hba->dev_quirks); + if (sdev_ufs) + dev_err(hba->dev, "UFS dev info: %.8s %.16s rev %.4s\n", + sdev_ufs->vendor, sdev_ufs->model, sdev_ufs->rev); + + ufshcd_print_clk_freqs(hba); } /** @@ -5951,6 +5954,8 @@ static irqreturn_t ufshcd_intr(int irq, void *__hba) spin_lock(hba->host->host_lock); intr_status = ufshcd_readl(hba, REG_INTERRUPT_STATUS); + hba->ufs_stats.last_intr_status = intr_status; + hba->ufs_stats.last_intr_ts = ktime_get(); /* * There could be max of hba->nutrs reqs in flight and in worst case diff --git a/drivers/scsi/ufs/ufshcd.h b/drivers/scsi/ufs/ufshcd.h index 656c069..5b2cdaf 100644 --- a/drivers/scsi/ufs/ufshcd.h +++ b/drivers/scsi/ufs/ufshcd.h @@ -406,6 +406,8 @@ struct ufs_err_reg_hist { /** * struct ufs_stats - keeps usage/err statistics + * @last_intr_status: record the last interrupt status. + * @last_intr_ts: record the last interrupt timestamp. * @hibern8_exit_cnt: Counter to keep track of number of exits, * reset this after link-startup. * @last_hibern8_exit_tstamp: Set time after the hibern8 exit. @@ -425,6 +427,9 @@ struct ufs_err_reg_hist { * @tsk_abort: tracks task abort events */ struct ufs_stats { + u32 last_intr_status; + ktime_t last_intr_ts; + u32 hibern8_exit_cnt; ktime_t last_hibern8_exit_tstamp; -- Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.