[BUG] discard_granularity is 0 on rk3399-gru-kevin

Coly Li colyli at suse.de
Tue Sep 29 21:58:03 EDT 2020


On 2020/9/30 08:07, Vicente Bergas wrote:
> On Monday, September 28, 2020 7:02:00 AM CEST, Coly Li wrote:
>> On 2020/9/28 11:15, Coly Li wrote:
>>> On 2020/9/28 04:29, Vicente Bergas wrote:
>>>> Hi,
>>>> since recently the rk3399-gru-kevin is reporting the trace below.
>>>> The issue has been uncovered by
>>>>  b35fd7422c2f8e04496f5a770bd4e1a205414b3f
>>>>  block: check queue's limits.discard_granularity in ...
>>>
>>> Hi Vicente,
>>>
>>> Thanks for the information. It seems the device with f2fs declares to
>>> support DISCARD but don't initialize discard_granularity for its queue.
>>>
>>> Can I know which block driver is under f2fs ?
> 
> Hi Coly, yes, i confirm it is the mmc driver.

Let's wait for MMC developers to response firstly.

Thanks.


Coly Li

> 
>> Maybe it is the mmc driver. A zero value discard_granularity is from the
>> following commit:
>>
>> commit e056a1b5b67b4e4bfad00bf143ab14f634777705
>> Author: Adrian Hunter <adrian.hunter at intel.com>
>> Date:   Tue Jun 28 17:16:02 2011 +0300
>>
>>     mmc: queue: let host controllers specify maximum discard timeout
>>
>>     Some host controllers will not operate without a hardware
>>     timeout that is limited in value.  However large discards
>>     require large timeouts, so there needs to be a way to
>>     specify the maximum discard size.
>>
>>     A host controller driver may now specify the maximum discard
>>     timeout possible so that max_discard_sectors can be calculated.
>>
>>     However, for eMMC when the High Capacity Erase Group Size
>>     is not in use, the timeout calculation depends on clock
>>     rate which may change.  For that case Preferred Erase Size
>>     is used instead.
>>
>>     Signed-off-by: Adrian Hunter <adrian.hunter at intel.com>
>>     Signed-off-by: Chris Ball <cjb at laptop.org>
>>
>>
>> Hi Adrian and Chris,
>>
>> I am not familiar with mmc driver, therefore I won't provide a quick fix
>> like this (which might probably wrong),
>> --- a/drivers/mmc/core/queue.c
>> +++ b/drivers/mmc/core/queue.c
>> @@ -190,7 +190,7 @@ static void mmc_queue_setup_discard(struct
>> request_queue *q,
>>         q->limits.discard_granularity = card->pref_erase << 9;
>>         /* granularity must not be greater than max. discard */
>>         if (card->pref_erase > max_discard)
>> -               q->limits.discard_granularity = 0;
>> +               q->limits.discard_granularity = SECTOR_SIZE;
>>         if (mmc_can_secure_erase_trim(card))
>>                 blk_queue_flag_set(QUEUE_FLAG_SECERASE, q);
>>  }
>>
>>
>> It is improper for a device driver to declare to support DISCARD but set
>> queue's discard_granularity as 0.
>>
>> Could you please to take a look for mmc_queue_setup_discard() ?
>>
>> Thanks in advance.
>>
>> Coly Li




More information about the Linux-rockchip mailing list