Re: [PATCH] mmc: core: Set card as removed in mmc_remove_card()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 11/04/18 12:13, Shawn Lin wrote:
> On 2018/4/11 16:46, Adrian Hunter wrote:
>> On 11/04/18 10:24, Shawn Lin wrote:
>>> A simply continueous background I/O could 100% make the system stuck for
>>> a long time in my system when a unbind for the controller driver happens
>>> simultaneously. See:
>>>
>>> dd if=/dev/mmcblk0 of=/dev/null bs=512k count=100000 &&
>>> echo fe320000.dwmmc > /sys/bus/platform/drivers/dwmmc_rockchip/unbind
>>>
>>> The reason is all pending requests wait for timeout one by one, but never
>>> propagates BLK_STS_IOERR in the first place when kicked from the queue.
>>> Set the card as removed immediately in mmc_remove_card() to solve it.
>>>
>>> Signed-off-by: Shawn Lin <shawn.lin@xxxxxxxxxxxxxx>
>>> ---
>>>
>>>   drivers/mmc/core/bus.c | 1 +
>>>   1 file changed, 1 insertion(+)
>>>
>>> diff --git a/drivers/mmc/core/bus.c b/drivers/mmc/core/bus.c
>>> index fc92c6c..c6c5dfe 100644
>>> --- a/drivers/mmc/core/bus.c
>>> +++ b/drivers/mmc/core/bus.c
>>> @@ -389,6 +389,7 @@ void mmc_remove_card(struct mmc_card *card)
>>>               pr_info("%s: card %04x removed\n",
>>>                   mmc_hostname(card->host), card->rca);
>>>           }
>>> +        mmc_card_set_removed(card);
>>
>> Pedantically we should not call mmc_card_set_removed() if we have not
>> claimed the host.  Of course we can't claim the host because the block
> 
> yep.
> 
>> driver already has it, but I am not sure this is the right place to do this.
>>   My first question is how come the I/O times out if the card is still
>> present i.e. you are only unbinding the host controller, so you should
>> remove the card while the host controller and card are still functional?
> 
> The card is still functional for my host(but maybe not if ->remove()
> touchs the vmmc or vqmmc parts), but the host controller isn't, as the
> ->remove() calls.

I don't understand why the host controller isn't functional.  I tried it
with sdhci and it just waits for dd to finish but there are no I/O errors.

Is there a use-case for unbinding quickly?

> 
>>
>>>           device_del(&card->dev);
>>>           of_node_put(card->dev.of_node);
>>>       }
>>>
>>
>>
>>
>>
> 
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux