On Thu, 2 Dec 2021 at 08:28, Adrian Hunter <adrian.hunter@xxxxxxxxx> wrote: > > On 02/12/2021 08:42, Sajida Bhanu (Temp) (QUIC) wrote: > > Gentle Reminder. > > > > Thanks, > > Sajida > > -----Original Message----- > > From: Sajida Bhanu (Temp) (QUIC) <quic_c_sbhanu@xxxxxxxxxxx> > > Sent: Friday, November 26, 2021 10:54 AM > > To: Ulf Hansson <ulf.hansson@xxxxxxxxxx>; Sajida Bhanu (Temp) (QUIC) <quic_c_sbhanu@xxxxxxxxxxx> > > Cc: adrian.hunter@xxxxxxxxx; riteshh@xxxxxxxxxxxxxx; Asutosh Das (asd) <asutoshd@xxxxxxxxxxx>; agross@xxxxxxxxxx; bjorn.andersson@xxxxxxxxxx; linux-mmc@xxxxxxxxxxxxxxx; linux-arm-msm@xxxxxxxxxxxxxxx; linux-kernel@xxxxxxxxxxxxxxx; stummala@xxxxxxxxxxxxxx; vbadigan@xxxxxxxxxxxxxx; Ram Prakash Gupta (QUIC) <quic_rampraka@xxxxxxxxxxx>; Pradeep Pragallapati (QUIC) <quic_pragalla@xxxxxxxxxxx>; sartgarg@xxxxxxxxxxxxxx; nitirawa@xxxxxxxxxxxxxx; sayalil@xxxxxxxxxxxxxx > > Subject: RE: [PATCH V1] mmc: sdhci-msm: Add eMMC and SD card err_stat sysfs entry > > > > > > > > -----Original Message----- > > From: Ulf Hansson <ulf.hansson@xxxxxxxxxx> > > Sent: Thursday, November 25, 2021 5:01 PM > > To: Sajida Bhanu (Temp) (QUIC) <quic_c_sbhanu@xxxxxxxxxxx> > > Cc: adrian.hunter@xxxxxxxxx; riteshh@xxxxxxxxxxxxxx; Asutosh Das (asd) <asutoshd@xxxxxxxxxxx>; agross@xxxxxxxxxx; bjorn.andersson@xxxxxxxxxx; linux-mmc@xxxxxxxxxxxxxxx; linux-arm-msm@xxxxxxxxxxxxxxx; linux-kernel@xxxxxxxxxxxxxxx; stummala@xxxxxxxxxxxxxx; vbadigan@xxxxxxxxxxxxxx; Ram Prakash Gupta (QUIC) <quic_rampraka@xxxxxxxxxxx>; Pradeep Pragallapati (QUIC) <quic_pragalla@xxxxxxxxxxx>; sartgarg@xxxxxxxxxxxxxx; nitirawa@xxxxxxxxxxxxxx; sayalil@xxxxxxxxxxxxxx > > Subject: Re: [PATCH V1] mmc: sdhci-msm: Add eMMC and SD card err_stat sysfs entry > > > > On Wed, 17 Nov 2021 at 07:20, Shaik Sajida Bhanu <quic_c_sbhanu@xxxxxxxxxxx> wrote: > >> > >> Add sysfs entry to query eMMC and SD card errors statistics. > >> This feature is useful for debug and testing. > >> > >> Signed-off-by: Shaik Sajida Bhanu <quic_c_sbhanu@xxxxxxxxxxx> > >> --- > >> drivers/mmc/host/cqhci.h | 1 + > >> drivers/mmc/host/sdhci-msm.c | 192 +++++++++++++++++++++++++++++++++++++++++++ > >> drivers/mmc/host/sdhci.c | 17 ++++ > >> drivers/mmc/host/sdhci.h | 1 + > >> include/linux/mmc/host.h | 1 + > >> 5 files changed, 212 insertions(+) > > > > To allow an easier review, I strongly suggest splitting up the changes in smaller pieces. Maybe in three steps: add interfaces, implement them, add sysfs - or something along those lines. > > > > I am also trying to understand the benefit of having these stats available. Can you perhaps share a little bit of background on how they are usable for you? Is it for debug purpose or does it have other purposes too? > > > > If it turns out that we agree on finding these stats valuable for us, then I am inclined to think that this should be integrated closer with the mmc core. > > > > The error codes that are propagated to the core from failed requests are common error codes, so we should be able to use that information from the core itself, I think. > > > > Kind regards > > Uffe > > > > Hi Ulf, > > > > Thanks for the review > > > > I am also trying to understand the benefit of having these stats available. Can you perhaps share a little bit of background on how they are usable for you? Is it for debug purpose or does it have other purposes too? > > > >>>>>>>>>>>>> These changes for debug purpose only .. if any errors occurred while testing eMMC and SD card those will be captured in these sysfs entries , we can directly go and check the sysfs entries and get to know what is the error occurred in driver level. > > I would suggest using debugfs and adding support in mmc host debugfs > e.g. > > static inline void mmc_debugfs_err_stats_enable(struct mmc_host *mmc) > { > mmc->err_stats_enabled = true; > } > > enum mmc_err_stat { > MMC_ERR_CMD_TIMEOUT, > MMC_ERR_CMD_CRC, > MMC_ERR_DAT_TIMEOUT, > MMC_ERR_DAT_CRC, > MMC_ERR_AUTO_CMD, > MMC_ERR_ADMA, > MMC_ERR_TUNING, > MMC_ERR_CMDQ_RED, > MMC_ERR_CMDQ_GCE, > MMC_ERR_CMDQ_ICCE, > MMC_ERR_REQ_TIMEOUT, > MMC_ERR_CMDQ_REQ_TIMEOUT, > MMC_ERR_ICE_CFG, > MMC_ERR_MAX, > }; > > static inline void mmc_debugfs_err_stats_inc(struct mmc_host *mmc, enum mmc_err_stat stat) > { > mmc->err_stats[stat] += 1; > } > > And amend mmc_add_host_debugfs() to create the err_stats file etc. > > sdhci.c could call mmc_debugfs_err_stats_enable() and mmc_debugfs_err_stats_inc() as needed. > cqhci.c could call mmc_debugfs_err_stats_inc() as needed. > > Ulf, does that sound reasonable? Yes, it does! Thanks for having a closer look! [...] Kind regards Uffe