Skip to contentSkip to conversation

mmc: core: Add MMC BKOPS statistics and debugfs ability to print them

PATCH In review Maya Erez 1 participant 1 message Jan 10, 2013

Subsystems (2)
lore
Share & tools
lore

Maya Erez

author
#0 lore raw

PATCH v5 3/3 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 statistics provide the following information:
The number of times BKOPS were issued according to it's severity level The number of times BKOPS were interrupted by HPI.
The number of times the host went into suspend

---
 drivers/mmc/core/bus.c     |    2 +
 drivers/mmc/core/core.c    |   53 ++++++++++++++++++++
 drivers/mmc/core/debugfs.c |  114 ++++++++++++++++++++++++++++++++++++++++++++
 include/linux/mmc/card.h   |   12 +++++
 include/linux/mmc/core.h   |    2 +
 5 files changed, 183 insertions(+), 0 deletions(-)
drivers/mmc/core/bus.c +2 -0
index 420cb67..47f883b 100644
@@ -250,6 +250,8 @@ struct mmc_card *mmc_alloc_card(struct mmc_host *host, struct device_type *type)
 	card->dev.release = mmc_release_card;
 	card->dev.type = type;
 
+	spin_lock_init(&card->bkops_info.bkops_stats.lock);
+
 	return card;
 }
 
drivers/mmc/core/core.c +53 -0

83 lines not on this page · raw message

drivers/mmc/core/debugfs.c +114 -0

126 lines not on this page · raw message

include/linux/mmc/card.h +12 -0
index 806a99b..cffd7e9 100644
@@ -210,6 +210,16 @@ struct mmc_part {
 #define MMC_BLK_DATA_AREA_RPMB	(1<<3)
 };
 
+#define BKOPS_NUM_OF_SEVERITY_LEVELS	3
+struct mmc_bkops_stats {
+	spinlock_t		lock;
+	bool			enabled;
+	unsigned int		hpi;    /* hpi issued   */
+	unsigned int		suspend;/* card sleed issued */
+	bool			print_stats;
+	unsigned int bkops_level[BKOPS_NUM_OF_SEVERITY_LEVELS];
+};
+
 /**
  * struct mmc_bkops_info - BKOPS data
  * @dw:	Idle time bkops delayed work
@@ -222,6 +232,7 @@ struct mmc_part {
  * @size_percentage_to_queue_delayed_work: the changed
  *        percentage of sectors that should issue check for
  *        BKOPS need
+ * @bkops_stats: BKOPS statistics
  * @poll_for_completion:	Poll on BKOPS completion
  * @cancel_delayed_work: A flag to indicate if the delayed work
  *        should be cancelled
@@ -234,6 +245,7 @@ struct mmc_bkops_info {
 	unsigned int		delay_ms;
 	unsigned int		min_sectors_to_queue_delayed_work;
 	unsigned int		size_percentage_to_queue_delayed_work;
+	struct mmc_bkops_stats  bkops_stats;
 /*
  * A default time for checking the need for non urgent BKOPS once mmcqd
  * is idle.
include/linux/mmc/core.h +2 -0
index 2b7355a..1e2266b 100644
@@ -190,6 +190,8 @@ extern int mmc_flush_cache(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
Signature · 4 lines
1.7.3.3
-- 
QUALCOMM ISRAEL, on behalf of Qualcomm Innovation Center, Inc. is a member
of Code Aurora Forum, hosted by The Linux Foundation