Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1297790 > unrolled thread

[PATCH] Move the judgement of timeout into mmc_switch_status_error()

Started by장영진 <yj84.jang@samsung.com>
First post2015-12-24 10:20 +0100
Last post2015-12-24 11:20 +0100
Articles 3 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] Move the judgement of timeout into mmc_switch_status_error() 장영진 <yj84.jang@samsung.com> - 2015-12-24 10:20 +0100
    Re: [PATCH] Move the judgement of timeout into  mmc_switch_status_error() Jaehoon Chung <jh80.chung@samsung.com> - 2015-12-24 10:30 +0100
      Re: [PATCH] Move the judgement of timeout into  mmc_switch_status_error() Jaehoon Chung <jh80.chung@samsung.com> - 2015-12-24 11:20 +0100

#1297790 — [PATCH] Move the judgement of timeout into mmc_switch_status_error()

From장영진 <yj84.jang@samsung.com>
Date2015-12-24 10:20 +0100
Subject[PATCH] Move the judgement of timeout into mmc_switch_status_error()
Message-ID<qJadY-4TB-5@gated-at.bofh.it>
From bc1e491b29d9199f16c6e002a69f9377677b93af Mon Sep 17 00:00:00 2001

From: "yj84.jang" <yj84.jang@samsung.com>

Date: Wed, 16 Dec 2015 08:52:47 +0900

Subject: [PATCH] Move the judgement of timeout into
mmc_switch_status_error()

 

__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.

 

Checking state of mmc card is needed when judging an timeout error, 

if it is just timeout or timeout with error.

 

Signed-off-by: yj84.jang <yj84.jang@samsung.com>

---

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);

 

-- 

1.7.9.5

 


--
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/

[toc] | [next] | [standalone]


#1297794 — Re: [PATCH] Move the judgement of timeout into mmc_switch_status_error()

FromJaehoon Chung <jh80.chung@samsung.com>
Date2015-12-24 10:30 +0100
SubjectRe: [PATCH] Move the judgement of timeout into mmc_switch_status_error()
Message-ID<qJanD-4WC-3@gated-at.bofh.it>
In reply to#1297790
Hi,

Before send the patch at mailing list, you need to make the patch as mainline style.
Maybe..maintainer should not review this patch.

Refer to "Linux kernel coding style" and "submitting Patches".
Also set  your email environment. (Documentation/email-clients.txt)

Best Regards,
Jaehoon Chung

On 12/24/2015 06:13 PM, 장영진 wrote:
>>From bc1e491b29d9199f16c6e002a69f9377677b93af Mon Sep 17 00:00:00 2001
> 
> From: "yj84.jang" <yj84.jang@samsung.com>
> 
> Date: Wed, 16 Dec 2015 08:52:47 +0900
> 
> Subject: [PATCH] Move the judgement of timeout into
> mmc_switch_status_error()
> 
>  
> 
> __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.
> 
>  
> 
> Checking state of mmc card is needed when judging an timeout error, 
> 
> if it is just timeout or timeout with error.
> 
>  
> 
> Signed-off-by: yj84.jang <yj84.jang@samsung.com>
> 
> ---
> 
> 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/

[toc] | [prev] | [next] | [standalone]


#1297805 — Re: [PATCH] Move the judgement of timeout into mmc_switch_status_error()

FromJaehoon Chung <jh80.chung@samsung.com>
Date2015-12-24 11:20 +0100
SubjectRe: [PATCH] Move the judgement of timeout into mmc_switch_status_error()
Message-ID<qJba1-5to-5@gated-at.bofh.it>
In reply to#1297794
Hi,

NAK.

Maybe..It seems that this is not the patch based on latest kernel..
Which kernel version did you use? Plz, check the latest kernel.

Best Regards,
Jaehoon Chung

On 12/24/2015 06:24 PM, Jaehoon Chung wrote:
> Hi,
> 
> Before send the patch at mailing list, you need to make the patch as mainline style.
> Maybe..maintainer should not review this patch.
> 
> Refer to "Linux kernel coding style" and "submitting Patches".
> Also set  your email environment. (Documentation/email-clients.txt)
> 
> Best Regards,
> Jaehoon Chung
> 
> On 12/24/2015 06:13 PM, 장영진 wrote:
>> >From bc1e491b29d9199f16c6e002a69f9377677b93af Mon Sep 17 00:00:00 2001
>>
>> From: "yj84.jang" <yj84.jang@samsung.com>
>>
>> Date: Wed, 16 Dec 2015 08:52:47 +0900
>>
>> Subject: [PATCH] Move the judgement of timeout into
>> mmc_switch_status_error()
>>
>>  
>>
>> __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.
>>
>>  
>>
>> Checking state of mmc card is needed when judging an timeout error, 
>>
>> if it is just timeout or timeout with error.
>>
>>  
>>
>> Signed-off-by: yj84.jang <yj84.jang@samsung.com>
>>
>> ---
>>
>> 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-mmc" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
> 

--
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/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web