public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Adrian Hunter <adrian.hunter@intel.com>
To: "Sajida Bhanu (Temp) (QUIC)" <quic_c_sbhanu@quicinc.com>,
	"Asutosh Das (QUIC)" <quic_asutoshd@quicinc.com>,
	"ulf.hansson@linaro.org" <ulf.hansson@linaro.org>,
	"agross@kernel.org" <agross@kernel.org>,
	"bjorn.andersson@linaro.org" <bjorn.andersson@linaro.org>,
	"linux-mmc@vger.kernel.org" <linux-mmc@vger.kernel.org>,
	"linux-arm-msm@vger.kernel.org" <linux-arm-msm@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Cc: "stummala@codeaurora.org" <stummala@codeaurora.org>,
	"vbadigan@codeaurora.org" <vbadigan@codeaurora.org>,
	"Ram Prakash Gupta (QUIC)" <quic_rampraka@quicinc.com>,
	"Pradeep Pragallapati (QUIC)" <quic_pragalla@quicinc.com>,
	"sartgarg@codeaurora.org" <sartgarg@codeaurora.org>,
	"nitirawa@codeaurora.org" <nitirawa@codeaurora.org>,
	"sayalil@codeaurora.org" <sayalil@codeaurora.org>,
	Liangliang Lu <luliang@codeaurora.org>,
	"Bao D . Nguyen" <nguyenb@codeaurora.org>
Subject: Re: [PATCH V3 2/4] mmc: debugfs: Add debug fs entry for mmc driver
Date: Tue, 1 Feb 2022 15:59:47 +0200	[thread overview]
Message-ID: <dfac146e-bce6-574f-4760-c0d35b046a9f@intel.com> (raw)
In-Reply-To: <SJ0PR02MB84494706E4515CFBEDB55898CD5F9@SJ0PR02MB8449.namprd02.prod.outlook.com>

On 25/01/2022 20:19, Sajida Bhanu (Temp) (QUIC) wrote:
> Hi,
> 
> Thanks for the review.
> 
> Please find the inline comments.
> 
> Thanks,
> Sajida
> 
> -----Original Message-----
> From: Adrian Hunter <adrian.hunter@intel.com> 
> Sent: Friday, January 21, 2022 12:40 PM
> To: Sajida Bhanu (Temp) (QUIC) <quic_c_sbhanu@quicinc.com>; Asutosh Das (QUIC) <quic_asutoshd@quicinc.com>; ulf.hansson@linaro.org; agross@kernel.org; bjorn.andersson@linaro.org; linux-mmc@vger.kernel.org; linux-arm-msm@vger.kernel.org; linux-kernel@vger.kernel.org
> Cc: stummala@codeaurora.org; vbadigan@codeaurora.org; Ram Prakash Gupta (QUIC) <quic_rampraka@quicinc.com>; Pradeep Pragallapati (QUIC) <quic_pragalla@quicinc.com>; sartgarg@codeaurora.org; nitirawa@codeaurora.org; sayalil@codeaurora.org; Liangliang Lu <luliang@codeaurora.org>; Bao D . Nguyen <nguyenb@codeaurora.org>
> Subject: Re: [PATCH V3 2/4] mmc: debugfs: Add debug fs entry for mmc driver
> 
> On 20/01/2022 19:26, Shaik Sajida Bhanu wrote:
>> Add debug fs entry to query eMMC and SD card errors statistics
>>
>> Signed-off-by: Shaik Sajida Bhanu <quic_c_sbhanu@quicinc.com>
>> Signed-off-by: Liangliang Lu <luliang@codeaurora.org>
>> Signed-off-by: Sayali Lokhande <sayalil@codeaurora.org>
>> Signed-off-by: Bao D. Nguyen <nguyenb@codeaurora.org>
>> ---
>>  drivers/mmc/core/debugfs.c | 81 
>> ++++++++++++++++++++++++++++++++++++++++++++++
>>  1 file changed, 81 insertions(+)
>>
>> diff --git a/drivers/mmc/core/debugfs.c b/drivers/mmc/core/debugfs.c 
>> index 3fdbc80..f4cb594 100644
>> --- a/drivers/mmc/core/debugfs.c
>> +++ b/drivers/mmc/core/debugfs.c
>> @@ -223,6 +223,82 @@ static int mmc_clock_opt_set(void *data, u64 val)  
>> DEFINE_DEBUGFS_ATTRIBUTE(mmc_clock_fops, mmc_clock_opt_get, mmc_clock_opt_set,
>>  	"%llu\n");
>>  
>> +static int mmc_err_state_get(void *data, u64 *val) {
>> +	struct mmc_host *host = data;
>> +
>> +	if (!host)
>> +		return -EINVAL;
>> +
>> +	*val = host->err_state ? 1 : 0;
>> +
>> +	return 0;
>> +}
>> +
>> +DEFINE_SIMPLE_ATTRIBUTE(mmc_err_state, mmc_err_state_get, NULL, 
>> +"%llu\n");
>> +
>> +static int mmc_err_stats_show(struct seq_file *file, void *data) {
>> +	struct mmc_host *host = (struct mmc_host *)file->private;
>> +	const char *desc[MMC_ERR_MAX] = {
>> +		[MMC_ERR_CMD_TIMEOUT] = "Command Timeout Occurred",
>> +		[MMC_ERR_CMD_CRC] = "Command CRC Errors Occurred",
>> +		[MMC_ERR_DAT_TIMEOUT] = "Data Timeout Occurred",
>> +		[MMC_ERR_DAT_CRC] = "Data CRC Errors Occurred",
>> +		[MMC_ERR_AUTO_CMD] = "Auto-Cmd Error Occurred",
>> +		[MMC_ERR_ADMA] = "ADMA Error Occurred",
>> +		[MMC_ERR_TUNING] = "Tuning Error Occurred",
>> +		[MMC_ERR_CMDQ_RED] = "CMDQ RED Errors",
>> +		[MMC_ERR_CMDQ_GCE] = "CMDQ GCE Errors",
>> +		[MMC_ERR_CMDQ_ICCE] = "CMDQ ICCE Errors",
>> +		[MMC_ERR_REQ_TIMEOUT] = "Request Timedout",
>> +		[MMC_ERR_CMDQ_REQ_TIMEOUT] = "CMDQ Request Timedout",
>> +		[MMC_ERR_ICE_CFG] = "ICE Config Errors",
>> +	};
>> +	int i;
>> +
>> +	if (!host)
>> +		return -EINVAL;
>> +
>> +	if (!host->err_stats_enabled) {
>> +		seq_printf(file, "Not supported by driver\n");
>> +		return 0;
>> +	}
>> +
>> +	for (i = 0; i < MMC_ERR_MAX; i++) {
>> +		if (desc[i])
>> +			seq_printf(file, "# %s:\t %d\n",
>> +					desc[i], host->err_stats[i]);
>> +	}
>> +
>> +	return 0;
>> +}
>> +
>> +static int mmc_err_stats_open(struct inode *inode, struct file *file) 
>> +{
>> +	return single_open(file, mmc_err_stats_show, inode->i_private); }
>> +
>> +static ssize_t mmc_err_stats_write(struct file *filp, const char __user *ubuf,
>> +				   size_t cnt, loff_t *ppos)
>> +{
>> +	struct mmc_host *host = filp->f_mapping->host->i_private;
>> +
>> +	if (!host)
>> +		return -EINVAL;
>> +
>> +	pr_debug("%s: Resetting MMC error statistics\n", __func__);
>> +	memset(host->err_stats, 0, sizeof(host->err_stats));
>> +
>> +	return cnt;
>> +}
>> +
>> +static const struct file_operations mmc_err_stats_fops = {
>> +	.open	= mmc_err_stats_open,
>> +	.read	= seq_read,
>> +	.write	= mmc_err_stats_write,
>> +};
>> +
>>  void mmc_add_host_debugfs(struct mmc_host *host)  {
>>  	struct dentry *root;
>> @@ -236,6 +312,11 @@ void mmc_add_host_debugfs(struct mmc_host *host)
>>  	debugfs_create_file_unsafe("clock", S_IRUSR | S_IWUSR, root, host,
>>  				   &mmc_clock_fops);
>>  
>> +	debugfs_create_file("err_state", 0600, root, host,
>> +		&mmc_err_state);
> 
> Please, let's drop err_state for now
> 
>>>>>> first we can check this right,  if it is set then we can go and check err_stats[] to know more on type of error (data /cmd timeout or CRC errors etc.).
> Please let me know your opinion on this.( Same as patch set (V3 1/4).

Please see my comments for patch 1

> 
>> +	debugfs_create_file("err_stats", 0600, root, host,
>> +		&mmc_err_stats_fops);
>> +
>>  #ifdef CONFIG_FAIL_MMC_REQUEST
>>  	if (fail_request)
>>  		setup_fault_attr(&fail_default_attr, fail_request);
>>
> 


  reply	other threads:[~2022-02-01 13:59 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-20 17:26 [PATCH V3 0/4] mmc: add error statistics for eMMC and SD card Shaik Sajida Bhanu
2022-01-20 17:26 ` [PATCH V3 1/4] mmc: sdhci: Capture eMMC and SD card errors Shaik Sajida Bhanu
2022-01-21  7:08   ` Adrian Hunter
2022-01-25 18:17     ` Sajida Bhanu (Temp)
2022-02-01 13:58       ` Adrian Hunter
2022-02-08 19:04         ` Sajida Bhanu (Temp) (QUIC)
2022-02-11  5:51           ` Adrian Hunter
2022-02-15 12:28             ` Sajida Bhanu (Temp)
2022-02-15 16:59   ` Bjorn Andersson
2022-02-16  7:34     ` Sajida Bhanu (Temp) (QUIC)
2022-01-20 17:26 ` [PATCH V3 2/4] mmc: debugfs: Add debug fs entry for mmc driver Shaik Sajida Bhanu
2022-01-21  7:10   ` Adrian Hunter
2022-01-25 18:19     ` Sajida Bhanu (Temp) (QUIC)
2022-02-01 13:59       ` Adrian Hunter [this message]
2022-01-20 17:26 ` [PATCH V3 3/4] mmc: core: Capture eMMC and SD card errors Shaik Sajida Bhanu
2022-01-21  8:20   ` Adrian Hunter
2022-01-25 18:40     ` Sajida Bhanu (Temp) (QUIC)
2022-01-20 17:26 ` [PATCH V3 4/4] mmc: cqhci: " Shaik Sajida Bhanu
2022-01-21  8:22   ` Adrian Hunter
2022-01-25 18:41     ` Sajida Bhanu (Temp) (QUIC)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=dfac146e-bce6-574f-4760-c0d35b046a9f@intel.com \
    --to=adrian.hunter@intel.com \
    --cc=agross@kernel.org \
    --cc=bjorn.andersson@linaro.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=luliang@codeaurora.org \
    --cc=nguyenb@codeaurora.org \
    --cc=nitirawa@codeaurora.org \
    --cc=quic_asutoshd@quicinc.com \
    --cc=quic_c_sbhanu@quicinc.com \
    --cc=quic_pragalla@quicinc.com \
    --cc=quic_rampraka@quicinc.com \
    --cc=sartgarg@codeaurora.org \
    --cc=sayalil@codeaurora.org \
    --cc=stummala@codeaurora.org \
    --cc=ulf.hansson@linaro.org \
    --cc=vbadigan@codeaurora.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox