Have SPI CRC error(-84) since tx buf is modified during SPI transfer

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

 



Hi,

I found if enabled multicore and used a Sandisk Extreme U3 A2 card as
root file system(ext4). Then, running 'stress-ng-aiol' (async I/O
test) would randomly cause SPI crc error in
./drivers/mmc/host/mmc_spi.c and ./drivers/spi/spi-sifive.c.

"mmcblk0: error -84 transferring data end_request: I/O error, dev
mmcblk0, sector"

After looking into the issue, I found the issue is the same as the
commit, "3a855b7ac7d5021674aa3e1cc9d3bfd6b604e9c0".(enable stable
write) The tx_buf is modified during the SPI transfer and causes the
SD card to fail to check CRC.

There are 2 ways I've tested:
a) Passing 'mmc_core.use_spi_crc=0' to the kernel
    This way can workaround the issue by disabling CRC check. It can
pass 'stress-ng-aiol' consistently.

b) Copy tx_buf before generating the crc and SPI transfer
    /* memcpy sg to another buffer in mmc_spi_data_do()*/
    memcpy(page_address(host->backup_pg) + sg->offset, sg_virt(sg), sg->length);

    This way also can fix the issue and pass the test. But it has low
performance.

Currently, neither of them is a reasonable fix to me. The previous
commit, 'enabling stable write', seems to fix some cases. Maybe it
means we should have other places being blocked before transfer is
done? I would appreciate any thoughts about where to go next.

Thanks,
-
Green



[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