Received: by 2002:a25:ca44:0:0:0:0:0 with SMTP id a65csp567777ybg; Tue, 28 Jul 2020 13:01:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzjmDQebx6dksqWtkW1sJnXCnHX4LCrmMTpfCud5vR4BEGxcmLk8yeTUrvNvLET/3NzO3Sr X-Received: by 2002:a17:906:c1c3:: with SMTP id bw3mr19274414ejb.8.1595966514789; Tue, 28 Jul 2020 13:01:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595966514; cv=none; d=google.com; s=arc-20160816; b=DZmKdNwpv0xcTJp+Tncy9wUNvgYYC0i3lAesO5x4KbwE/mPkDhOW12/nJFjC6qxeCS CZtRARt11ziYrbwmD9AvuMDh7B6SkgeqUgnWxXiZcK7qp2EnsQ6bFPDA5wGidV7Tpivo EkKUbZOHAnDDFHBdRL3KdMT7YcSeQyC3WteNhY9JbmG3nKGZwt0r7P/QnfBTh9SxStLa A7PLJtska7pj0mWGiINV2WyOJPcIY0ju/9wHghYkHh48LtMMUR6hR1HhB3OeLqyiu1rX wwnJSB2Yds9j7jk2BDKnIu+hnkUFxIiC3+aSQT3ENH9B39ggyia0uh3caF42emtdeEYe +e3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dmarc-filter :dkim-signature; bh=GEtDnRclLMMSGwFlOv36azGgB3IYarTZkST0DQ+XtC0=; b=BQLEX1yiLdQ0TYk1YmTfHTOFnlzj46klJS6WaCe7M+VDzaY09j6MrI624pQYC2kJzt rnNKub7DFuVb4AhBWUOQpvE9raDh8+UCmjBDYRHWw+IxtHYrqWMwCkXBTPpsjMr/FgvM CruXKU9ts8Lb5e0qucvc+TUa6uA268F7s3pRbFG6E5/ZxcAZK4DaRz3vKJcp3SP9Z0i9 vVt+4oT1wWliAbaaPBSeYD6Ez7J7DIBjae3XBx1GMu+C2eSvJ639WBo1vLu/zQkvLJlF pL04f4SQn/3uCQUkzrDyEZYA/CflG0SQCpEACXjEWynMWNj6bzABXkXP4skexruhogbp mzug== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mg.codeaurora.org header.s=smtp header.b=l0u6JT1w; 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 d10si8057994ejw.210.2020.07.28.13.01.32; Tue, 28 Jul 2020 13:01:54 -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=l0u6JT1w; 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 S1732114AbgG1SCA (ORCPT + 99 others); Tue, 28 Jul 2020 14:02:00 -0400 Received: from mail29.static.mailgun.info ([104.130.122.29]:21552 "EHLO mail29.static.mailgun.info" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728490AbgG1SB7 (ORCPT ); Tue, 28 Jul 2020 14:01:59 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1595959318; h=Content-Transfer-Encoding: Content-Type: In-Reply-To: MIME-Version: Date: Message-ID: From: References: Cc: To: Subject: Sender; bh=GEtDnRclLMMSGwFlOv36azGgB3IYarTZkST0DQ+XtC0=; b=l0u6JT1wmTck5Sw3DcQn84G/m7MzaFpHzRya7vPcBV5z/qQxeaF1JCmrFqTq77iUQdcXdMYm 16VmWZf7y5KCVY4fBv/YPs4478lMlUKzwkUeYAeAqBykl1yN62y16TeIVPTz39oxDFB/aL/c IhBskop88gnBc8UROgXdqBQDzRE= 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-n08.prod.us-west-2.postgun.com with SMTP id 5f20680749176bd3822fbef2 (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Tue, 28 Jul 2020 18:01:43 GMT Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 5523DC4339C; Tue, 28 Jul 2020 18:01:43 +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.8 required=2.0 tests=ALL_TRUSTED,NICE_REPLY_A, SPF_NONE,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from [192.168.8.168] (cpe-70-95-149-85.san.res.rr.com [70.95.149.85]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: asutoshd) by smtp.codeaurora.org (Postfix) with ESMTPSA id 40495C433C6; Tue, 28 Jul 2020 18:01:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 40495C433C6 Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=none smtp.mailfrom=asutoshd@codeaurora.org Subject: Re: [PATCH v7 4/8] scsi: ufs: Add some debug infos to ufshcd_print_host_state To: Can Guo , 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 Cc: Alim Akhtar , Avri Altman , "James E.J. Bottomley" , "Martin K. Petersen" , Stanley Chu , Bean Huo , Bart Van Assche , Satya Tangirala , open list References: <1595912460-8860-1-git-send-email-cang@codeaurora.org> <1595912460-8860-5-git-send-email-cang@codeaurora.org> From: "Asutosh Das (asd)" Message-ID: Date: Tue, 28 Jul 2020 11:01:40 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <1595912460-8860-5-git-send-email-cang@codeaurora.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 7/27/2020 10:00 PM, 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 Reviewed-by: Asutosh Das > --- > 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; > > -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, Linux Foundation Collaborative Project