From 151436a3c8ef8984b67cc69e5fca32906d9e8539 Mon Sep 17 00:00:00 2001 From: Shawn Lin Date: Tue, 23 Jun 2015 09:20:00 +0800 Subject: [PATCH] mmc: core: reduce erase event timeout We set wrong discard timeout limitation for erase event which exceed that block layer does. And jbd warning can be observed like blow: INFO: task update_binary:151 blocked for more than 10 seconds. "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message. update_binary D ffffffc000085674 0 151 134 0x00400008 Call trace: [] __switch_to+0x80/0x8c [] __schedule+0x4e0/0x6f4 [] schedule+0x64/0x70 [] schedule_timeout+0x28/0x250 [] io_schedule_timeout+0x6c/0xa8 [] wait_for_common_io.constprop.111+0x94/0x114 [] wait_for_completion_io+0xc/0x18 [] blkdev_issue_discard+0x1e0/0x214 [] blkdev_ioctl+0x2d0/0x708 [] compat_blkdev_ioctl+0x464/0x5ec [] compat_sys_ioctl+0x104/0x1e8 Signed-off-by: Shawn Lin --- drivers/mmc/core/core.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index 4a337b162644..285949f7d062 100755 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c @@ -403,9 +403,13 @@ static void mmc_get_req_timeout(struct mmc_request *mrq, u32 *timeout) (mrq->cmd->opcode == MMC_ERASE_GROUP_START) || (mrq->cmd->opcode == MMC_ERASE_GROUP_END) || (mrq->cmd->opcode == MMC_SEND_STATUS)) - *timeout = 2500000; + ((mrq->cmd->opcode == MMC_ERASE) && + ((mrq->cmd->arg == MMC_DISCARD_ARG) || + (mrq->cmd->arg == MMC_TRIM_ARG))) ? + (*timeout = 10000) : (*timeout = 25000); else *timeout = 500; + } else { *timeout = mrq->cmd->data->blocks * mrq->cmd->data->blksz * 500; -- 2.34.1