Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751479AbbL1Caf (ORCPT ); Sun, 27 Dec 2015 21:30:35 -0500 Received: from mailout1.samsung.com ([203.254.224.24]:59790 "EHLO mailout1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750833AbbL1CaZ (ORCPT ); Sun, 27 Dec 2015 21:30:25 -0500 X-AuditID: cbfee68f-f793a6d000001364-4d-56809ebed65e Message-id: <56809EB8.3030706@samsung.com> Date: Mon, 28 Dec 2015 11:30:16 +0900 From: Jaehoon Chung User-Agent: Mozilla/5.0 (X11; Linux i686; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-version: 1.0 To: yj84.jang@samsung.com, ulf.hansson@linaro.org, linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org Cc: demon.lee@samsung.com, js07.lee@samsung.com Subject: Re: [PATCH] Move the judgement of timeout into mmc_switch_status_error() References: <1921572.349701451268445456.JavaMail.weblogic@ep2mlwas03b> In-reply-to: <1921572.349701451268445456.JavaMail.weblogic@ep2mlwas03b> Content-type: text/plain; charset=utf-8 Content-transfer-encoding: 7bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprIIsWRmVeSWpSXmKPExsWyRsSkRHf/vIYwg1/HmCx2njvCbPHo5m9W i8u75rBZHPnfz2hxfG24RdehxawObB53ru1h8+jbsorR4/MmuQDmKC6blNSczLLUIn27BK6M 9j2TWQuaJSqm/9/I3sDYK9zFyMkhIWAicevkPDYIW0ziwr31QDYXh5DACkaJrgmPmGGKeo7s YIFIzGKU+HZ5H5TzgFFi15pbLCBVvAJaEuuurQDrYBFQldiw4B/YWDYBHYnt344zgdiiAmES D9btZYWoF5T4MfkeWK+IQI7Ei3nH2UFsZgF9ic1vV4PVCwsESyx7cxksLiTgJvFtwj2gOAcH p4C7xKwnISAms4C6xJQpuRCd8hKb17xlBjlNQmAXu8T1nQvZIc4RkPg2+RALSL2EgKzEpgNQ f0lKHFxxg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QWwfQxcXBKNTCu9eCQ+DmvhUm218Pzul6C3KN/NtUCV6+I /vSbu9mrzClCLmvHAd3QZsYAbknF4rNb0xtM1O5mbcvsefUpWvi6nPi3i3KzZjndlLAoabbx ZhOs+Dh1UvO3C+sEItWzDtu+mLy6IHT3dc6IhDs55q8Xp+dYbtbtD2SZ/16truvE5Q1cDekH vymxFGckGmoxFxUnAgDtaKib8QIAAA== DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3236 Lines: 89 Hi, Did you read my comment? Which kernel version did you use? I think your patch doesn't need on mainline kernel. If you want to apply the patch, work on the latest kernel. https://patchwork.kernel.org/patch/7719811/ Author: Chaotian Jing AuthorDate: Mon Nov 30 09:27:30 2015 +0800 Commit: Ulf Hansson CommitDate: Tue Dec 22 11:32:18 2015 +0100 mmc: core: fix __mmc_switch timeout caused by preempt there is a time window between __mmc_send_status() and time_afer(), on some eMMC chip, the timeout_ms is only 10ms, if this thread was scheduled out during this period, then, even card has already changes to transfer state by the result of CMD13, this part of code also treat it to timeout error. So, need calculate timeout first, then call __mmc_send_status(), if already timeout and card still in programing state, then treat it to the real timeout error. Signed-off-by: Chaotian Jing Signed-off-by: Ulf Hansson Best Regards, Jaehoon Chung On 12/28/2015 11:07 AM, Youngjin Jang wrote: > __mmc_switch() is possible to misjudge error. > > Although jiffies was overed timeout, > the chance about "R1_CURRENT_STATE(status) != R1_STATE_PRG" is exists. > In other words, Successful completion of CMD6 with timeout error. > > Kernel expects failure of __mmc_switch, > but card is completed CMD6 in this case. > It makes mismatch status between mmc subsystem and mmc card. > > Especially, in case of partition switch, > If timeout occurs with normal status of CMD13 response unfortunatley, > "main_md->curr" will not be set, even card switched successfully. main_md->curr is right? main_md->part_curr? > > Checking state of mmc card is needed when judging an timeout error, > if it is just timeout or timeout with error. > > Reviewed-by: Jungseung Lee > Signed-off-by: Youngjin Jang > --- > drivers/mmc/core/mmc_ops.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/drivers/mmc/core/mmc_ops.c b/drivers/mmc/core/mmc_ops.c > index 1f44426..033f475 100644 > --- a/drivers/mmc/core/mmc_ops.c > +++ b/drivers/mmc/core/mmc_ops.c > @@ -456,6 +456,8 @@ int mmc_switch_status_error(struct mmc_host *host, u32 status) > if (status & R1_SPI_ILLEGAL_COMMAND) > return -EBADMSG; > } else { > + if (R1_CURRENT_STATE(status) == R1_STATE_PRG) > + return -ETIMEDOUT; > if (status & 0xFDFFA000) > pr_warn("%s: unexpected status %#x after switch\n", > mmc_hostname(host), status); > @@ -568,8 +570,7 @@ int __mmc_switch(struct mmc_card *card, u8 set, u8 index, u8 value, > if (time_after(jiffies, timeout)) { > pr_err("%s: Card stuck in programming state! %s\n", > mmc_hostname(host), __func__); > - err = -ETIMEDOUT; > - goto out; > + break; > } > } while (R1_CURRENT_STATE(status) == R1_STATE_PRG); > > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/