Re: [PATCH] [RFC] Revert "mmc: core: Fixup support for writeback-cache for eMMC and SD"

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

 



On 31/05/23 03:27, Marek Vasut wrote:
> This reverts commit 08ebf903af57cda6d773f3dd1671b64f73b432b8.
> 
> On STM32MP153C DHCOR DRC Compact with microSD card
> Kingston Canvas Go! Plus MicroSDXC I 64 GiB U3/V30/A2 SDCG3/64GB
> it is no longer possible to mount ext4 filesystem.
> 
> Git bisect points to this commit which is being reverted here. A bit of
> investigation shows that for non-working microSD cards
>   cache_enabled=TRUE fua_enabled=false
> For working microSD card (Kingston Canvas React Plus, MicroSDXC II
> 64 GiB U3/V90/A1 SDCR2/64GB)
>   cache_enabled=FALSE fua_enabled=false
> 
> It seems enabling the cache for SD cards causes the issue. Before the
> reverted commit, the cache was not reported enabled for SD cards. I am
> not sure whether such blunt revert is the correct solution however, any
> ideas ?

This does not disable the cache, it disables the block layer from issuing
cache flushes (by telling it there is no cache being used).

It would be good to know what commands are failing, which should be visible
in the kernel messages if dynamic debug is enabled:

Dynamic debug for mmc
---------------------

    Kernel must be configured:

        CONFIG_DYNAMIC_DEBUG=y

    To enable mmc debug via sysfs:

        echo 'file drivers/mmc/core/* +p' > /sys/kernel/debug/dynamic_debug/control
        echo 'file drivers/mmc/host/* +p' > /sys/kernel/debug/dynamic_debug/control

    To enable mmc debug via kernel command line:

        dyndbg="file drivers/mmc/core/* +p;file drivers/mmc/host/* +p"

    To disable mmc debug:

        echo 'file drivers/mmc/core/* -p' > /sys/kernel/debug/dynamic_debug/control
        echo 'file drivers/mmc/host/* -p' > /sys/kernel/debug/dynamic_debug/control

    More general information in kernel documentation in kernel tree:

        Documentation/admin-guide/dynamic-debug-howto.rst


> 
> Signed-off-by: Marek Vasut <marex@xxxxxxx>
> ---
> Cc: "Christian Löhle" <CLoehle@xxxxxxxxxxxxxx>
> Cc: Adrian Hunter <adrian.hunter@xxxxxxxxx>
> Cc: Avri Altman <avri.altman@xxxxxxx>
> Cc: Jens Axboe <axboe@xxxxxxxxx>
> Cc: Marek Vasut <marex@xxxxxxx>
> Cc: Michael Wu <michael@xxxxxxxxxxxxxxxxx>
> Cc: Ming Lei <ming.lei@xxxxxxxxxx>
> Cc: Seunghui Lee <sh043.lee@xxxxxxxxxxx>
> Cc: Ulf Hansson <ulf.hansson@xxxxxxxxxx>
> Cc: linux-mmc@xxxxxxxxxxxxxxx
> ---
>  drivers/mmc/core/block.c | 12 +++---------
>  1 file changed, 3 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c
> index db6d8a0999100..72aa47af11d37 100644
> --- a/drivers/mmc/core/block.c
> +++ b/drivers/mmc/core/block.c
> @@ -2413,8 +2413,6 @@ static struct mmc_blk_data *mmc_blk_alloc_req(struct mmc_card *card,
>  	struct mmc_blk_data *md;
>  	int devidx, ret;
>  	char cap_str[10];
> -	bool cache_enabled = false;
> -	bool fua_enabled = false;
>  
>  	devidx = ida_simple_get(&mmc_blk_ida, 0, max_devices, GFP_KERNEL);
>  	if (devidx < 0) {
> @@ -2494,17 +2492,13 @@ static struct mmc_blk_data *mmc_blk_alloc_req(struct mmc_card *card,
>  			md->flags |= MMC_BLK_CMD23;
>  	}
>  
> -	if (md->flags & MMC_BLK_CMD23 &&
> +	if (mmc_card_mmc(card) &&
> +	    md->flags & MMC_BLK_CMD23 &&
>  	    ((card->ext_csd.rel_param & EXT_CSD_WR_REL_PARAM_EN) ||
>  	     card->ext_csd.rel_sectors)) {
>  		md->flags |= MMC_BLK_REL_WR;
> -		fua_enabled = true;
> -		cache_enabled = true;
> +		blk_queue_write_cache(md->queue.queue, true, true);
>  	}
> -	if (mmc_cache_enabled(card->host))
> -		cache_enabled  = true;
> -
> -	blk_queue_write_cache(md->queue.queue, cache_enabled, fua_enabled);
>  
>  	string_get_size((u64)size, 512, STRING_UNITS_2,
>  			cap_str, sizeof(cap_str));




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

  Powered by Linux