[PATCH 0/2] Measure read while write latency

Miquel Raynal miquel.raynal at bootlin.com
Thu Nov 10 07:59:36 PST 2022


Macronix SPI-NOR flashes have Read-While-Write (RWW) capabilities. When programming/erasing big chunks of data, a subsequent read would take ages before being executed. If the area accessed by the read is not on the same bank of the program or erase, the read may just happen during the programming step (the bus being the bottleneck). Let's add a way to measure the latency gain with an additional flash_speed test.

By providing '-b <x> -k <y> -c <z> --destructive', reads will be attempted on blocks [y; y+z] just after starting writes on blocks [x; x+z]. The test tool gives the total time of the operation (close to making a write then a read, serially) as well as the time when the read was over. If the device does not support the RWW feature, or if the reads and writes target the same bank, the read will end last at the end of the full operation. Otherwise, when the RWW feature is leveraged, the read ends much earlier.

Example with a Macronix MX25UW51245G with bank and RWW support:

     // Testing the two accesses in the same bank
     $ flash_speed -b0 -k0 -c10 -d /dev/mtd0
     [...]
     testing read while write latency
     read while write took 51ms, read ended after 51ms

     // Testing the two accesses within different banks
     $ flash_speed -b0 -k4096 -c10 -d /dev/mtd0
     [...]
     testing read while write latency
     read while write took 51ms, read ended after 20ms

Thanks,
Miquèl

Miquel Raynal (2):
  mtd-utils: flash_speed: Rework the time counting helpers
  mtd-utils: flash_speed: Measure read while write latency

 tests/mtd-tests/Makemodule.am |   5 +-
 tests/mtd-tests/flash_speed.c | 165 ++++++++++++++++++++++++++++++----
 2 files changed, 150 insertions(+), 20 deletions(-)

-- 
2.34.1




More information about the linux-mtd mailing list