linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mmc: dw_mmc: Dont wait for DRTO on Write RSP error
@ 2021-09-16  5:59 ` Christian Löhle
  2021-09-22 22:52   ` Jaehoon Chung
  2021-09-23 18:49   ` Ulf Hansson
  0 siblings, 2 replies; 4+ messages in thread
From: Christian Löhle @ 2021-09-16  5:59 UTC (permalink / raw)
  To: jh80.chung, ulf.hansson, Christian Löhle, linux-mmc, linux-kernel

Only wait for DRTO on reads, otherwise the driver hangs.

The driver prevents sending CMD12 on response errors like CRCs.
According to the comment this is because some cards have problems
with this during the UHS tuning sequence.
Unfortunately this workaround currently also applies for any command
with data.
On reads this will set the drto timer which then triggers after a while.
On writes this will not set any timer and the tasklet will not be
scheduled again.
I cannot attest for the UHS workarounds need, but even if so, it should
at most apply to reads.
I have observed many hangs when CMD25 response contained a CRC error.
This patch fixes this without touching the actual UHS tuning workaround.

Signed-off-by: Christian Loehle <cloehle@hyperstone.com>
---
 drivers/mmc/host/dw_mmc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
index 6578cc64ae9e..22cf13dc799b 100644
--- a/drivers/mmc/host/dw_mmc.c
+++ b/drivers/mmc/host/dw_mmc.c
@@ -2081,7 +2081,8 @@ static void dw_mci_tasklet_func(struct tasklet_struct *t)
 				 * delayed. Allowing the transfer to take place
 				 * avoids races and keeps things simple.
 				 */
-				if (err != -ETIMEDOUT) {
+				if (err != -ETIMEDOUT &&
+				    host->dir_status == DW_MCI_RECV_STATUS) {
 					state = STATE_SENDING_DATA;
 					continue;
 				}
-- 
2.32.0
Hyperstone GmbH | Line-Eid-Strasse 3 | 78467 Konstanz
Managing Directors: Dr. Jan Peter Berns.
Commercial register of local courts: Freiburg HRB381782


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] mmc: dw_mmc: Dont wait for DRTO on Write RSP error
  2021-09-16  5:59 ` [PATCH] mmc: dw_mmc: Dont wait for DRTO on Write RSP error Christian Löhle
@ 2021-09-22 22:52   ` Jaehoon Chung
  2021-09-23  4:44     ` Jaehoon Chung
  2021-09-23 18:49   ` Ulf Hansson
  1 sibling, 1 reply; 4+ messages in thread
From: Jaehoon Chung @ 2021-09-22 22:52 UTC (permalink / raw)
  To: Christian Löhle, ulf.hansson, linux-mmc, linux-kernel

Hi Chritstian,

On 9/16/21 2:59 PM, Christian Löhle wrote:
> Only wait for DRTO on reads, otherwise the driver hangs.
> 
> The driver prevents sending CMD12 on response errors like CRCs.
> According to the comment this is because some cards have problems
> with this during the UHS tuning sequence.
> Unfortunately this workaround currently also applies for any command
> with data.
> On reads this will set the drto timer which then triggers after a while.
> On writes this will not set any timer and the tasklet will not be
> scheduled again.
> I cannot attest for the UHS workarounds need, but even if so, it should
> at most apply to reads.
> I have observed many hangs when CMD25 response contained a CRC error.
> This patch fixes this without touching the actual UHS tuning workaround.

Sorry for reply too late. I'm checking your patch on my target. 
I will share the result.

Best Regards,
Jaehoon Chung

> 
> Signed-off-by: Christian Loehle <cloehle@hyperstone.com>
> ---
>  drivers/mmc/host/dw_mmc.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
> index 6578cc64ae9e..22cf13dc799b 100644
> --- a/drivers/mmc/host/dw_mmc.c
> +++ b/drivers/mmc/host/dw_mmc.c
> @@ -2081,7 +2081,8 @@ static void dw_mci_tasklet_func(struct tasklet_struct *t)
>  				 * delayed. Allowing the transfer to take place
>  				 * avoids races and keeps things simple.
>  				 */
> -				if (err != -ETIMEDOUT) {
> +				if (err != -ETIMEDOUT &&
> +				    host->dir_status == DW_MCI_RECV_STATUS) {
>  					state = STATE_SENDING_DATA;
>  					continue;
>  				}
> 


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] mmc: dw_mmc: Dont wait for DRTO on Write RSP error
  2021-09-22 22:52   ` Jaehoon Chung
@ 2021-09-23  4:44     ` Jaehoon Chung
  0 siblings, 0 replies; 4+ messages in thread
From: Jaehoon Chung @ 2021-09-23  4:44 UTC (permalink / raw)
  To: Christian Löhle, ulf.hansson, linux-mmc, linux-kernel

On 9/23/21 7:52 AM, Jaehoon Chung wrote:
> Hi Chritstian,
> 
> On 9/16/21 2:59 PM, Christian Löhle wrote:
>> Only wait for DRTO on reads, otherwise the driver hangs.
>>
>> The driver prevents sending CMD12 on response errors like CRCs.
>> According to the comment this is because some cards have problems
>> with this during the UHS tuning sequence.
>> Unfortunately this workaround currently also applies for any command
>> with data.
>> On reads this will set the drto timer which then triggers after a while.
>> On writes this will not set any timer and the tasklet will not be
>> scheduled again.
>> I cannot attest for the UHS workarounds need, but even if so, it should
>> at most apply to reads.
>> I have observed many hangs when CMD25 response contained a CRC error.
>> This patch fixes this without touching the actual UHS tuning workaround.
> 
> Sorry for reply too late. I'm checking your patch on my target. 
> I will share the result.
> 
> Best Regards,
> Jaehoon Chung
> 
>>
>> Signed-off-by: Christian Loehle <cloehle@hyperstone.com>

Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>

Best Regards,
Jaehoon Chung

>> ---
>>  drivers/mmc/host/dw_mmc.c | 3 ++-
>>  1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
>> index 6578cc64ae9e..22cf13dc799b 100644
>> --- a/drivers/mmc/host/dw_mmc.c
>> +++ b/drivers/mmc/host/dw_mmc.c
>> @@ -2081,7 +2081,8 @@ static void dw_mci_tasklet_func(struct tasklet_struct *t)
>>  				 * delayed. Allowing the transfer to take place
>>  				 * avoids races and keeps things simple.
>>  				 */
>> -				if (err != -ETIMEDOUT) {
>> +				if (err != -ETIMEDOUT &&
>> +				    host->dir_status == DW_MCI_RECV_STATUS) {
>>  					state = STATE_SENDING_DATA;
>>  					continue;
>>  				}
>>
> 
> 


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] mmc: dw_mmc: Dont wait for DRTO on Write RSP error
  2021-09-16  5:59 ` [PATCH] mmc: dw_mmc: Dont wait for DRTO on Write RSP error Christian Löhle
  2021-09-22 22:52   ` Jaehoon Chung
@ 2021-09-23 18:49   ` Ulf Hansson
  1 sibling, 0 replies; 4+ messages in thread
From: Ulf Hansson @ 2021-09-23 18:49 UTC (permalink / raw)
  To: Christian Löhle; +Cc: jh80.chung, linux-mmc, linux-kernel

On Thu, 16 Sept 2021 at 07:59, Christian Löhle <CLoehle@hyperstone.com> wrote:
>
> Only wait for DRTO on reads, otherwise the driver hangs.
>
> The driver prevents sending CMD12 on response errors like CRCs.
> According to the comment this is because some cards have problems
> with this during the UHS tuning sequence.
> Unfortunately this workaround currently also applies for any command
> with data.
> On reads this will set the drto timer which then triggers after a while.
> On writes this will not set any timer and the tasklet will not be
> scheduled again.
> I cannot attest for the UHS workarounds need, but even if so, it should
> at most apply to reads.
> I have observed many hangs when CMD25 response contained a CRC error.
> This patch fixes this without touching the actual UHS tuning workaround.
>
> Signed-off-by: Christian Loehle <cloehle@hyperstone.com>

Applied for next and by adding a stable tag, thanks!

If you don't think we need the stable tag, please tell me.

Kind regards
Uffe


> ---
>  drivers/mmc/host/dw_mmc.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
> index 6578cc64ae9e..22cf13dc799b 100644
> --- a/drivers/mmc/host/dw_mmc.c
> +++ b/drivers/mmc/host/dw_mmc.c
> @@ -2081,7 +2081,8 @@ static void dw_mci_tasklet_func(struct tasklet_struct *t)
>                                  * delayed. Allowing the transfer to take place
>                                  * avoids races and keeps things simple.
>                                  */
> -                               if (err != -ETIMEDOUT) {
> +                               if (err != -ETIMEDOUT &&
> +                                   host->dir_status == DW_MCI_RECV_STATUS) {
>                                         state = STATE_SENDING_DATA;
>                                         continue;
>                                 }
> --
> 2.32.0
> Hyperstone GmbH | Line-Eid-Strasse 3 | 78467 Konstanz
> Managing Directors: Dr. Jan Peter Berns.
> Commercial register of local courts: Freiburg HRB381782
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-09-23 18:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20210916055929epcas1p2b5cc839886e68a2f2cec17200a2b6d83@epcas1p2.samsung.com>
2021-09-16  5:59 ` [PATCH] mmc: dw_mmc: Dont wait for DRTO on Write RSP error Christian Löhle
2021-09-22 22:52   ` Jaehoon Chung
2021-09-23  4:44     ` Jaehoon Chung
2021-09-23 18:49   ` Ulf Hansson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).