Edited at

[メモ] RaspberryPi: microSDのクロックアップとベンチマーク

More than 1 year has passed since last update.


まとめ



  • Sandisk Extreme microSDHC 16GB Read:74.34MB/s / Write:53.58MB/s (Win7_64 + CrystalDiskBenchにて))


    RPi3

    Overlay config                      core_freq   turbo   overclock_50    WRITE        READ        HDPARM
    
    400 0 50.000 MHz 20.85 MB/s 21.91 MB/s 22.15 MB/s
    dtoverlay=sdtweak,overclock_50=100 400 0 100.000 MHz 22.89 MB/s 34.67 MB/s 34.58 MB/s


    RPi2にて

    Overlay config                      core_freq   turbo   overclock_50    WRITE        READ        HDPARM
    
    250 0 50.000 MHz 20.55 MB/s 21.71 MB/s 21.93 MB/s
    dtoverlay=sdhost,overclock_50=63 250 0 62.500 MHz 22.64 MB/s 26.75 MB/s 27.09 MB/s
    dtoverlay=sdhost,overclock_50=84 250 0 83.333 MHz 22.98 MB/s 34.88 MB/s 35.41 MB/s


    ASUS_TinkerBoard(参考)

    Overlay config                      core_freq   turbo   mmc0:BusSpeed   WRITE        READ        HDPARM
    
    ??? ? 148.500 MHz 45.88 MB/s 50.97 MB/s 43.67 MB/s




概要


  • らずぱいでの microSDのベンチマークでも... と、ぐーぐる先生にお尋ねしてたら、らずぱいで、SDのクロックアップできるよ、という記事を発見。

  • > How to overclock the microSD card reader on a Raspberry Pi 3


  • /boot/config.txtを書き換えるだけ。

  • だが、正常に動作しないのもある。(起動できても、計測中におかしくなるのもあった)


  • core_freqを整数で割ったクロックをSDに提供できる、っぽい。


    • RPi3 : core_freq=400なので、overclock_50= 100/80/67/58/50あたり

    • RPi0,1,2: core_freq=250なので、overclock_50= 100/84/63/50あたり



  • RPi2/3とも、READで1.6倍くらい(21->34MB/s)、Writeで 1.1倍(21->23MB/s)速くなった。(うちにある一番速いmicroSDを使って、ベンチマークテストの上では..)


環境


  • Raspberry Pi 3 クーリングファン付

  • Raspberry Pi 2 ヒートシンク付 (SanDisk Extremeのみ計測)


  • Raspbian: 2017-03-02-raspbian-jessie-lite.img (アップデート無し)



    1. sshwpa_supplicant.conf(Wifi設定)をbootパーティションへ

    2. 起動直後: sudo apt-get update && sudo apt-get install -y hdparm curl build-essential




  • config.txtで、sdをクロックアップ



    • sudo bash -c 'printf "dtoverlay=sdhost,overclock_50=100\n" >> /boot/config.txt'

      Wifiがおかしいとき(??)、


    • sudo bash -c 'printf "dtoverlay=sdtweak,overclock_50=100\n" >> /boot/config.txt'


      overclocking~~~というのが出てくる

      pi@raspberrypi:~ $ dmesg | grep mmc0
      
      [ 0.879166] mmc0: sdhost-bcm2835 loaded - DMA enabled (>1)
      [ 0.936907] mmc0: host does not support reading read-only switch, assuming write-enable
      [ 0.983164] mmc0: overclocking to 100000000Hz
      [ 0.985417] mmc0: new high speed SDHC card at address 0007
      [ 0.988083] mmcblk0: mmc0:0007 SD8GB 7.42 GiB
      pi@raspberrypi:~ $






テスト手順


  • Windows7 64bitで、CrystalDsiakMarkにて、microSDの速度を測る




  • curl http://www.nmacleod.com/public/sdbench.sh | sudo bash


    sdbench.sh

    ...
    
    HDCMD="hdparm -t --direct /dev/mmcblk0 | grep Timing"
    WRCMD="rm -f ${FILENM} && sync && dd if=/dev/zero of=${FILENM} bs=1M count=${DATAMB} conv=fsync 2>&1 | grep -v records"
    RDCMD="echo 3 > /proc/sys/vm/drop_caches && sync && dd if=${FILENM} of=/dev/null bs=1M 2>&1 | grep -v records"
    ...




結果



  • Kingston Digital 8 GB microSDHC Class 10 UHS-1 Memory Card 30MB/s with Adapter (SDC10/8GB)




    RPi3

    Overlay config                      core_freq   turbo   overclock_50    WRITE        READ        HDPARM
    
    400 0 50.000 MHz 9.24 MB/s 18.73 MB/s 21.10 MB/s
    dtoverlay=sdtweak,overclock_50=100 400 0 100.000 MHz 8.17 MB/s 19.00 MB/s 21.07 MB/s





  • PiZEROのセットを買ったときついてきたmicroSD (Ultimate 3.0 70MB/s 8GB とかいてある)


    リードは 70MB/s超えてるんだけどね...


    RPi3

    Overlay config                      core_freq   turbo   overclock_50    WRITE        READ        HDPARM
    
    400 0 50.000 MHz 7.05 MB/s 20.39 MB/s 21.10 MB/s
    dtoverlay=sdtweak,overclock_50=100 400 0 100.000 MHz 7.18 MB/s 30.39 MB/s 28.81 MB/s





  • Sandisk Extreme MICROSDHC 16GB 90MB/S Flash Memory Card(たぶん..)




    RPi3

    Overlay config                      core_freq   turbo   overclock_50    WRITE        READ        HDPARM
    
    400 0 50.000 MHz 20.85 MB/s 21.91 MB/s 22.15 MB/s
    dtoverlay=sdtweak,overclock_50=100 400 0 100.000 MHz 22.89 MB/s 34.67 MB/s 34.58 MB/s


    RPi2にて

    Overlay config                      core_freq   turbo   overclock_50    WRITE        READ        HDPARM
    
    250 0 50.000 MHz 20.55 MB/s 21.71 MB/s 21.93 MB/s
    dtoverlay=sdhost,overclock_50=63 250 0 62.500 MHz 22.64 MB/s 26.75 MB/s 27.09 MB/s
    dtoverlay=sdhost,overclock_50=84 250 0 83.333 MHz 22.98 MB/s 34.88 MB/s 35.41 MB/s





  • Samsung Electronics 32GB EVO Micro SDHC UHS-I Upto 48MB/s Class 10 Memory Card (MB-MP32D)




    RPi3

    Overlay config                      core_freq   turbo   overclock_50    WRITE        READ        HDPARM
    
    400 0 50.000 MHz 18.16 MB/s 21.56 MB/s 21.76 MB/s
    dtoverlay=sdtweak,overclock_50=80 400 0 80.000 MHz 18.98 MB/s 23.35 MB/s 24.47 MB/s


    • 100MHz設定では、カードエラーがでて正常動作しなかった。




その他



  • 追記2017-0411: RPi3 + SanDiskExtreme16GBにて、overclock_50=134=> 133.33MHzは、だめだった(133,125とトライして、100MHzまでおちる)


    overclock_50=134...はだめだった

    pi@raspberrypi:~ $ grep overclock_50 /boot/config.txt 
    
    dtoverlay=sdtweak,overclock_50=134
    pi@raspberrypi:~ $ dmesg | grep mmc0
    [ 0.878893] mmc0: sdhost-bcm2835 loaded - DMA enabled (>1)
    [ 0.956086] mmc0: host does not support reading read-only switch, assuming write-enable
    [ 0.985908] mmc0: overclocking to 133333333Hz
    [ 0.988111] mmc0: unexpected command 55 error
    [ 0.990268] mmc0: reducing overclock due to errors
    [ 0.992463] mmc0: overclocking to 125000000Hz
    [ 0.994536] mmc0: unexpected command 55 error
    [ 0.996580] mmc0: reducing overclock due to errors
    [ 0.998689] mmc0: overclocking to 100000000Hz
    [ 1.002811] mmc0: new high speed SDHC card at address aaaa
    [ 1.005335] mmcblk0: mmc0:aaaa SE16G 14.8 GiB
    pi@raspberrypi:~ $




  • おまけ: ASUS Tinker Board にて : 20170330-tinker-board-linaro-jessie-alip-v1.6.img使用

    Overlay config                      core_freq   turbo   overclock_50    WRITE        READ        HDPARM
    
    0 0 45.88 MB/s 50.97 MB/s 43.67 MB/s
    ----
    Linux linaro-alip 4.4.16 #1 SMP Thu Mar 30 22:22:19 CST 2017 armv7l GNU/Linux
    [ 2.998529] mmc_host mmc0: Bus speed (slot 0) = 148500000Hz (slot req 150000000Hz, actual 148500000HZ div = 0)


    らずぱいと同じスクリプトを実行したので、それっぽいとこでエラーでてるが、測定値はOK、かと。

    sudo apt-get update && sudo apt-get install -y hdparm curl build-essential
    
    curl http://www.nmacleod.com/public/sdbench.sh | sudo bash
    dmesg | grep mmc0
    uname -a
    ...
    ...
    ...
    grep: /boot/config.txt: No such file or directory
    bash: line 46: vcgencmd: command not found
    bash: line 47: vcgencmd: command not found
    bash: line 48: vcgencmd: command not found
    cat: /sys/devices/system/cpu/cpufreq/ondemand/io_is_busy: No such file or directory
    CONFIG:
    CLOCK :
    CORE : MHz, turbo=
    DATA : 512 MB, /root/test.dat

    HDPARM:
    ======
    Timing O_DIRECT disk reads: 128 MB in 3.04 seconds = 42.05 MB/sec
    Timing O_DIRECT disk reads: 132 MB in 3.02 seconds = 43.70 MB/sec
    Timing O_DIRECT disk reads: 136 MB in 3.01 seconds = 45.15 MB/sec

    WRITE:
    =====
    536870912 bytes (537 MB) copied, 11.2337 s, 47.8 MB/s
    536870912 bytes (537 MB) copied, 11.0605 s, 48.5 MB/s
    536870912 bytes (537 MB) copied, 11.1862 s, 48.0 MB/s

    READ:
    ====
    536870912 bytes (537 MB) copied, 10.2028 s, 52.6 MB/s
    536870912 bytes (537 MB) copied, 11.2799 s, 47.6 MB/s
    536870912 bytes (537 MB) copied, 8.92718 s, 60.1 MB/s

    RESULT (AVG):
    ============
    Overlay config core_freq turbo overclock_50 WRITE READ HDPARM
    0 0 45.88 MB/s 50.97 MB/s 43.67 MB/s
    linaro@linaro-alip:~$ dmesg | grep mmc0
    [ 2.897976] mmc_host mmc0: Bus speed (slot 0) = 400000Hz (slot req 400000Hz, actual 400000HZ div = 0)
    [ 2.998529] mmc_host mmc0: Bus speed (slot 0) = 148500000Hz (slot req 150000000Hz, actual 148500000HZ div = 0)
    [ 3.689367] mmc0: new ultra high speed SDR104 SDHC card at address aaaa
    [ 3.692071] mmcblk0: mmc0:aaaa SE16G 14.8 GiB
    linaro@linaro-alip:~$ uname -a
    Linux linaro-alip 4.4.16 #1 SMP Thu Mar 30 22:22:19 CST 2017 armv7l GNU/Linux
    linaro@linaro-alip:~$