I came across something rather strange. We have a custom update method where we can load a u-boot image from eMMC to RAM in u-boot and update the module. But we noticed very slow speeds in certain cases on the Colibri T30 module.
Example:
The first 1-128Mb takes 6.7seconds to read.
The 129th MB takes 3 seconds to read.
The 130th MB takes 3 seconds to read.
etc...
MX-4 T30 # load mmc 0:4 0x80408000 /boot/10M
10485760 bytes read in 617 ms (16.2 MiB/s)
MX-4 T30 # load mmc 0:4 0x80408000 /boot/50M
52428800 bytes read in 2685 ms (18.6 MiB/s)
MX-4 T30 # load mmc 0:4 0x80408000 /boot/50M
52428800 bytes read in 2685 ms (18.6 MiB/s)
MX-4 T30 # load mmc 0:4 0x80408000 /boot/100M
104857600 bytes read in 5294 ms (18.9 MiB/s)
MX-4 T30 # load mmc 0:4 0x80408000 /boot/100M
104857600 bytes read in 5293 ms (18.9 MiB/s)
MX-4 T30 # load mmc 0:4 0x80408000 /boot/120M
125829120 bytes read in 6317 ms (19 MiB/s)
MX-4 T30 # load mmc 0:4 0x80408000 /boot/125M
131072000 bytes read in 6638 ms (18.8 MiB/s)
MX-4 T30 # load mmc 0:4 0x80408000 /boot/127M
133169152 bytes read in 6704 ms (18.9 MiB/s)
MX-4 T30 # load mmc 0:4 0x80408000 /boot/128M
134217728 bytes read in 6748 ms (19 MiB/s)
MX-4 T30 # load mmc 0:4 0x80408000 /boot/129M
135266304 bytes read in 9178 ms (14.1 MiB/s)
MX-4 T30 # load mmc 0:4 0x80408000 /boot/129M
135266304 bytes read in 9178 ms (14.1 MiB/s)
MX-4 T30 # load mmc 0:4 0x80408000 /boot/130M
136314880 bytes read in 12502 ms (10.4 MiB/s)
MX-4 T30 # load mmc 0:4 0x80408000 /boot/130M
136314880 bytes read in 12502 ms (10.4 MiB/s)
MX-4 T30 # load mmc 0:4 0x80408000 /boot/140M
146800640 bytes read in 45437 ms (3.1 MiB/s)
MX-4 T30 # load mmc 0:4 0x80408000 /boot/150M
157286400 bytes read in 78252 ms (1.9 MiB/s)
If the file is larger then 128 MB it starts to slow down, 128 MB does feel very aligned and that we are crossing some boundary in RAM or somewhere else.
I also know that you split up the rootfs image in your update.sh to 64MB chunks but I could not find an explanation why this is done, and is probably related to my issue.
I can see the same effect. My speed is a bit slower likely because I used an older module with a slower eMMC.
Colibri T30 # load mmc 0:2 $loadaddr /home/root/256M 6400000
104857600 bytes read in 9459 ms (10.6 MiB/s)
Colibri T30 # load mmc 0:2 $loadaddr /home/root/256M 8000000
134217728 bytes read in 11332 ms (11.3 MiB/s)
Colibri T30 # load mmc 0:2 $loadaddr /home/root/256M 8100000
135266304 bytes read in 13969 ms (9.2 MiB/s)
Colibri T30 # load mmc 0:2 $loadaddr /home/root/256M 8c00000
146800640 bytes read in 53206 ms (2.6 MiB/s)
When I do the same from a FAT formatted SD card:
Colibri T30 # load mmc 1:1 $loadaddr 256M 6400000
reading 256M
104857600 bytes read in 6664 ms (15 MiB/s)
Colibri T30 # load mmc 1:1 $loadaddr 256M 8000000
reading 256M
134217728 bytes read in 8525 ms (15 MiB/s)
Colibri T30 # load mmc 1:1 $loadaddr 256M 8100000
reading 256M
135266304 bytes read in 8591 ms (15 MiB/s)
Colibri T30 # load mmc 1:1 $loadaddr 256M 8c00000
reading 256M
146800640 bytes read in 9341 ms (15 MiB/s)
When I do the same from a ext3 formatted SD card:
Colibri T30 # load mmc 1:3 $loadaddr 256M a00000
10485760 bytes read in 660 ms (15.2 MiB/s)
Colibri T30 # load mmc 1:3 $loadaddr 256M 6400000
104857600 bytes read in 6145 ms (16.3 MiB/s)
Colibri T30 # load mmc 1:3 $loadaddr 256M 8000000
134217728 bytes read in 7848 ms (16.3 MiB/s)
Colibri T30 # load mmc 1:3 $loadaddr 256M 8100000
135266304 bytes read in 10404 ms (12.4 MiB/s)
Colibri T30 # load mmc 1:3 $loadaddr 256M 8c00000
146800640 bytes read in 48279 ms (2.9 MiB/s)
Both ext3 partitions on the eMMC and the SD card are formatted with a block size of 1024 bytes.
So my conclusion is that the U-Boot extfs drivers performs slower when a certain limit is reached.
We update the rootfs in junks of 64MB because the rootfs might get bigger than the available RAM. 64MB is small enough for all our modules.
I made some more tests on the platform Mirza talked about above.
I tested an external SD-card and USB-stick, and ext4 with different block-sizes clearly have problem at some point.
4Gb SD-card with ext4, (mkfs.ext4 -b 1024) (decrease performance when reading file >16M !)
MX-4 T30 # load mmc 1:1 0x80408000 10M
10485760 bytes read in 529 ms (18.9 MiB/s)
MX-4 T30 # load mmc 1:1 0x80408000 12M
12582912 bytes read in 651 ms (18.4 MiB/s)
MX-4 T30 # load mmc 1:1 0x80408000 14M
14680064 bytes read in 757 ms (18.5 MiB/s)
MX-4 T30 # load mmc 1:1 0x80408000 16M
16777216 bytes read in 863 ms (18.5 MiB/s)
MX-4 T30 # load mmc 1:1 0x80408000 18M
18874368 bytes read in 62864 ms (293 KiB/s)
MX-4 T30 # load mmc 1:1 0x80408000 20M
20971520 bytes read in 70528 ms (290 KiB/s)
4Gb SD-card with ext4, (mkfs.ext4 -b 4096) (decrease performance when reading file >512M !)
MX-4 T30 # load mmc 1:1 0x80408000 128M
134217728 bytes read in 6300 ms (20.3 MiB/s)
MX-4 T30 # load mmc 1:1 0x80408000 129M
135266304 bytes read in 6311 ms (20.4 MiB/s)
MX-4 T30 # load mmc 1:1 0x80408000 150M
157286400 bytes read in 7286 ms (20.6 MiB/s)
MX-4 T30 # load mmc 1:1 0x80408000 200M
209715200 bytes read in 9678 ms (20.7 MiB/s)
MX-4 T30 # load mmc 1:1 0x80408000 300M
314572800 bytes read in 14527 ms (20.7 MiB/s)
MX-4 T30 # load mmc 1:1 0x80408000 400M
419430400 bytes read in 19326 ms (20.7 MiB/s)
MX-4 T30 # load mmc 1:1 0x80408000 512M
536870912 bytes read in 24751 ms (20.7 MiB/s)
MX-4 T30 # load mmc 1:1 0x80408000 520M
545259520 bytes read in 478606 ms (1.1 MiB/s)
4Gb SD-card with ext3, (mkfs.ext3 -b 1024) (decrease performance when reading file >128M !)
MX-4 T30 # load mmc 1:1 0x80408000 16M
16777216 bytes read in 1242 ms (12.9 MiB/s)
MX-4 T30 # load mmc 1:1 0x80408000 17M
17825792 bytes read in 1331 ms (12.8 MiB/s)
MX-4 T30 # load mmc 1:1 0x80408000 128M
134217728 bytes read in 9750 ms (13.1 MiB/s)
MX-4 T30 # load mmc 1:1 0x80408000 129M
135266304 bytes read in 12372 ms (10.4 MiB/s)
4Gb SD-card with ext3, (mkfs.ext3 -b 4096) (No problem at all)
MX-4 T30 # load mmc 1:1 0x80408000 128M
134217728 bytes read in 6273 ms (20.4 MiB/s)
MX-4 T30 # load mmc 1:1 0x80408000 129M
135266304 bytes read in 6338 ms (20.4 MiB/s)
MX-4 T30 # load mmc 1:1 0x80408000 512M
536870912 bytes read in 25015 ms (20.5 MiB/s)
MX-4 T30 # load mmc 1:1 0x80408000 513M
537919488 bytes read in 25085 ms (20.4 MiB/s)
MX-4 T30 # load mmc 1:1 0x80408000 520M
545259520 bytes read in 25435 ms (20.4 MiB/s)
USB-stick vfat-formatted (No problem at all)
MX-4 T30 # fatload usb 0:1 0x80408000 100M
reading 100M
104857600 bytes read in 3593 ms (27.8 MiB/s)
MX-4 T30 # fatload usb 0:1 0x80408000 128M
reading 128M
134217728 bytes read in 4600 ms (27.8 MiB/s)
MX-4 T30 # fatload usb 0:1 0x80408000 130M
reading 130M
157286400 bytes read in 5378 ms (27.9 MiB/s)
MX-4 T30 # fatload usb 0:1 0x80408000 200M
reading 200M
209715200 bytes read in 7172 ms (27.9 MiB/s)
MX-4 T30 # fatload usb 0:1 0x80408000 300M
reading 300M
314572800 bytes read in 10745 ms (27.9 MiB/s)
MX-4 T30 # fatload usb 0:1 0x80408000 400M
reading 400M
419430400 bytes read in 14320 ms (27.9 MiB/s)
MX-4 T30 # fatload usb 0:1 0x80408000 512M
reading 512M
536870912 bytes read in 18337 ms (27.9 MiB/s)
MX-4 T30 # fatload usb 0:1 0x80408000 600M
reading 600M
629145600 bytes read in 21471 ms (27.9 MiB/s)