Skip to contentSkip to conversation

mmc: sdhci: shorten the interval to wait SDHCI_PRESENT_STATE set after sending cmd

PATCH In review Barry Song 3 participants 3 messages Sep 29, 2011 – Oct 8, 2011

Subsystems (2)
lore
Share & tools
lore

Barry Song

author
#0 lore raw

PATCH 1/1 mmc: sdhci: shorten the interval to wait SDHCI_PRESENT_STATE set after sending cmd

From: Barry Song <[email protected]>

now we wait 1ms after every loop, in the worst case, 1ms will be wasted. that both decreases sd performance and increases cpu usage. This patch shorten the interval to 1us, then in the worst case, only 1us is wasted.

---
 drivers/mmc/host/sdhci.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
drivers/mmc/host/sdhci.c +3 -3
index 0e02cc1..13bcb96 100644
@@ -935,8 +935,8 @@ static void sdhci_send_command(struct sdhci_host *host, struct mmc_command *cmd)
 
 	WARN_ON(host->cmd);
 
-	/* Wait max 10 ms */
-	timeout = 10;
+	/* Wait max 10000 us */
+	timeout = 10000;
 
 	mask = SDHCI_CMD_INHIBIT;
 	if ((cmd->data != NULL) || (cmd->flags & MMC_RSP_BUSY))
@@ -957,7 +957,7 @@ static void sdhci_send_command(struct sdhci_host *host, struct mmc_command *cmd)
 			return;
 		}
 		timeout--;
-		mdelay(1);
+		udelay(1);
 	}
 
 	mod_timer(&host->timer, jiffies + 10 * HZ);
Signature · 6 lines
1.7.1



Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom
More information can be found at www.csr.com. Follow CSR on Twitter at http://twitter.com/CSR_PLC and read our blog at www.csr.com/blog
#2 lore raw

2011/10/1 Andrei E. Warkentin <[email protected]>:

Quoted 10 lines

Hi,

2011/9/28 Barry Song <[email protected]>:

Quoted 7 lines

From: Barry Song <[email protected]>

now we wait 1ms after every loop, in the worst case, 1ms will be wasted. that both decreases sd performance and increases cpu usage. This patch shorten the interval to 1us, then in the worst case, only 1us is wasted.

Quoted 4 lines
Quoted 2 lines

---

Cool! How much I/O perf did you gain?

A test was done by bonnie++ on csr prima2 with 2GB class 2 SD card.

before applying this patch:
Version 1.03e ------Sequential Output------ --Sequential Input- --Random-

                    -Per Chr- --Block-- -Rewrite- -Per Chr- --Block-- --Seeks--

Machine Size K/sec %CP K/sec %CP K/sec %CP K/sec %CP K/sec %CP /sec %CP
SiRFPrima2 768M 2555 39 2737 0 3661 2 5947 91 13301 3 909.3 4

after applying this patch:
Version 1.03e ------Sequential Output------ --Sequential Input- --Random-

                    -Per Chr- --Block-- -Rewrite- -Per Chr- --Block-- --Seeks--

Machine Size K/sec %CP K/sec %CP K/sec %CP K/sec %CP K/sec %CP /sec %CP
SiRFPrima2 768M 2611 40 2668 0 3675 2 5952 91 13302 3 952.2 4

Quoted 3 lines

A
-

-barry