Hi,

On 2024-10-20 22:51, Aurelien Jarno wrote:
Hi,

The swiotlb messages have been introduced by this upstream commits,
which has been backported in various stable branches:

commit 8396c793ffdf28bb8aee7cfe0891080f8cab7890
Author: Sam Protsenko <semen.protse...@linaro.org>
Date:   Wed Mar 6 17:20:52 2024 -0600

    mmc: dw_mmc: Fix IDMAC operation with pages bigger than 4K

You can try to build a kernel with it reverted to see if it also fixes
the corruption issue.

In the meantime, I am working on a patch.

Nice! I saw your patch, and I'm going to test it in a day or two (I have an unrelated $dayjob). I'll let you know.

Previously on this thread...

Hmm I am actually surprised that you are able to boot your system with
so many corruption. As the characters seems duplicated and the emmc bus
is a 8-bit one, it could be a timing issue between the emmc and the
controller. One thing to try is lowering the speed by removing the
highspeed capabilities from the device tree.

It worked! No more corruption. Lowering the speed doesn't have too much performance impact: using a simple dd test with bs=1M: before: 28MB/s, after: 20MB/s. The emmc chip is bought from orange pi, said to be capable of HS400, and it runs great as the boot drive for cfarm423.cfarm.net. So the throughput seems to be severely limited by CPU, and it's a small price to pay comparing to data corruption.

I do have another Pine64 Star64 8GB board. If you want to make a patch to send to upstream, I can test on Star64 as well, since cap-mmc-highspeed and mmc-hs200-1_8v are in jh7110-common.dtsi, and it will affect Star64 and Milk-V Mars too (but I don't have a Milk-V Mars board).

Lemme paste 3 pieces of kernel log here. mmcblk0 is the emmc here.
(unrelated: "Freeing initrd memory: 49556K" somehow takes more than 10 seconds on this board)

both sd card and emmc are installed, vanilla device tree:

[ 15.815390] dwmmc_starfive 16020000.mmc: IDMAC supports 32-bit address mode. [ 15.815463] dwmmc_starfive 16020000.mmc: Using internal DMA controller.
[   15.815484] dwmmc_starfive 16020000.mmc: Version ID is 290a
[ 15.815624] dwmmc_starfive 16020000.mmc: DW MMC controller at irq 38,32 bit host data width,32 deep fifo
[   15.815882] dwmmc_starfive 16020000.mmc: Got CD GPIO
[ 16.021586] mmc_host mmc1: Bus speed (slot 0) = 45511111Hz (slot req 400000Hz, actual 399220HZ div = 57)
...
[ 16.396485] mmc_host mmc1: Bus speed (slot 0) = 45511111Hz (slot req 50000000Hz, actual 45511111HZ div = 0)
[   16.396950] mmc1: new high speed SDXC card at address aaaa
[   16.444861] mmcblk1: mmc1:aaaa SR128 119 GiB
[   16.457041]  mmcblk1: p1
...
[ 17.048470] dwmmc_starfive 16010000.mmc: IDMAC supports 32-bit address mode. [ 17.048537] dwmmc_starfive 16010000.mmc: Using internal DMA controller.
[   17.048559] dwmmc_starfive 16010000.mmc: Version ID is 290a
[ 17.048706] dwmmc_starfive 16010000.mmc: DW MMC controller at irq 62,32 bit host data width,32 deep fifo
[   17.049341] mmc_host mmc0: card is non-removable.
...
[ 17.257588] mmc_host mmc0: Bus speed (slot 0) = 45511111Hz (slot req 400000Hz, actual 399220HZ div = 57) [ 17.608337] mmc_host mmc0: Bus speed (slot 0) = 45511111Hz (slot req 52000000Hz, actual 45511111HZ div = 0) [ 17.608424] mmc_host mmc0: Bus speed (slot 0) = 45511111Hz (slot req 100000000Hz, actual 45511111HZ div = 0)
[   17.652239] mmc0: new HS200 MMC card at address 0001
[   17.654631] mmcblk0: mmc0:0001 A3A564 233 GiB
[   17.662989]  mmcblk0: p1
[   17.665030] mmcblk0boot0: mmc0:0001 A3A564 4.00 MiB
[   17.671474] mmcblk0boot1: mmc0:0001 A3A564 4.00 MiB
[   17.676643] mmcblk0rpmb: mmc0:0001 A3A564 16.0 MiB, chardev (245:0)
...


Removing cap-mmc-highspeed and mmc-hs200-1_8v from m...@16010000.mmc:

[ 16.108557] dwmmc_starfive 16020000.mmc: IDMAC supports 32-bit address mode. [ 16.122625] dwmmc_starfive 16020000.mmc: Using internal DMA controller.
[   16.135744] dwmmc_starfive 16020000.mmc: Version ID is 290a
[ 16.139766] dwmmc_starfive 16020000.mmc: DW MMC controller at irq 36,32 bit host data width,32 deep fifo
[   16.150320] dwmmc_starfive 16020000.mmc: Got CD GPIO
...
[ 16.370098] mmc_host mmc1: Bus speed (slot 0) = 45511111Hz (slot req 400000Hz, actual 399220HZ div = 57) [ 16.904984] mmc_host mmc1: Bus speed (slot 0) = 45511111Hz (slot req 50000000Hz, actual 45511111HZ div = 0)
[   16.915598] mmc1: new high speed SDXC card at address aaaa
[   16.971392] mmcblk1: mmc1:aaaa SR128 119 GiB
[   17.100619]  mmcblk1: p1
...
[ 17.683130] dwmmc_starfive 16010000.mmc: IDMAC supports 32-bit address mode. [ 17.690297] dwmmc_starfive 16010000.mmc: Using internal DMA controller.
[   17.696988] dwmmc_starfive 16010000.mmc: Version ID is 290a
[ 17.702698] dwmmc_starfive 16010000.mmc: DW MMC controller at irq 62,32 bit host data width,32 deep fifo
[   17.713205] mmc_host mmc0: card is non-removable.
...
[ 17.926100] mmc_host mmc0: Bus speed (slot 0) = 45511111Hz (slot req 400000Hz, actual 399220HZ div = 57) [ 18.245335] mmc_host mmc0: Bus speed (slot 0) = 45511111Hz (slot req 25000000Hz, actual 22755555HZ div = 1)
[   18.255853] mmc0: new MMC card at address 0001
[   18.262920] mmcblk0: mmc0:0001 A3A564 233 GiB
[   18.276554]  mmcblk0: p1
[   18.281168] mmcblk0boot0: mmc0:0001 A3A564 4.00 MiB
[   18.292896] mmcblk0boot1: mmc0:0001 A3A564 4.00 MiB
[   18.303161] mmcblk0rpmb: mmc0:0001 A3A564 16.0 MiB, chardev (245:0)
[   20.076504] EXT4-fs (mmcblk0p1): orphan cleanup on readonly fs
[ 20.086008] EXT4-fs (mmcblk0p1): mounted filesystem 06521a7d-c765-47e2-9d76-95af2fd5f933 ro with ordered data mode. Quota mode: none.
...


However, removing only mmc-hs200-1_8v will cause I/O error, and the mmc_host driver seems to be confused:

[ 15.848996] dwmmc_starfive 16020000.mmc: IDMAC supports 32-bit address mode. [ 15.849071] dwmmc_starfive 16020000.mmc: Using internal DMA controller.
[   15.849092] dwmmc_starfive 16020000.mmc: Version ID is 290a
[ 15.849161] dwmmc_starfive 16020000.mmc: DW MMC controller at irq 38,32 bit host data width,32 deep fifo
[   15.849422] dwmmc_starfive 16020000.mmc: Got CD GPIO
[ 16.055595] mmc_host mmc1: Bus speed (slot 0) = 45511111Hz (slot req 400000Hz, actual 399220HZ div = 57)
...
[ 16.526561] mmc_host mmc1: Bus speed (slot 0) = 45511111Hz (slot req 50000000Hz, actual 45511111HZ div = 0)
[   16.527095] mmc1: new high speed SDXC card at address aaaa
[   16.581133] mmcblk1: mmc1:aaaa SR128 119 GiB
[   16.745566]  mmcblk1: p1
...
[ 17.058868] dwmmc_starfive 16010000.mmc: IDMAC supports 32-bit address mode. [ 17.058936] dwmmc_starfive 16010000.mmc: Using internal DMA controller.
[   17.058957] dwmmc_starfive 16010000.mmc: Version ID is 290a
[ 17.059059] dwmmc_starfive 16010000.mmc: DW MMC controller at irq 62,32 bit host data width,32 deep fifo
[   17.059913] mmc_host mmc0: card is non-removable.
...
[ 17.267613] mmc_host mmc0: Bus speed (slot 0) = 45511111Hz (slot req 400000Hz, actual 399220HZ div = 57) [ 17.586657] mmc_host mmc0: Bus speed (slot 0) = 45511111Hz (slot req 52000000Hz, actual 45511111HZ div = 0)
[   17.587836] mmc0: new DDR MMC card at address 0001
[   17.590844] mmcblk0: mmc0:0001 A3A564 233 GiB
[ 17.979638] mmc_host mmc0: Bus speed (slot 0) = 81919999Hz (slot req 400000Hz, actual 397669HZ div = 103) [ 18.254838] mmc_host mmc0: Bus speed (slot 0) = 81919999Hz (slot req 52000000Hz, actual 40959999HZ div = 1)
[   18.263718]  mmcblk0: p1
[   18.265785] mmcblk0boot0: mmc0:0001 A3A564 4.00 MiB
[   18.276811] mmcblk0boot1: mmc0:0001 A3A564 4.00 MiB
[   18.282619] mmcblk0rpmb: mmc0:0001 A3A564 16.0 MiB, chardev (245:0)
[   22.150792] EXT4-fs (mmcblk1p1): orphan cleanup on readonly fs
[ 22.154444] EXT4-fs (mmcblk1p1): mounted filesystem 1aed1397-d718-47ae-8529-5e03e17b1d21 ro with ordered data mode. Quota mode: none.
...
[ 30.019636] mmc_host mmc0: Bus speed (slot 0) = 81919999Hz (slot req 400000Hz, actual 397669HZ div = 103) [ 30.283902] mmc_host mmc0: Bus speed (slot 0) = 81919999Hz (slot req 52000000Hz, actual 40959999HZ div = 1) [ 30.324910] I/O error, dev mmcblk0, sector 17016 op 0x0:(READ) flags 0x80700 phys_seg 49 prio class 0 [ 30.359866] I/O error, dev mmcblk0, sector 17144 op 0x0:(READ) flags 0x80700 phys_seg 33 prio class 0 [ 30.369855] I/O error, dev mmcblk0, sector 17192 op 0x0:(READ) flags 0x80700 phys_seg 27 prio class 0 [ 30.387459] I/O error, dev mmcblk0, sector 17272 op 0x0:(READ) flags 0x80700 phys_seg 17 prio class 0 [ 30.397539] I/O error, dev mmcblk0, sector 17320 op 0x0:(READ) flags 0x80700 phys_seg 11 prio class 0 [ 30.402496] I/O error, dev mmcblk0, sector 17336 op 0x0:(READ) flags 0x80700 phys_seg 9 prio class 0 [ 30.417071] I/O error, dev mmcblk0, sector 17384 op 0x0:(READ) flags 0x80700 phys_seg 3 prio class 0 [ 30.419111] I/O error, dev mmcblk0, sector 17392 op 0x0:(READ) flags 0x80700 phys_seg 2 prio class 0 [ 30.421018] I/O error, dev mmcblk0, sector 17400 op 0x0:(READ) flags 0x80700 phys_seg 1 prio class 0 [ 30.639584] mmc_host mmc0: Bus speed (slot 0) = 81919999Hz (slot req 400000Hz, actual 397669HZ div = 103) [ 30.911948] mmc_host mmc0: Bus speed (slot 0) = 81919999Hz (slot req 52000000Hz, actual 40959999HZ div = 1) [ 30.913021] I/O error, dev mmcblk0, sector 17192 op 0x0:(READ) flags 0x0 phys_seg 1 prio class 0 [ 30.917407] Buffer I/O error on dev mmcblk0p1, logical block 101, async page read
...
[ 337.983701] mmc_host mmc0: Bus speed (slot 0) = 81919999Hz (slot req 400000Hz, actual 397669HZ div = 103) [ 338.256119] mmc_host mmc0: Bus speed (slot 0) = 81919999Hz (slot req 52000000Hz, actual 40959999HZ div = 1) [ 338.418167] I/O error, dev mmcblk0, sector 17144 op 0x0:(READ) flags 0x80700 phys_seg 139 prio class 0 [ 338.427760] I/O error, dev mmcblk0, sector 17192 op 0x0:(READ) flags 0x80700 phys_seg 133 prio class 0 [ 338.441890] I/O error, dev mmcblk0, sector 17264 op 0x0:(READ) flags 0x80700 phys_seg 124 prio class 0 [ 338.443428] I/O error, dev mmcblk0, sector 17272 op 0x0:(READ) flags 0x80700 phys_seg 123 prio class 0 [ 338.456114] I/O error, dev mmcblk0, sector 17336 op 0x0:(READ) flags 0x80700 phys_seg 115 prio class 0 [ 338.465384] I/O error, dev mmcblk0, sector 17368 op 0x0:(READ) flags 0x80700 phys_seg 111 prio class 0 [ 338.468482] I/O error, dev mmcblk0, sector 17384 op 0x0:(READ) flags 0x80700 phys_seg 109 prio class 0 [ 338.470030] I/O error, dev mmcblk0, sector 17392 op 0x0:(READ) flags 0x80700 phys_seg 108 prio class 0 [ 338.471551] I/O error, dev mmcblk0, sector 17400 op 0x0:(READ) flags 0x80700 phys_seg 107 prio class 0 [ 338.903702] mmc_host mmc0: Bus speed (slot 0) = 81919999Hz (slot req 400000Hz, actual 397669HZ div = 103) [ 339.162919] mmc_host mmc0: Bus speed (slot 0) = 81919999Hz (slot req 52000000Hz, actual 40959999HZ div = 1) [ 339.163980] I/O error, dev mmcblk0, sector 17192 op 0x0:(READ) flags 0x0 phys_seg 1 prio class 0 [ 339.165270] Buffer I/O error on dev mmcblk0p1, logical block 101, async page read [ 339.167350] Buffer I/O error on dev mmcblk0p1, logical block 101, async page read
...




--
Jing Luo
About me: https://jing.rocks/about/
GPG Fingerprint: 4E09 8D19 00AA 3F72 1899 2614 09B3 316E 13A1 1EFC

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to