2023-11-03 08:48:36

by Adrian Hunter

[permalink] [raw]
Subject: [PATCH V2 2/6] mmc: cqhci: Increase recovery halt timeout

Failing to halt complicates the recovery. Additionally, unless the card or
controller are stuck, which is expected to be very rare, then the halt
should succeed, so it is better to wait. Set a large timeout.

Fixes: a4080225f51d ("mmc: cqhci: support for command queue enabled host")
Cc: [email protected]
Signed-off-by: Adrian Hunter <[email protected]>
---
drivers/mmc/host/cqhci-core.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/mmc/host/cqhci-core.c b/drivers/mmc/host/cqhci-core.c
index b3d7d6d8d654..15f5a069af1f 100644
--- a/drivers/mmc/host/cqhci-core.c
+++ b/drivers/mmc/host/cqhci-core.c
@@ -984,10 +984,10 @@ static bool cqhci_halt(struct mmc_host *mmc, unsigned int timeout)
/*
* After halting we expect to be able to use the command line. We interpret the
* failure to halt to mean the data lines might still be in use (and the upper
- * layers will need to send a STOP command), so we set the timeout based on a
- * generous command timeout.
+ * layers will need to send a STOP command), however failing to halt complicates
+ * the recovery, so set a timeout that would reasonably allow I/O to complete.
*/
-#define CQHCI_START_HALT_TIMEOUT 5
+#define CQHCI_START_HALT_TIMEOUT 500

static void cqhci_recovery_start(struct mmc_host *mmc)
{
--
2.34.1


2023-11-06 06:58:25

by Adrian Hunter

[permalink] [raw]
Subject: Re: [PATCH V2 2/6] mmc: cqhci: Increase recovery halt timeout

On 3/11/23 12:37, Avri Altman wrote:
>> Failing to halt complicates the recovery. Additionally, unless the card or
>> controller are stuck, which is expected to be very rare, then the halt should
>> succeed, so it is better to wait. Set a large timeout.
> Maybe also explain that If task queuing is in progress, CQE needs to complete the operation, sending both commands and processing the responses.

True, although those commands should be quite quick.

>
>>
>> Fixes: a4080225f51d ("mmc: cqhci: support for command queue enabled
>> host")
>> Cc: [email protected]
>> Signed-off-by: Adrian Hunter <[email protected]>
> Reviewed-by: Avri Altman <[email protected]>
>
>> ---
>> drivers/mmc/host/cqhci-core.c | 6 +++---
>> 1 file changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/mmc/host/cqhci-core.c b/drivers/mmc/host/cqhci-core.c
>> index b3d7d6d8d654..15f5a069af1f 100644
>> --- a/drivers/mmc/host/cqhci-core.c
>> +++ b/drivers/mmc/host/cqhci-core.c
>> @@ -984,10 +984,10 @@ static bool cqhci_halt(struct mmc_host *mmc,
>> unsigned int timeout)
>> /*
>> * After halting we expect to be able to use the command line. We interpret
>> the
>> * failure to halt to mean the data lines might still be in use (and the upper
>> - * layers will need to send a STOP command), so we set the timeout based
>> on a
>> - * generous command timeout.
>> + * layers will need to send a STOP command), however failing to halt
>> + complicates
>> + * the recovery, so set a timeout that would reasonably allow I/O to
>> complete.
>> */
>> -#define CQHCI_START_HALT_TIMEOUT 5
>> +#define CQHCI_START_HALT_TIMEOUT 500
>>
>> static void cqhci_recovery_start(struct mmc_host *mmc) {
>> --
>> 2.34.1
>