Re: [PATCH 1/1] mmc: mmc_spi: Enable stable writes

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

 



On Wed, 23 Oct 2013, Andreas wrote:
> Hello,
> 
> While using the mmc_spi driver occasionally errors like this popped up:
> 
> mmcblk0: error -84 transferring data
> end_request: I/O error, dev mmcblk0, sector 581756
> 
> I looked on the Internet for occurences of the same problem and came across a helpful post [1]. It includes source code to reproduce the bug. There is also an analysis about the cause. During transmission data in the supplied buffer is beeing modified. Thus the previously calculated check sum is not correct anymore.
> 
> After some digging I found out that device drivers are supposed to report they need stable writes.  To fix this I set the appropriate flag at queue initialization if CRC checksumming is enabled for that SPI host.
> 
> [1]
> https://groups.google.com/forum/#!msg/sim1/gLlzWeXGFr8/KevXinUXfc8J
> 
> Signed-off-by: Andreas Koop <andreas.koop <at> zf.com>
> ---
> --
> --
> 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
> 
> diff --git a/drivers/mmc/card/queue.c b/drivers/mmc/card/queue.c
> index fa9632e..3fdef37 100644
> --- a/drivers/mmc/card/queue.c
> +++ b/drivers/mmc/card/queue.c
> @@ -207,6 +207,9 @@ int mmc_init_queue(struct mmc_queue *mq, struct mmc_card *card,
>  	mq->mqrq_prev = mqrq_prev;
>  	mq->queue->queuedata = mq;
>  
> +	if (mmc_host_is_spi(host) && host->use_spi_crc)
> +		mq->queue->backing_dev_info.capabilities |= BDI_CAP_STABLE_WRITES;
> +
>  	blk_queue_prep_rq(mq->queue, mmc_prep_request);
>  	queue_flag_set_unlocked(QUEUE_FLAG_NONROT, mq->queue);
>  	if (mmc_can_erase(card))

Tested-by: ShihPo Hung <shihpo.hung@xxxxxxxxxx>

Although this is an old patch, I encountered the same problem which could be fixed by it.

On Hifive Unleashed board (a multicore environment), running LTP fcntl36
with /tmp located on /dev/mmcblk could trigger ILSEQ in mmc_spi_writeblock()
and then cause mmc device removed.

Error log:
  tst_test.c:1096: INFO: Timeout per run is 0h 05m 00s
  fcntl36.c:304: INFO: OFD read lock vs OFD write lock
  fcntl36.c:382: PASS: Access between threads synchronized
  fcntl36.c:304: INFO: OFD write lock vs POSIX write lock
  fcntl36.c:382: PASS: Access between threads synchronized
  fcntl36.c:304: INFO: OFD read lock vs POSIX write lock
  mmc0: SPI card removed
  EXT4-fs warning (device mmcblk0p2): ext4_end_bio:323: I/O error 10
  Buffer I/O error on device mmcblk0p2, logical block 1084426
  EXT4-fs warning (device mmcblk0p2): ext4_end_bio:323: I/O error 10
  Buffer I/O error on device mmcblk0p2, logical block 1084427
  EXT4-fs warning (device mmcblk0p2): ext4_end_bio:323: I/O error 10
  Buffer I/O error on device mmcblk0p2, logical block 2129920
  EXT4-fs warning (device mmcblk0p2): ext4_end_bio:323: I/O error 10
  Buffer I/O error on device mmcblk0p2, logical block 1082369
  EXT4-fs warning (device mmcblk0p2): ext4_end_bio:323: I/O error 10
  Buffer I/O error on device mmcblk0p2, logical block 1084941
  Buffer I/O error on device mmcblk0p2, logical block 1084942
  Buffer I/O error on device mmcblk0p2, logical block 1084943
  Buffer I/O error on device mmcblk0p2, logical block 1084944
  Buffer I/O error on device mmcblk0p2, logical block 1084945
  Buffer I/O error on device mmcblk0p2, logical block 1084946

The problem is that the data page is dirty again while it is in the
process of writeback, then the CRC calculated by mmc_spi_writeblock()
is not valid.

I would like to send a v2 which rebases this patch on v5.3-rc1 to help
it upstream.



[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