diff options
| author | Dov Levenglick <dovl@codeaurora.org> | 2015-06-28 16:45:41 +0300 |
|---|---|---|
| committer | Subhash Jadavani <subhashj@codeaurora.org> | 2016-05-31 15:26:51 -0700 |
| commit | b98e6c2fa1dd4f4d3ec89f7a9674174b539f83c2 (patch) | |
| tree | 4ab931e5f9d9f4ef381d3e462b2e080dee9b999f /include/linux/mmc | |
| parent | 650d2e10860ce99b7430d04908c226ff2470c3ab (diff) | |
mmc: core: Add MMC BKOPS statistics and debugfs ability to print them
The BKOPS statistics are used for BKOPS unit tests and APT tests
to determine test success or failure.
The BKOPS statstics provide the following information:
The number of times BKOPS were issued according to its severity level
The number of times manual BKOPS was started/stopped (HPI)
The number of times auto BKOPS was enabled/disabled
In order to enable and reset the statistics:
echo 1 > /sys/kernel/debug/mmc0/mmc0:0001/bkops_stats
In order to disable the statistics:
echo 0 > /sys/kernel/debug/mmc0/mmc0:0001/bkops_stats
In order to view the statistics:
cat /sys/kernel/debug/mmc0/mmc0:0001/bkops_stats
Change-Id: Ib84319aedfb49dc022bc27efbda842a5db38c7e9
Signed-off-by: Yaniv Gardi <ygardi@codeaurora.org>
Signed-off-by: Dov Levenglick <dovl@codeaurora.org>
[subhashj@codeaurora.org: fixed trivial merge conflicts]
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
Diffstat (limited to 'include/linux/mmc')
| -rw-r--r-- | include/linux/mmc/card.h | 36 | ||||
| -rw-r--r-- | include/linux/mmc/core.h | 2 |
2 files changed, 38 insertions, 0 deletions
diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h index 80ce6cc36b88..895fc0ceaf6f 100644 --- a/include/linux/mmc/card.h +++ b/include/linux/mmc/card.h @@ -275,12 +275,48 @@ struct mmc_part { #define MMC_BLK_DATA_AREA_RPMB (1<<3) }; +enum { + MMC_BKOPS_NO_OP, + MMC_BKOPS_NOT_CRITICAL, + MMC_BKOPS_PERF_IMPACT, + MMC_BKOPS_CRITICAL, + MMC_BKOPS_NUM_SEVERITY_LEVELS, +}; + +/** + * struct mmc_bkops_stats - BKOPS statistics + * @lock: spinlock used for synchronizing the debugfs and the runtime accesses + * to this structure. No need to call with spin_lock_irq api + * @manual_start: number of times START_BKOPS was sent to the device + * @hpi: number of times HPI was sent to the device + * @auto_start: number of times AUTO_EN was set to 1 + * @auto_stop: number of times AUTO_EN was set to 0 + * @level: number of times the device reported the need for each level of + * bkops handling + * @enabled: control over whether statistics should be gathered + * + * This structure is used to collect statistics regarding the bkops + * configuration and use-patterns. It is collected during runtime and can be + * shown to the user via a debugfs entry. + */ +struct mmc_bkops_stats { + spinlock_t lock; + unsigned int manual_start; + unsigned int hpi; + unsigned int auto_start; + unsigned int auto_stop; + unsigned int level[MMC_BKOPS_NUM_SEVERITY_LEVELS]; + bool enabled; +}; + /** * struct mmc_bkops_info - BKOPS data + * @stats: statistic information regarding bkops * @need_manual: indication whether have to send START_BKOPS * to the device */ struct mmc_bkops_info { + struct mmc_bkops_stats stats; bool needs_manual; }; diff --git a/include/linux/mmc/core.h b/include/linux/mmc/core.h index 446b56765dbb..9a3e44f993c2 100644 --- a/include/linux/mmc/core.h +++ b/include/linux/mmc/core.h @@ -208,6 +208,8 @@ extern int mmc_cache_barrier(struct mmc_card *); extern int mmc_detect_card_removed(struct mmc_host *host); +extern void mmc_blk_init_bkops_statistics(struct mmc_card *card); + /** * mmc_claim_host - exclusively claim a host * @host: mmc host to claim |
