2022-05-28 20:38:31

by Shaik Sajida Bhanu

[permalink] [raw]
Subject: [PATCH V8 0/5] mmc: add error statistics for eMMC and SD card

Changes since V7:
- Patch set V6 rebased on Ulf's(Ulf Hansson) master branch instead
of Ulf's (Ulf Hansson) next branch by mistake. So rebased patch
set on Ulf's next branch now as suggested by Adrain Hunter.

Changes since V6:
- Rebased on Ulf's(Ulf Hansson) next branch as suggested by
Adrain Hunter.
- Replaced debugfs_create_file() with debugfs_create_file_unsafe()
as suggested by Adrain Hunter.
- "[V6,5/5] mmc: cqhci: Capture eMMC and SD card errors" not
included in this Patch series as we don't have cqhci changes
on Ulf's(Ulf Hansson)next branch.

Changes since V5:
- Considered all error stats enums to set error state.
- Added missed tuning error related code changes which was
missed in patch set V5 as Adrain Hunter pointed.
- Replaced DEFINE_SIMPLE_ATTRIBUTE with DEFINE_DEBUGFS_ATTRIBUTE
as suggested by Adrain Hunter.

Changes since V4:
- Defined new macro to increment err_stats members when error occured
as suggested by Adrain Hunter.
- Called err_stats members increment function after printing the error
as suggested by Adrain Hunter.
- Considered INDEX and END_BIT errors same as CRC errors as suggested
by Adrain Hunter.
- Removed Null check for host in debug fs functions and Reordered
err_stats declarationas suggested by Adrain Hunter.
- Removed err_state variable stuff and updated err_state debug fs entry
based on the err_stats members state as suggested by Adrain Hunter.

Changes since V3:
- Dropped error stats feature flag as suggested by Adrain Hunter.
- Separated error state related changes in separate patches as
suggested by Adrain Hunter.
[PATCH V4 4/7] : error state debug fs
[PATCH V4 5/7] : error state enable function
[PATCH V4 6/7] : error state enable in error case
- Note: we are enabling error state before calling sdhci_dumpregs
we couldn't add the err state in error stats array as err state
is not error type.
- Corrected Signed-off-by order as suggested by Bjron Andersson.
- Moved error state enable code from sdhci_dumpregs to error
conditions as suggested by Adrain Hunter

Changes since V2:
- Removed userspace error stats clear debug fs entry as suggested
by Adrain Hunter.
- Split patch into 4 patches
[PATCH V3 1/4] : sdhci driver
[PATCH V3 2/4] : debug fs entries
[PATCH V3 3/4] : core driver
[PATCH V3 4/4] : cqhci driver
- Used for loop to print error messages instead of using printf
statements for all error messages as suggested by Adrain Hunter.
- Introduced one flag to enable error stats feature, if any other
client wants to use this feature, they need to enable that flag.
- Moved reset command timeout error statement to card init flow
as suggested by Adrain Hunter.

Changes since V1:
- Removed sysfs entry for eMMC and SD card error statistics and added
debugfs entry as suggested by Adrian Hunter and Ulf Hansson.

Shaik Sajida Bhanu (5):
mmc: core: Capture eMMC and SD card errors
mmc: sdhci: Capture eMMC and SD card errors
mmc: debugfs: Add debug fs entry for mmc driver
mmc: debugfs: Add debug fs error state entry for mmc driver
mmc: cqhci: Capture eMMC and SD card errors

drivers/mmc/core/core.c | 10 +++++-
drivers/mmc/core/debugfs.c | 79 +++++++++++++++++++++++++++++++++++++++++++
drivers/mmc/host/cqhci-core.c | 9 ++++-
drivers/mmc/host/sdhci.c | 59 ++++++++++++++++++++++++--------
drivers/mmc/host/sdhci.h | 3 ++
include/linux/mmc/host.h | 26 ++++++++++++++
include/linux/mmc/mmc.h | 6 ++++
7 files changed, 175 insertions(+), 17 deletions(-)

--
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member
of Code Aurora Forum, hosted by The Linux Foundation



2022-05-28 20:48:28

by Shaik Sajida Bhanu

[permalink] [raw]
Subject: [PATCH V8 5/5] mmc: cqhci: Capture eMMC and SD card errors

Add changes to capture eMMC and SD card errors.
This is useful for debug and testing.

Signed-off-by: Liangliang Lu <[email protected]>
Signed-off-by: Sayali Lokhande <[email protected]>
Signed-off-by: Bao D. Nguyen <[email protected]>
Signed-off-by: Ram Prakash Gupta <[email protected]>
Signed-off-by: Shaik Sajida Bhanu <[email protected]>
Acked-by: Adrian Hunter <[email protected]>
---
drivers/mmc/host/cqhci-core.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/mmc/host/cqhci-core.c b/drivers/mmc/host/cqhci-core.c
index b0d30c3..b3d7d6d 100644
--- a/drivers/mmc/host/cqhci-core.c
+++ b/drivers/mmc/host/cqhci-core.c
@@ -822,8 +822,15 @@ irqreturn_t cqhci_irq(struct mmc_host *mmc, u32 intmask, int cmd_error,
pr_debug("%s: cqhci: IRQ status: 0x%08x\n", mmc_hostname(mmc), status);

if ((status & (CQHCI_IS_RED | CQHCI_IS_GCE | CQHCI_IS_ICCE)) ||
- cmd_error || data_error)
+ cmd_error || data_error) {
+ if (status & CQHCI_IS_RED)
+ mmc_debugfs_err_stats_inc(mmc, MMC_ERR_CMDQ_RED);
+ if (status & CQHCI_IS_GCE)
+ mmc_debugfs_err_stats_inc(mmc, MMC_ERR_CMDQ_GCE);
+ if (status & CQHCI_IS_ICCE)
+ mmc_debugfs_err_stats_inc(mmc, MMC_ERR_CMDQ_ICCE);
cqhci_error_irq(mmc, status, cmd_error, data_error);
+ }

if (status & CQHCI_IS_TCC) {
/* read TCN and complete the request */
--
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member
of Code Aurora Forum, hosted by The Linux Foundation


2022-05-30 08:52:44

by Adrian Hunter

[permalink] [raw]
Subject: Re: [PATCH V8 0/5] mmc: add error statistics for eMMC and SD card

On 27/05/22 20:53, Shaik Sajida Bhanu wrote:
> Changes since V7:
> - Patch set V6 rebased on Ulf's(Ulf Hansson) master branch instead
> of Ulf's (Ulf Hansson) next branch by mistake. So rebased patch
> set on Ulf's next branch now as suggested by Adrain Hunter.
>

Looks good, thank you.

> Changes since V6:
> - Rebased on Ulf's(Ulf Hansson) next branch as suggested by
> Adrain Hunter.
> - Replaced debugfs_create_file() with debugfs_create_file_unsafe()
> as suggested by Adrain Hunter.
> - "[V6,5/5] mmc: cqhci: Capture eMMC and SD card errors" not
> included in this Patch series as we don't have cqhci changes
> on Ulf's(Ulf Hansson)next branch.
>
> Changes since V5:
> - Considered all error stats enums to set error state.
> - Added missed tuning error related code changes which was
> missed in patch set V5 as Adrain Hunter pointed.
> - Replaced DEFINE_SIMPLE_ATTRIBUTE with DEFINE_DEBUGFS_ATTRIBUTE
> as suggested by Adrain Hunter.
>
> Changes since V4:
> - Defined new macro to increment err_stats members when error occured
> as suggested by Adrain Hunter.
> - Called err_stats members increment function after printing the error
> as suggested by Adrain Hunter.
> - Considered INDEX and END_BIT errors same as CRC errors as suggested
> by Adrain Hunter.
> - Removed Null check for host in debug fs functions and Reordered
> err_stats declarationas suggested by Adrain Hunter.
> - Removed err_state variable stuff and updated err_state debug fs entry
> based on the err_stats members state as suggested by Adrain Hunter.
>
> Changes since V3:
> - Dropped error stats feature flag as suggested by Adrain Hunter.
> - Separated error state related changes in separate patches as
> suggested by Adrain Hunter.
> [PATCH V4 4/7] : error state debug fs
> [PATCH V4 5/7] : error state enable function
> [PATCH V4 6/7] : error state enable in error case
> - Note: we are enabling error state before calling sdhci_dumpregs
> we couldn't add the err state in error stats array as err state
> is not error type.
> - Corrected Signed-off-by order as suggested by Bjron Andersson.
> - Moved error state enable code from sdhci_dumpregs to error
> conditions as suggested by Adrain Hunter
>
> Changes since V2:
> - Removed userspace error stats clear debug fs entry as suggested
> by Adrain Hunter.
> - Split patch into 4 patches
> [PATCH V3 1/4] : sdhci driver
> [PATCH V3 2/4] : debug fs entries
> [PATCH V3 3/4] : core driver
> [PATCH V3 4/4] : cqhci driver
> - Used for loop to print error messages instead of using printf
> statements for all error messages as suggested by Adrain Hunter.
> - Introduced one flag to enable error stats feature, if any other
> client wants to use this feature, they need to enable that flag.
> - Moved reset command timeout error statement to card init flow
> as suggested by Adrain Hunter.
>
> Changes since V1:
> - Removed sysfs entry for eMMC and SD card error statistics and added
> debugfs entry as suggested by Adrian Hunter and Ulf Hansson.
>
> Shaik Sajida Bhanu (5):
> mmc: core: Capture eMMC and SD card errors
> mmc: sdhci: Capture eMMC and SD card errors
> mmc: debugfs: Add debug fs entry for mmc driver
> mmc: debugfs: Add debug fs error state entry for mmc driver
> mmc: cqhci: Capture eMMC and SD card errors
>
> drivers/mmc/core/core.c | 10 +++++-
> drivers/mmc/core/debugfs.c | 79 +++++++++++++++++++++++++++++++++++++++++++
> drivers/mmc/host/cqhci-core.c | 9 ++++-
> drivers/mmc/host/sdhci.c | 59 ++++++++++++++++++++++++--------
> drivers/mmc/host/sdhci.h | 3 ++
> include/linux/mmc/host.h | 26 ++++++++++++++
> include/linux/mmc/mmc.h | 6 ++++
> 7 files changed, 175 insertions(+), 17 deletions(-)
>


2022-06-01 18:57:18

by Ulf Hansson

[permalink] [raw]
Subject: Re: [PATCH V8 0/5] mmc: add error statistics for eMMC and SD card

On Fri, 27 May 2022 at 19:54, Shaik Sajida Bhanu
<[email protected]> wrote:
>
> Changes since V7:
> - Patch set V6 rebased on Ulf's(Ulf Hansson) master branch instead
> of Ulf's (Ulf Hansson) next branch by mistake. So rebased patch
> set on Ulf's next branch now as suggested by Adrain Hunter.

Thanks to both of you for moving this forward to become an easy
maintainable piece of code.

Queued for v5.20 on the devel branch, thanks!

Kind regards
Uffe


>
> Changes since V6:
> - Rebased on Ulf's(Ulf Hansson) next branch as suggested by
> Adrain Hunter.
> - Replaced debugfs_create_file() with debugfs_create_file_unsafe()
> as suggested by Adrain Hunter.
> - "[V6,5/5] mmc: cqhci: Capture eMMC and SD card errors" not
> included in this Patch series as we don't have cqhci changes
> on Ulf's(Ulf Hansson)next branch.
>
> Changes since V5:
> - Considered all error stats enums to set error state.
> - Added missed tuning error related code changes which was
> missed in patch set V5 as Adrain Hunter pointed.
> - Replaced DEFINE_SIMPLE_ATTRIBUTE with DEFINE_DEBUGFS_ATTRIBUTE
> as suggested by Adrain Hunter.
>
> Changes since V4:
> - Defined new macro to increment err_stats members when error occured
> as suggested by Adrain Hunter.
> - Called err_stats members increment function after printing the error
> as suggested by Adrain Hunter.
> - Considered INDEX and END_BIT errors same as CRC errors as suggested
> by Adrain Hunter.
> - Removed Null check for host in debug fs functions and Reordered
> err_stats declarationas suggested by Adrain Hunter.
> - Removed err_state variable stuff and updated err_state debug fs entry
> based on the err_stats members state as suggested by Adrain Hunter.
>
> Changes since V3:
> - Dropped error stats feature flag as suggested by Adrain Hunter.
> - Separated error state related changes in separate patches as
> suggested by Adrain Hunter.
> [PATCH V4 4/7] : error state debug fs
> [PATCH V4 5/7] : error state enable function
> [PATCH V4 6/7] : error state enable in error case
> - Note: we are enabling error state before calling sdhci_dumpregs
> we couldn't add the err state in error stats array as err state
> is not error type.
> - Corrected Signed-off-by order as suggested by Bjron Andersson.
> - Moved error state enable code from sdhci_dumpregs to error
> conditions as suggested by Adrain Hunter
>
> Changes since V2:
> - Removed userspace error stats clear debug fs entry as suggested
> by Adrain Hunter.
> - Split patch into 4 patches
> [PATCH V3 1/4] : sdhci driver
> [PATCH V3 2/4] : debug fs entries
> [PATCH V3 3/4] : core driver
> [PATCH V3 4/4] : cqhci driver
> - Used for loop to print error messages instead of using printf
> statements for all error messages as suggested by Adrain Hunter.
> - Introduced one flag to enable error stats feature, if any other
> client wants to use this feature, they need to enable that flag.
> - Moved reset command timeout error statement to card init flow
> as suggested by Adrain Hunter.
>
> Changes since V1:
> - Removed sysfs entry for eMMC and SD card error statistics and added
> debugfs entry as suggested by Adrian Hunter and Ulf Hansson.
>
> Shaik Sajida Bhanu (5):
> mmc: core: Capture eMMC and SD card errors
> mmc: sdhci: Capture eMMC and SD card errors
> mmc: debugfs: Add debug fs entry for mmc driver
> mmc: debugfs: Add debug fs error state entry for mmc driver
> mmc: cqhci: Capture eMMC and SD card errors
>
> drivers/mmc/core/core.c | 10 +++++-
> drivers/mmc/core/debugfs.c | 79 +++++++++++++++++++++++++++++++++++++++++++
> drivers/mmc/host/cqhci-core.c | 9 ++++-
> drivers/mmc/host/sdhci.c | 59 ++++++++++++++++++++++++--------
> drivers/mmc/host/sdhci.h | 3 ++
> include/linux/mmc/host.h | 26 ++++++++++++++
> include/linux/mmc/mmc.h | 6 ++++
> 7 files changed, 175 insertions(+), 17 deletions(-)
>
> --
> QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member
> of Code Aurora Forum, hosted by The Linux Foundation
>