Received: by 2002:a25:ca44:0:0:0:0:0 with SMTP id a65csp37089ybg; Mon, 27 Jul 2020 22:37:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxLgefetWaZCRgBkZlHDNHycyczYj3C7ABJcmJFFMjGsPtbqV6SI96h1004KSBYoaF5o3DZ X-Received: by 2002:a17:906:1751:: with SMTP id d17mr23430318eje.140.1595914660700; Mon, 27 Jul 2020 22:37:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595914660; cv=none; d=google.com; s=arc-20160816; b=ZtQlahmkl5TdgL6tdbHaQeE9kAd11FS+N2Qpomkecu85orfWTXHagt2S65obCnphFC tgZMJa8W3sqwKQaC4+l16ehvL2SpUrZZokqqEqey8MalaM3hQ4LBq0Hbrta3YoR/RyCX 2DL3AgL0S+glGfR3+o3DM7L5KYn7PJzPSfBvhj1o/pf1Wh6QT1xneEfxLtkrMb8y3iWs IXql2hsdqQVumf62nn4iBzBvUl/Lxg5m3pCzQHRKGRVGkeqU0HgG0XJyi0nV1xSvZ4/O GSI0kUqtcdO3fK3SPB2ZfJ0GBFzQ2TYzK7DyCHisGZzmwQxDBE+ziZQCHHCWsq32Xgk3 0g2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:message-id:references :in-reply-to:subject:cc:to:from:date:content-transfer-encoding :mime-version:dkim-signature; bh=lymWLJxYr7t7/cGd4UgmusHXnyuA797Hs5zPZ3Avdps=; b=BCDtuY4G53TYK074R9vnqVYgA+kcIIdl+vrGiSBBQ9UI4TYjjBSO15ZkYpF2AkuHyB Br4/Gq6FPFgzRi99E+WdouaX5tpPz7uDB2TtB96GOxjgzoaf38MZHlM8TOG4/rfZDApn oV0sLfcqV5HYUe1Gt95cjYEcZzfKSBMClISOd5QrEASx9JPIgGNBaItq+vhavSr0PCLv rPKi2CRbTpxd1m57n9/rDCFsT/gCTKd4ndX1j8WMYv6srBkTt2JyKhGFHRXPXiLXLCUD DQD+BXf0d4e0Z2zMEqw1lfbzuPiEuYh189RXvIwgn0jJ4swDV640ZM489NUA9b+uYss5 yHOw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mg.codeaurora.org header.s=smtp header.b=WseGvual; 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 e7si8465553ejm.369.2020.07.27.22.37.18; Mon, 27 Jul 2020 22:37:40 -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; dkim=fail header.i=@mg.codeaurora.org header.s=smtp header.b=WseGvual; 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 S1726299AbgG1Fd2 (ORCPT + 99 others); Tue, 28 Jul 2020 01:33:28 -0400 Received: from mail29.static.mailgun.info ([104.130.122.29]:49386 "EHLO mail29.static.mailgun.info" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726581AbgG1Fd1 (ORCPT ); Tue, 28 Jul 2020 01:33:27 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1595914407; h=Message-ID: References: In-Reply-To: Subject: Cc: To: From: Date: Content-Transfer-Encoding: Content-Type: MIME-Version: Sender; bh=lymWLJxYr7t7/cGd4UgmusHXnyuA797Hs5zPZ3Avdps=; b=WseGvuallTVSwJsvpgIxXyuEB2qyEh1B/2c4m/cRuP9jsLrFdaC6ACGA+2mJU+poIpfyPjTF gBVJmvvvS9e34RK4CQm33XFH5ToO0dI91I9fBH63hOFXfCMuAwP/0g2yZ2NOtJqYajb/xA0x ii5J1xT5lz7T9Gyps/opT0Vipfw= X-Mailgun-Sending-Ip: 104.130.122.29 X-Mailgun-Sid: WyI0MWYwYSIsICJsaW51eC1rZXJuZWxAdmdlci5rZXJuZWwub3JnIiwgImJlOWU0YSJd Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n13.prod.us-west-2.postgun.com with SMTP id 5f1fb878845c4d05a36db68f (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Tue, 28 Jul 2020 05:32:40 GMT Received: by smtp.codeaurora.org (Postfix, from userid 1001) id B813CC43391; Tue, 28 Jul 2020 05:32:40 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=2.0 tests=ALL_TRUSTED,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.codeaurora.org (localhost.localdomain [127.0.0.1]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: hongwus) by smtp.codeaurora.org (Postfix) with ESMTPSA id 5F723C433C6; Tue, 28 Jul 2020 05:32:39 +0000 (UTC) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Tue, 28 Jul 2020 13:32:39 +0800 From: hongwus@codeaurora.org To: Can Guo Cc: asutoshd@codeaurora.org, nguyenb@codeaurora.org, rnayak@codeaurora.org, sh425.lee@samsung.com, linux-scsi@vger.kernel.org, kernel-team@android.com, saravanak@google.com, salyzyn@google.com, 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, linux-scsi-owner@vger.kernel.org Subject: Re: [PATCH v7 4/8] scsi: ufs: Add some debug infos to ufshcd_print_host_state In-Reply-To: <1595912460-8860-5-git-send-email-cang@codeaurora.org> References: <1595912460-8860-1-git-send-email-cang@codeaurora.org> <1595912460-8860-5-git-send-email-cang@codeaurora.org> Message-ID: <444570ffdd0f34dcf83f7fe49593e601@codeaurora.org> X-Sender: hongwus@codeaurora.org User-Agent: Roundcube Webmail/1.3.9 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2020-07-28 13:00, Can Guo wrote: > 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; Reviewed-by: Hongwu Su