Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp1826936pxb; Wed, 2 Feb 2022 13:26:53 -0800 (PST) X-Google-Smtp-Source: ABdhPJyWN+gd3rqubyZbJwqy1Kb9myeaPw49TejuoG+S0bndPEH/WI0n1qajhOe+IfC3XokGIZNY X-Received: by 2002:aa7:8b13:: with SMTP id f19mr31237750pfd.62.1643837213600; Wed, 02 Feb 2022 13:26:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643837213; cv=none; d=google.com; s=arc-20160816; b=OZFja942tUVaWX1mFqPDquAKvyvCtazwtFeFVolKu39jZiKd+PTsgUfB04OBDwiXet 1w2tmS+i4DrTzUJxL81KlLDHY+5SfsFM04vUusZvyWNmufedJx8X+bExl5O8C6pVl/sC IgrQ8VX3AFtFwjN2OSLHe1bCBCLQz67DiTInDEtHQZeACPVFNFoVJRCo1+CstmKxzVmW twxjeZjmGn6rKVvraEctgC0mUOJPqCM3oGdMDv6KIwl/NER0Xcy+FoTomxrQhTuBhhSY /YSzbjiVCRyp5YoQaNMcTG/BvTeognN5Ww9UV9jpjRdqTmnZ5exh6OMjT2SS3CzAZX2Y HWQA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:organization :from:references:cc:to:subject:dkim-signature; bh=A7FBsizuhhyTmvDJjJR4Fp+B6ccwGgtbqXcKV5YPGlM=; b=bWzuDrV7k2+XKsglePH+7fJ8+Ll/8tmgtmWNfown+WSZ8clx7+Cr1mAOrAK0CNWxR1 dOIEmQUeU5aW5HOyB4Rsne0cktLuCIV/mMfHLVFNJVTty1JBYawWquPriE1roGMPihxY 7K6xGEwoDh/JFRsRvjUJ5oMJwR4BLPy27TmMuWfoFu94ljjaT/qJnOALYUGGvbclrIaS hjReyfOstRt3+e0XXSYx+XbE4w1LTC2iGbYxoxSqA6xhx4Tv1XJjlM/UDx4pYy/cQ9Pj gazq8QRMgLouHyCL+o2REJRWNJDsP4l4gWNScjvDNdZDtgmBa2k0o97B8Q/4Ur4RTAxR vo+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=l4jziWWy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c15si3749984plo.117.2022.02.02.13.26.41; Wed, 02 Feb 2022 13:26:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=l4jziWWy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238981AbiBAN7y (ORCPT + 99 others); Tue, 1 Feb 2022 08:59:54 -0500 Received: from mga17.intel.com ([192.55.52.151]:14988 "EHLO mga17.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238944AbiBAN7x (ORCPT ); Tue, 1 Feb 2022 08:59:53 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1643723993; x=1675259993; h=subject:to:cc:references:from:message-id:date: mime-version:in-reply-to:content-transfer-encoding; bh=lOH1XfKZ3/HZZy0a2x4qqcf+ZDoW+Ouz7bP0BLy5q9s=; b=l4jziWWyxaE0IyQqN4w+7mTOl5KaYpRqG0LQQ3nKX20nGgSbFhPJYKbL khVOA2MAKeFQm5fPVdRfde/IISbzNJhhc+FLNrywZ5paMa3OhS7VSGy+W jstDqBpFv/xo3pK+O6+WWA3VRnM+fNuJuXu5nVj8DMn3DJO+DdpdNtlR9 YYxYUUexoBnSUCV8F3HmIuwb+y+mcRl6+m2EUtBz156r+PngSLt1/2eul J2tEMDRIsx3P63inBoaahgEU+VKUUap1giH7G2JGaNAQSCAus1WVmCmLd I1SVZCb420z+Ajt7medgLrAJJi9Pt1myTp+Yidm7gDWQy6ty9wjky3yiw Q==; X-IronPort-AV: E=McAfee;i="6200,9189,10244"; a="228352499" X-IronPort-AV: E=Sophos;i="5.88,334,1635231600"; d="scan'208";a="228352499" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Feb 2022 05:59:53 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.88,334,1635231600"; d="scan'208";a="523057009" Received: from ahunter-desktop.fi.intel.com (HELO [10.237.72.92]) ([10.237.72.92]) by orsmga007.jf.intel.com with ESMTP; 01 Feb 2022 05:59:48 -0800 Subject: Re: [PATCH V3 2/4] mmc: debugfs: Add debug fs entry for mmc driver To: "Sajida Bhanu (Temp) (QUIC)" , "Asutosh Das (QUIC)" , "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)" , "Pradeep Pragallapati (QUIC)" , "sartgarg@codeaurora.org" , "nitirawa@codeaurora.org" , "sayalil@codeaurora.org" , Liangliang Lu , "Bao D . Nguyen" References: <1642699582-14785-1-git-send-email-quic_c_sbhanu@quicinc.com> <1642699582-14785-3-git-send-email-quic_c_sbhanu@quicinc.com> <0886f705-562f-6c8d-f396-60c2244b6375@intel.com> From: Adrian Hunter Organization: Intel Finland Oy, Registered Address: PL 281, 00181 Helsinki, Business Identity Code: 0357606 - 4, Domiciled in Helsinki Message-ID: Date: Tue, 1 Feb 2022 15:59:47 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Firefox/78.0 Thunderbird/78.14.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > Sent: Friday, January 21, 2022 12:40 PM > To: Sajida Bhanu (Temp) (QUIC) ; Asutosh Das (QUIC) ; 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) ; Pradeep Pragallapati (QUIC) ; sartgarg@codeaurora.org; nitirawa@codeaurora.org; sayalil@codeaurora.org; Liangliang Lu ; Bao D . Nguyen > 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 >> Signed-off-by: Liangliang Lu >> Signed-off-by: Sayali Lokhande >> Signed-off-by: Bao D. Nguyen >> --- >> 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); >> >