diff options
author | Haijun Zhang <Haijun.Zhang@freescale.com> | 2013-10-14 06:25:51 (GMT) |
---|---|---|
committer | J. German Rivera <German.Rivera@freescale.com> | 2013-10-22 21:03:01 (GMT) |
commit | 424e728a461efa8f61b19ff251e5e5c2d92eb174 (patch) | |
tree | 8ef3b593c311816cb513a17a5e73ce303b4f7da0 /drivers/mmc/card | |
parent | 5c879b1c522143ba46ece84320a925a63ba6d13e (diff) | |
download | linux-fsl-qoriq-424e728a461efa8f61b19ff251e5e5c2d92eb174.tar.xz |
mmc:core: Avoid useless detecting task when card is busy
When card is in cpu polling mode to detect card present. Card detecting
task will be scheduled about once every second. When card is busy in large
file transfer, detecting task will be hang and call trace will be prompt.
When handling the request, CMD13 is always followed by every command when
it was complete. So assume that card is present to avoid this duplicate
detecting. Only polling card when card is free to reduce conflict with
data transfer.
<7>mmc0: req done (CMD13): 0: 00000e00 00000000 00000000 00000000
INFO: task kworker/u:1:12 blocked for more than 120 seconds.
"echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
kworker/u:1 D 00000000 0 12 2 0x00000000
Call Trace:
[ee06dd50] [44042028] 0x44042028
(unreliable)
[ee06de10] [c0007a0c] __switch_to+0xa0/0xf0
[ee06de30] [c04dd50c] __schedule+0x1f8/0x4a4
[ee06dea0] [c04dd898] schedule+0x30/0xbc
[ee06deb0] [c03816a4] __mmc_claim_host+0x98/0x19c
[ee06df00] [c0385f88] mmc_sd_detect+0x38/0xc0
[ee06df10] [c0382b0c] mmc_rescan+0x294/0x2e0
[ee06df40] [c00661cc] process_one_work+0x140/0x3e0
[ee06df70] [c0066bf8] worker_thread+0x18c/0x36c
[ee06dfb0] [c006bf10] kthread+0x7c/0x80
[ee06dff0] [c000de58] kernel_thread+0x4c/0x68
<7>sdhci [sdhci_irq()]: *** mmc0 got interrupt: 0x00000001
Signed-off-by: Haijun Zhang <haijun.zhang@freescale.com>
Change-Id: I267ac6597a647dad58fea76d695a6ee92e520c78
Reviewed-on: http://git.am.freescale.net:8181/4356
Tested-by: Review Code-CDREVIEW <CDREVIEW@freescale.com>
Reviewed-by: Xie Xiaobo-R63061 <X.Xie@freescale.com>
Reviewed-by: Rivera Jose-B46482 <German.Rivera@freescale.com>
Diffstat (limited to 'drivers/mmc/card')
-rw-r--r-- | drivers/mmc/card/block.c | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c index c043ccc..2d44ef2 100644 --- a/drivers/mmc/card/block.c +++ b/drivers/mmc/card/block.c @@ -1475,10 +1475,24 @@ static int mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req) int ret; struct mmc_blk_data *md = mq->data; struct mmc_card *card = md->queue.card; + struct mmc_host *host = card->host; + + unsigned long flags; + + if (req && !mq->mqrq_prev->req) { + /* + * When we are here, card polling task will be blocked. + * So disable it to avoid this useless schedule. + */ + if (host->caps & MMC_CAP_NEEDS_POLL) { + spin_lock_irqsave(&host->lock, flags); + host->rescan_disable = 1; + spin_unlock_irqrestore(&host->lock, flags); + } - if (req && !mq->mqrq_prev->req) /* claim host only for the first request */ mmc_claim_host(card->host); + } ret = mmc_blk_part_switch(card, md); if (ret) { @@ -1508,9 +1522,21 @@ static int mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req) } out: - if (!req) + if (!req) { /* release host only when there are no more requests */ mmc_release_host(card->host); + /* + * Detecting card status immediately in case card being + * removed just after the request is complete. + */ + if (host->caps & MMC_CAP_NEEDS_POLL) { + spin_lock_irqsave(&host->lock, flags); + host->rescan_disable = 0; + spin_unlock_irqrestore(&host->lock, flags); + mmc_detect_change(host, 0); + } + } + return ret; } |