New kernel patch brings 120MB/s SATA Write-Speed with Banana Pi's

I’ve published a new kernel patch that brings 120MB/s SATA Write-Speed with Banana Pi’s. Currently tested only on Banana Pi M1 and Banana Pi R1 (aka Lamobo R1). Details: https://lkml.org/lkml/2019/5/10/600 It should work on all devices that use the ahci_sunxi SATA/AHCI driver.

Some follow-up info on this patch: http://lkml.iu.edu/hypermail/linux/kernel/1905.1/03266.html

For my BPI-R1, the optimal blocksize for dd seems to be 12KiB (12 * 1024 = 12288 Bytes) as these test results indicate. With it even 132 MiB/s write-speed is achieved. Attached is also the used test script:

$ cat find_opt_bs_for_dd.sh


#!/bin/bash

# set this; partition (here /dev/sda1) must already be mounted:
DIR=/mnt/sda1/test
N=3

mkdir -p $DIR
cd $DIR

function do_test_dd_write_sub()
{
  for (( i = 1; i <= N; i++ )); do
    echo "" ; echo "------------ bs=$1 count=$2 i=$i ------------------"

   #time sh -c "dd if=/dev/zero of=test.tmp bs=$1 count=$2 conv=fdatasync"
   #time sh -c "dd if=/dev/zero of=test.tmp bs=$1 count=$2 conv=fsync"
   #time sh -c "dd if=/dev/zero of=test.tmp bs=$1 count=$2 conv=sync"
    time sh -c "dd if=/dev/zero of=test.tmp bs=$1 count=$2"

  done
  sync
}

function do_test_dd_write()
{
  rm test*.tmp 2&>/dev/null 
  do_test_dd_write_sub $1 $2  2>&1 | tee -a test_dd_write_output.txt
  rm test*.tmp 2&>/dev/null
}

rm test_dd_write_output.txt
#
do_test_dd_write   512  4M
do_test_dd_write   1K   2M
do_test_dd_write   2K   1M
do_test_dd_write   4K   512K
do_test_dd_write   6K   342K
do_test_dd_write   8K   256K
do_test_dd_write   10K  205K
do_test_dd_write   12K  171K
do_test_dd_write   14K  147K
do_test_dd_write   16K  128K
do_test_dd_write   18K  114K
do_test_dd_write   20K  103K
do_test_dd_write   32K  64K
do_test_dd_write   64K  32K
do_test_dd_write   128K 16K
do_test_dd_write   256K 8K
do_test_dd_write   512K 4K
do_test_dd_write   1M   2K
do_test_dd_write   2M   1K

And the output (excerpt):


...
------------ bs=12K count=171K i=1 ------------------
175104+0 records in
175104+0 records out
2151677952 bytes (2.2 GB) copied, 15.9983 s, 134 MB/s

real    0m16.009s
user    0m0.227s
sys     0m15.043s

------------ bs=12K count=171K i=2 ------------------
175104+0 records in
175104+0 records out
2151677952 bytes (2.2 GB) copied, 16.3208 s, 132 MB/s

real    0m17.314s
user    0m0.238s
sys     0m16.456s

------------ bs=12K count=171K i=3 ------------------
175104+0 records in
175104+0 records out
2151677952 bytes (2.2 GB) copied, 16.3042 s, 132 MB/s

real    0m17.320s
user    0m0.176s
sys     0m16.377s

...

Check iozone application … btw. nice catch. I did few testings with my fastest SATA drive:

Patch is already implemented in armbian.

1 Like

Thanks! Appreciate much.

I’ve posted a v2 of the patch with some comment texts, but there is no change in the code itself: http://lkml.iu.edu/hypermail/linux/kernel/1905.1/03581.html

And I’ll in a few hours post also a v3, again w/o changes to the code, but required for the formal process of getting it merged into the mainline linux kernel.

And here are some other initial reactions in the media (and more is on the way):

1 Like

Recently also phoronix.com has brought a news article about this patch: https://www.phoronix.com/scan.php?page=news_item&px=Faster-Allwinner-SATA-Patch

Hey guys, I can confirm with the new Armbian Bionic image we can read/write around 120 MB/s on SSD drive.

My tests with iperf3 PC <-> Banana M1 result in around 500 Mbit/s - 700 Mbit/s.

Unfortunately samba is just around 30 MB/s read /write and ftp is even slower write around 10 MB/s and read around 25 MB/s. In both test CPU usage between 50%-70%, so still air to the top.

Any ideas how to improve samba and ftp?

I forget how much one can squeeze from Samba optimisations … Do some searching on armbian forum. There has been some articles on the topic.