BELK-AN-010: NAND performances

From DAVE Developer's Wiki
Jump to: navigation, search
Info Box
Bora5-small.jpg Applies to Bora
BORA Xpress.png Applies to BORA Xpress


Warning-icon.png This application note was validated against specific versions of the kit only. It may not work with other versions. Supported versions are listed in the History section. Warning-icon.png

History[edit | edit source]

Version Date BELK version Notes
1.0.0 Apr 2022 BELK 4.1.4 First release

Introduction[edit | edit source]

Generally speaking, sometimes it is worth evaluating the NAND storage performances in order to understand the expected R/W throughput using this kind of storage component. For this purpose, it is easy to use the well known mtd-utils user-space tools properly designed for stressing and evaluating the MTDs (Memory Technologie Device).

This application note shows, for instance, how to run some mtd utilities on the Bora/BoraX platform. The BELK/BXELK kit was used for this purposes.

Test bed[edit | edit source]

In this AN, the BXELK was used and the SD card with BXELK_4.1.5 software binaries installed.

The mtd-utils include a set of test programs which you may run to verify your flash hardware and drivers. The programs are user space and available as kernel modules.

mtd_speedtest[edit | edit source]

The first mtd-utils application tested is the mtd_speedtest: this kernel module measures and reports read/write/erase speed of the MTD device.

Here below the utility running on BXELK and the related NAND speed test results:

Here below the kernel bootlog from the SD card (collapsed):


U-Boot SPL 2017.01-belk-4.1.5 (Sep 24 2021 - 00:16:38)
mmc boot
Trying to boot from MMC1
reading fpga.bit
reading fpga.bit
  design filename = "borax_wrapper;UserID=0XFFFFFFFF;Version=2017.1"
  part number = "7z030sbg485"
  date = "2017/07/11"
  time = "16:53:21"
  bytes in bitstream = 5979916
zynq_align_dma_buffer: Align buffer at 400006d to 3ffff80(swap 1)
reading u-boot.img
reading u-boot.img


U-Boot 2017.01-belk-4.1.5 (Sep 24 2021 - 00:16:38 +0200), Build: belk-4.1.5

Model: Bora
Board: Xilinx Zynq
I2C:   ready
DRAM:  ECC disabled 1 GiB
Relocating to 3ff14000, new gd at 3ead3ee8, sp at 3ead3ec0
NAND:  1024 MiB
MMC:   sdhci@e0100000: 0 (SD)
reading bora.env
In:    serial@e0001000
Out:   serial@e0001000
Err:   serial@e0001000
Model: Bora
Board: Xilinx Zynq
SF: Detected s25fl128s_64k with page size 256 Bytes, erase size 64 KiB, total 16 MiB
SF: Detected s25fl128s_64k with page size 256 Bytes, erase size 64 KiB, total 16 MiB
SOM ConfigID#: 00000006
SOM UniqueID#: 3a12db08:32291263
ds2431_readmem(): error in chip reset
ds2431_readmem(): error in reading buffer
ds2431_readmem(): error in chip reset
ds2431_readmem(): error in reading buffer
CB ConfigID CRC mismatch for 0x00000000 (was 0x00000000, expected 0x2144df1c) at block 3 (offset 96): using default
CB ConfigID#: ffffffff
CB UniqueID#: 00000000:00000000
SF: Detected s25fl128s_64k with page size 256 Bytes, erase size 64 KiB, total 16 MiB

Warning: ethaddr MAC addresses don't match:
Address in SROM is         00:50:c2:1e:af:ec
Address in environment is  00:50:C2:1E:AF:CB
Net:   ZYNQ GEM: e000b000, phyaddr 7, interface rgmii-id
eth0: ethernet@e000b000
Hit ENTER within 3 seconds to stop autoboot
starting USB...
USB0:   USB EHCI 1.00
scanning bus 0 for devices... 1 USB Device(s) found
       scanning usb for storage devices... 0 Storage Device(s) found

USB device 0: unknown device
** Bad device usb 0 **
switch to partitions #0, OK
mmc0 is current device
reading boot.scr
471 bytes read in 9 ms (50.8 KiB/s)
Running bootscript from mmc ...
## Executing script at 02080000
bootscript generated with command "mkimage -A ARM -T script -C none -n BELK -d bootscript.txt boot.scr" 
reading uImage
3796224 bytes read in 218 ms (16.6 MiB/s)
reading bora.dtb
10105 bytes read in 14 ms (704.1 KiB/s)
Booting Bora/BoraX via mmc
## Error: "configid_fixup" not defined
## Booting kernel from Legacy Image at 02080000 ...
   Image Name:   Linux-4.9.0-belk-4.1.4-xilinx
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    3796160 Bytes = 3.6 MiB
   Load Address: 00008000
   Entry Point:  00008000
   Verifying Checksum ... OK
## Flattened Device Tree blob at 02000000
   Booting using the fdt blob at 0x2000000
   Loading Kernel Image ... OK
   Loading Device Tree to 1effa000, end 1efff778 ... OK
Switching to NAND storage before starting Linux

Starting kernel ...

Uncompressing Linux... done, booting the kernel.
[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Linux version 4.9.0-belk-4.1.4-xilinx (jenkins@linuxserver2) (gcc version 6.2.1 20161016 (Linaro GCC 6.2-2016.11) ) #1 SMP PREEMPT Wed Jun 16 23:11:51 CEST 2021
[    0.000000] CPU: ARMv7 Processor [413fc090] revision 0 (ARMv7), cr=18c5387d
[    0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
[    0.000000] OF: fdt:Machine model: Bora
[    0.000000] bootconsole [earlycon0] enabled
[    0.000000] cma: Reserved 16 MiB at 0x3f000000
[    0.000000] Memory policy: Data cache writealloc
[    0.000000] On node 0 totalpages: 262144
[    0.000000] free_area_init_node: node 0, pgdat c0a2ddc0, node_mem_map ef7f7000
[    0.000000]   Normal zone: 1536 pages used for memmap
[    0.000000]   Normal zone: 0 pages reserved
[    0.000000]   Normal zone: 196608 pages, LIFO batch:31
[    0.000000]   HighMem zone: 65536 pages, LIFO batch:15
[    0.000000] percpu: Embedded 14 pages/cpu @ef7d2000 s26124 r8192 d23028 u57344
[    0.000000] pcpu-alloc: s26124 r8192 d23028 u57344 alloc=14*4096
[    0.000000] pcpu-alloc: [0] 0 [0] 1 
[    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 260608
[    0.000000] Kernel command line: root=/dev/mmcblk0p2 rootwait rw console=ttyPS0,115200n8 debug earlyprintk
[    0.000000] PID hash table entries: 4096 (order: 2, 16384 bytes)
[    0.000000] Dentry cache hash table entries: 131072 (order: 7, 524288 bytes)
[    0.000000] Inode-cache hash table entries: 65536 (order: 6, 262144 bytes)
[    0.000000] Memory: 1012740K/1048576K available (6144K kernel code, 234K rwdata, 1532K rodata, 1024K init, 323K bss, 19452K reserved, 16384K cma-reserved, 245760K highmem)
[    0.000000] Virtual kernel memory layout:
[    0.000000]     vector  : 0xffff0000 - 0xffff1000   (   4 kB)
[    0.000000]     fixmap  : 0xffc00000 - 0xfff00000   (3072 kB)
[    0.000000]     vmalloc : 0xf0800000 - 0xff800000   ( 240 MB)
[    0.000000]     lowmem  : 0xc0000000 - 0xf0000000   ( 768 MB)
[    0.000000]     pkmap   : 0xbfe00000 - 0xc0000000   (   2 MB)
[    0.000000]     modules : 0xbf000000 - 0xbfe00000   (  14 MB)
[    0.000000]       .text : 0xc0008000 - 0xc0700000   (7136 kB)
[    0.000000]       .init : 0xc0900000 - 0xc0a00000   (1024 kB)
[    0.000000]       .data : 0xc0a00000 - 0xc0a3aa38   ( 235 kB)
[    0.000000]        .bss : 0xc0a3aa38 - 0xc0a8b834   ( 324 kB)
[    0.000000] Preemptible hierarchical RCU implementation.
[    0.000000] 	Build-time adjustment of leaf fanout to 32.
[    0.000000] 	RCU restricting CPUs from NR_CPUS=4 to nr_cpu_ids=2.
[    0.000000] RCU: Adjusting geometry for rcu_fanout_leaf=32, nr_cpu_ids=2
[    0.000000] NR_IRQS:16 nr_irqs:16 16
[    0.000000] efuse mapped to f0802000
[    0.000000] slcr mapped to f0804000
[    0.000000] L2C: platform modifies aux control register: 0x02060000 -> 0x02460000
[    0.000000] L2C: DT/platform modifies aux control register: 0x02060000 -> 0x02460000
[    0.000000] L2C-310 erratum 769419 enabled
[    0.000000] L2C-310 enabling early BRESP for Cortex-A9
[    0.000000] L2C-310 full line of zeros enabled for Cortex-A9
[    0.000000] L2C-310 dynamic clock gating enabled, standby mode enabled
[    0.000000] L2C-310 cache controller enabled, 8 ways, 512 kB
[    0.000000] L2C-310: CACHE_ID 0x410000c8, AUX_CTRL 0x46460001
[    0.000000] zynq_clock_init: clkc starts at f0804100
[    0.000000] Zynq clock init
[    0.000000] ps_clk frequency not specified, using 33 MHz.
[    0.000012] sched_clock: 64 bits at 333MHz, resolution 3ns, wraps every 4398046511103ns
[    0.007870] clocksource: arm_global_timer: mask: 0xffffffffffffffff max_cycles: 0x4ce07af025, max_idle_ns: 440795209040 ns
[    0.018887] Switching to timer-based delay loop, resolution 3ns
[    0.024887] clocksource: ttc_clocksource: mask: 0xffff max_cycles: 0xffff, max_idle_ns: 537538477 ns
[    0.033937] timer #0 at f080c000, irq=17
[    0.038267] Console: colour dummy device 80x30
[    0.042598] Calibrating delay loop (skipped), value calculated using timer frequency.. 666.66 BogoMIPS (lpj=3333333)
[    0.053078] pid_max: default: 32768 minimum: 301
[    0.057860] Mount-cache hash table entries: 2048 (order: 1, 8192 bytes)
[    0.064361] Mountpoint-cache hash table entries: 2048 (order: 1, 8192 bytes)
[    0.071995] CPU: Testing write buffer coherency: ok
[    0.076908] CPU0: thread -1, cpu 0, socket 0, mpidr 80000000
[    0.082500] Setting up static identity map for 0x100000 - 0x100058
[    0.258339] CPU1: thread -1, cpu 1, socket 0, mpidr 80000001
[    0.258441] Brought up 2 CPUs
[    0.266980] SMP: Total of 2 processors activated (1333.33 BogoMIPS).
[    0.273359] CPU: All CPU(s) started in SVC mode.
[    0.278930] devtmpfs: initialized
[    0.285136] VFP support v0.3: implementor 41 architecture 3 part 30 variant 9 rev 4
[    0.292895] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.303516] pinctrl core: initialized pinctrl subsystem
[    0.309880] NET: Registered protocol family 16
[    0.316031] DMA: preallocated 256 KiB pool for atomic coherent allocations
[    0.358398] cpuidle: using governor ladder
[    0.398351] cpuidle: using governor menu
[    0.415168] hw-breakpoint: found 5 (+1 reserved) breakpoint and 1 watchpoint registers.
[    0.423043] hw-breakpoint: maximum watchpoint size is 4 bytes.
[    0.429006] zynq-ocm f800c000.ocmc: ZYNQ OCM pool: 256 KiB @ 0xf0880000
[    0.435864] zynq-pinctrl 700.pinctrl: zynq pinctrl initialized
[    0.455311] vgaarb: loaded
[    0.458544] SCSI subsystem initialized
[    0.462517] usbcore: registered new interface driver usbfs
[    0.467938] usbcore: registered new interface driver hub
[    0.473329] usbcore: registered new device driver usb
[    0.478517] pps_core: LinuxPPS API ver. 1 registered
[    0.483354] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
[    0.493239] PTP clock support registered
[    0.498839] clocksource: Switched to clocksource arm_global_timer
[    0.519371] NET: Registered protocol family 2
[    0.524435] TCP established hash table entries: 8192 (order: 3, 32768 bytes)
[    0.531510] TCP bind hash table entries: 8192 (order: 4, 65536 bytes)
[    0.537945] TCP: Hash tables configured (established 8192 bind 8192)
[    0.544260] UDP hash table entries: 512 (order: 2, 16384 bytes)
[    0.550201] UDP-Lite hash table entries: 512 (order: 2, 16384 bytes)
[    0.556657] NET: Registered protocol family 1
[    0.561360] RPC: Registered named UNIX socket transport module.
[    0.567142] RPC: Registered udp transport module.
[    0.571907] RPC: Registered tcp transport module.
[    0.576602] RPC: Registered tcp NFSv4.1 backchannel transport module.
[    0.583072] PCI: CLS 0 bytes, default 64
[    0.587594] hw perfevents: enabled with armv7_cortex_a9 PMU driver, 7 counters available
[    0.597248] futex hash table entries: 512 (order: 3, 32768 bytes)
[    0.604159] workingset: timestamp_bits=30 max_order=18 bucket_order=0
[    0.611202] jffs2: version 2.2. (NAND) (SUMMARY)  © 2001-2006 Red Hat, Inc.
[    0.619048] bounce: pool size: 64 pages
[    0.622769] io scheduler noop registered
[    0.626723] io scheduler deadline registered
[    0.631067] io scheduler cfq registered (default)
[    0.638330] dma-pl330 f8003000.dmac: Loaded driver for PL330 DMAC-241330
[    0.644920] dma-pl330 f8003000.dmac: 	DBUFF-128x8bytes Num_Chans-8 Num_Peri-4 Num_Events-16
[    0.654014] e0000000.serial: ttyPS1 at MMIO 0xe0000000 (irq = 145, base_baud = 3125000) is a xuartps
[    0.663460] e0001000.serial: ttyPS0 at MMIO 0xe0001000 (irq = 146, base_baud = 3125000) is a xuartps
à[    0.672589] console [ttyPS0] enabled
[    0.672589] console [ttyPS0] enabled
[    0.679683] bootconsole [earlycon0] disabled
[    0.679683] bootconsole [earlycon0] disabled
[    0.688922] xdevcfg f8007000.devcfg: ioremap 0xf8007000 to f086f000
[    0.695821] [drm] Initialized
[    0.711833] brd: module loaded
[    0.722267] loop: module loaded
[    0.727603] libphy: Fixed MDIO Bus: probed
[    0.734652] libphy: mdio_driver_register: xgmiitorgmii
[    0.739854] CAN device driver interface
[    0.746139] libphy: MACB_mii_bus: probed
[    0.849827] macb e000b000.ethernet eth0: Cadence GEM rev 0x00020118 at 0xe000b000 irq 148 (00:50:c2:1e:af:cb)
[    0.859695] Micrel KSZ9031 Gigabit PHY e000b000.etherne:07: attached PHY driver [Micrel KSZ9031 Gigabit PHY] (mii_bus:phy_addr=e000b000.etherne:07, irq=-1)
[    0.873876] e1000e: Intel(R) PRO/1000 Network Driver - 3.2.6-k
[    0.879651] e1000e: Copyright(c) 1999 - 2015 Intel Corporation.
[    0.886554] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    0.893052] ehci-pci: EHCI PCI platform driver
[    0.897586] usbcore: registered new interface driver usb-storage
[    0.903782] e0002000.usb supply vbus not found, using dummy regulator
[    0.910483] ULPI transceiver vendor/product ID 0x0424/0x0006
[    0.916056] Found SMSC USB331x ULPI transceiver.
[    0.920692] ULPI integrity check: passed.
[    0.926430] mousedev: PS/2 mouse device common for all mice
[    0.932372] i2c /dev entries driver
[    0.936050] cdns-i2c e0004000.i2c: 100 kHz mmio e0004000 irq 142
[    0.945765] rtc-ds3232 0-0068: rtc core: registered ds3232 as rtc0
[    0.953397] ina2xx 0-0041: power monitor ina226 (Rshunt = 10000 uOhm)
[    0.962418] cpufreq: cpufreq_online: CPU0: Running at unlisted freq: 666666 KHz
[    0.969709] cpufreq: cpufreq_online: CPU0: Unlisted initial frequency changed to: 666667 KHz
[    0.978239] Xilinx Zynq CpuIdle Driver started
[    0.983168] sdhci: Secure Digital Host Controller Interface driver
[    0.989291] sdhci: Copyright(c) Pierre Ossman
[    0.993602] sdhci-pltfm: SDHCI platform and OF driver helper
[    1.058901] mmc0: SDHCI controller on e0100000.sdhci [e0100000.sdhci] using DMA
[    1.066531] usbcore: registered new interface driver usbhid
[    1.073078] usbhid: USB HID core driver
[    1.080006] nand: device found, Manufacturer ID: 0xef, Chip ID: 0xd3
[    1.086271] nand: Unknown W29N08GV
[    1.089721] nand: 1024 MiB, SLC, erase size: 128 KiB, page size: 2048, OOB size: 64
[    1.097846] Bad block table found at page 524224, version 0x01
[    1.104579] Bad block table found at page 524160, version 0x01
[    1.119804] NET: Registered protocol family 17
[    1.124185] can: controller area network core (rev 20120528 abi 9)
[    1.130430] NET: Registered protocol family 29
[    1.134797] can: raw protocol (rev 20120528)
[    1.139086] can: broadcast manager protocol (rev 20161123 t)
[    1.144706] can: netlink gateway (rev 20130117) max_hops=1
[    1.150527] Registering SWP/SWPB emulation handler
[    1.162004] rtc-ds3232 0-0068: hctosys: unable to read the hardware clock
[    1.169489] Waiting for root device /dev/mmcblk0p2...
[    1.174556] mmc0: new high speed SDHC card at address 59b4
[    1.180560] mmcblk0: mmc0:59b4 USDU1 14.9 GiB 
[    1.186057]  mmcblk0: p1 p2
[    1.290952] EXT4-fs (mmcblk0p2): mounting ext3 file system using the ext4 subsystem
[    1.434073] random: fast init done
[    1.620531] EXT4-fs (mmcblk0p2): recovery complete
[    1.628729] EXT4-fs (mmcblk0p2): mounted filesystem with ordered data mode. Opts: (null)
[    1.636821] VFS: Mounted root (ext3 filesystem) on device 179:2.
[    1.648728] devtmpfs: mounted
[    1.654915] Freeing unused kernel memory: 1024K (c0900000 - c0a00000)
INIT: version 2.88 booting
Starting udev
[    2.513091] udevd[675]: starting version 3.2
[    2.544818] udevd[676]: starting eudev-3.2
[    2.672884] EXT4-fs (mmcblk0p2): re-mounted. Opts: (null)
Sun Aug  1 14:38:30 UTC 2021
INIT: Entering runlevel: 5
Configuring network interfaces... udhcpc (v1.24.1) started
Sending discover...
Sending discover...
Sending discover...
No lease, forking to background
done.
Starting system message bus: dbus.
Starting Dropbear SSH server: dropbear.
Starting rpcbind daemon...done.
starting statd: done
Starting atd: OK
exportfs: can't open /etc/exports for reading
NFS daemon support not enabled in kernel
Starting system log daemon...0
Starting kernel log daemon...0
Starting internet superserver: xinetd.
 * Starting Avahi mDNS/DNS-SD Daemon: avahi-daemon
[ ok ]
Starting crond: OK
Starting tcf-agent: OK

Poky (Yocto Project Reference Distro) 2.2.1 bora /dev/ttyPS0

bora login: root

and the utility running on BXELK and the related NAND speed test results:

root@bora:~# cat /proc/mtd
dev:    size   erasesize  name
mtd0: 40000000 00020000 "pl35x-nand"
root@bora:~# modprobe mtd_speedtest dev=0
[  125.495286] 
[  125.496709] =================================================
[  125.502492] mtd_speedtest: MTD device: 0
[  125.506346] mtd_speedtest: MTD device size 1073741824, eraseblock size 131072, page size 2048, count of eraseblocks 8192, pages per eraseblock 64, OOB size 64
[  125.521919] mtd_test: scanning for bad eraseblocks
[  125.532154] mtd_test: block 8188 is bad
[  125.535901] mtd_test: block 8189 is bad
[  125.539758] mtd_test: block 8190 is bad
[  125.543539] mtd_test: block 8191 is bad
[  125.547358] mtd_test: scanned 8192 eraseblocks, 4 are bad
[  130.530106] mtd_speedtest: testing eraseblock write speed
[  182.278909] random: crng init done
[  473.180264] mtd_speedtest: eraseblock write speed is 3058 KiB/s
[  473.186107] mtd_speedtest: testing eraseblock read speed
[  718.874429] mtd_speedtest: eraseblock read speed is 4265 KiB/s
[  731.721983] mtd_speedtest: testing page write speed
[ 1076.399004] mtd_speedtest: page write speed is 3040 KiB/s
[ 1076.404321] mtd_speedtest: testing page read speed
[ 1322.557027] mtd_speedtest: page read speed is 4257 KiB/s
[ 1335.809758] mtd_speedtest: testing 2 page write speed
[ 1679.377761] mtd_speedtest: 2 page write speed is 3050 KiB/s
[ 1679.383274] mtd_speedtest: testing 2 page read speed
[ 1925.333787] mtd_speedtest: 2 page read speed is 4261 KiB/s
[ 1925.339215] mtd_speedtest: Testing erase speed
[ 1938.945565] mtd_speedtest: erase speed is 77057 KiB/s
[ 1938.950554] mtd_speedtest: Testing 2x multi-block erase speed
[ 1943.929607] mtd_speedtest: 2x multi-block erase speed is 210750 KiB/s
[ 1943.935966] mtd_speedtest: Testing 4x multi-block erase speed
[ 1948.909550] mtd_speedtest: 4x multi-block erase speed is 211005 KiB/s
[ 1948.915909] mtd_speedtest: Testing 8x multi-block erase speed
[ 1953.887062] mtd_speedtest: 8x multi-block erase speed is 211090 KiB/s
[ 1953.893433] mtd_speedtest: Testing 16x multi-block erase speed
[ 1958.863417] mtd_speedtest: 16x multi-block erase speed is 211132 KiB/s
[ 1958.869879] mtd_speedtest: Testing 32x multi-block erase speed
[ 1963.838783] mtd_speedtest: 32x multi-block erase speed is 211175 KiB/s
[ 1963.845239] mtd_speedtest: Testing 64x multi-block erase speed
[ 1968.813576] mtd_speedtest: 64x multi-block erase speed is 211218 KiB/s
[ 1968.820038] mtd_speedtest: finished
[ 1968.823496] =================================================
root@bora:~#