linux-rockchip.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Coly Li <colyli@suse.de>
To: Vicente Bergas <vicencb@gmail.com>
Cc: Jens Axboe <axboe@kernel.dk>,
	Bart Van Assche <bvanassche@acm.org>,
	"Martin K. Petersen" <martin.petersen@oracle.com>,
	"Darrick J. Wong" <darrick.wong@oracle.com>,
	adrian.hunter@intel.com, Ming Lei <ming.lei@redhat.com>,
	linux-block@vger.kernel.org, linux-rockchip@lists.infradead.org,
	Hannes Reinecke <hare@suse.de>,
	cjb@laptop.org, Christoph Hellwig <hch@lst.de>
Subject: Re: [BUG] discard_granularity is 0 on rk3399-gru-kevin
Date: Wed, 30 Sep 2020 09:58:03 +0800	[thread overview]
Message-ID: <6e409897-db13-0786-8dc0-4efd0c81175e@suse.de> (raw)
In-Reply-To: <8f461da7-1a49-4288-8b06-020ddaa3dcc6@gmail.com>

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@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@intel.com>
>>     Signed-off-by: Chris Ball <cjb@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


_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip

  reply	other threads:[~2020-09-30  1:58 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-27 20:29 [BUG] discard_granularity is 0 on rk3399-gru-kevin Vicente Bergas
2020-09-28  3:15 ` Coly Li
2020-09-28  5:02   ` Coly Li
2020-09-30  0:07     ` Vicente Bergas
2020-09-30  1:58       ` Coly Li [this message]
2020-09-30 10:48     ` Adrian Hunter
2020-09-30 11:06       ` Coly Li

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6e409897-db13-0786-8dc0-4efd0c81175e@suse.de \
    --to=colyli@suse.de \
    --cc=adrian.hunter@intel.com \
    --cc=axboe@kernel.dk \
    --cc=bvanassche@acm.org \
    --cc=cjb@laptop.org \
    --cc=darrick.wong@oracle.com \
    --cc=hare@suse.de \
    --cc=hch@lst.de \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=martin.petersen@oracle.com \
    --cc=ming.lei@redhat.com \
    --cc=vicencb@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).