1. Mar 15, 2022
    • Amit Kumar Mahapatra's avatar
      mtd: tests: Fix eraseblock read speed miscalculation for lower partition sizes · ceef4cf9
      Amit Kumar Mahapatra authored
      
      
      While calculating speed during  mtd_speedtest, the time interval
      (i.e., start - finish) is rounded off to the nearest milliseconds by
      ignoring the fractional part. This leads to miscalculation of speed.
      The miscalculation is more visible while running speed test on small
      partition sizes(i.e., when partition size is equal to eraseblock size or
      twice the eraseblock size) at higher spi frequencies.
      
      For e.g., while calculating eraseblock read speed for a mtd partition with
      size equal to the eraseblock size(i.e., 64KiB) the eraseblock read time
      interval comes out to be 966490 nanosecond. This is then converted to
      millisecond(i.e., 0.966 msec.). The integer part (i.e., 0 msec) of the
      value is considered and the fractional part (i.e., 0.966) is ignored,for
      calculating the eraseblock read speed. So the reported eraseblock read
      speed is 0 KiB/s, which is incorrect.
      
      There are two approaches to fix this issue.
      
      First approach will be to keep the time interval in millisecond. and round
      up the integer value, with this approach the 0.966msec time interval in the
      above example will be rounded up to 1msec and this value is used for
      calculating the speed. Downside of this approach is that the reported speed
      is still not accurate.
      
      Second approach will be to convert the time interval to microseconds
      instead of milliseconds, with this approach the 966490 nanosecond time
      interval in the above example will be converted t0 966.490usec and this
      value is used for calculating the speed. As compared to the current
      implementation and the suggested First approach, this approach will report
      a more accurate speed. Downside of this approach is that, in future if the
      mtd size is too large then the u64 variable, that holds the number of
      bytes, might overflow.
      
      In this patch we have gone with the second approach as this reports a more
      accurate speed. With this approach the eraseblock read speed in the above
      example comes out to be 132505 KiB/s when the spi clock is configured at
      150Mhz.
      
      Signed-off-by: default avatarAmit Kumar Mahapatra <amit.kumar-mahapatra@xilinx.com>
      Signed-off-by: default avatarMiquel Raynal <miquel.raynal@bootlin.com>
      Link: https://lore.kernel.org/linux-mtd/20220208103905.13354-1-amit.kumar-mahapatra@xilinx.com
      ceef4cf9
  2. Feb 18, 2022
  3. Feb 10, 2022
  4. Feb 09, 2022
  5. Feb 07, 2022
  6. Feb 01, 2022
  7. Jan 26, 2022
    • David Decotigny's avatar
      mtd_blkdevs: avoid soft lockups with some mtd/spi devices · ca6263a0
      David Decotigny authored
      
      
      With some spi devices, the heavy cpu usage due to polling the spi
      registers may lead to netdev timeouts, RCU complaints, etc. This can
      be acute in the absence of CONFIG_PREEMPT. This patch allows to give
      enough breathing room to avoid those incorrectly detected netdev
      timeouts for example.
      
      Example splat on 5.10.92:
      [  828.399306] rcu: INFO: rcu_sched self-detected stall on CPU
      ...
      [  828.419245] Task dump for CPU 1:
      [  828.422465] task:kworker/1:1H    state:R  running task on cpu   1   stack:    0 pid:   76 ppid:     2 flags:0x0000002a
      [  828.433132] Workqueue: kblockd blk_mq_run_work_fn
      [  828.437820] Call trace:
      ...
      [  828.512267]  spi_mem_exec_op+0x4d0/0xde0
      [  828.516184]  spi_mem_dirmap_read+0x180/0x39c
      [  828.520443]  spi_nor_read_data+0x428/0x7e8
      [  828.524523]  spi_nor_read+0x154/0x214
      [  828.528172]  mtd_read_oob+0x440/0x714
      [  828.531815]  mtd_read+0xac/0x120
      [  828.535030]  mtdblock_readsect+0x178/0x230
      [  828.539102]  mtd_blktrans_work+0x9fc/0xf28
      [  828.543177]  mtd_queue_rq+0x1ac/0x2e4
      [  828.546827]  blk_mq_dispatch_rq_list+0x2cc/0xa44
      [  828.551419]  blk_mq_do_dispatch_sched+0xb0/0x7cc
      [  828.556010]  __blk_mq_sched_dispatch_requests+0x350/0x494
      [  828.561372]  blk_mq_sched_dispatch_requests+0xac/0xe4
      [  828.566387]  __blk_mq_run_hw_queue+0x130/0x254
      [  828.570806]  blk_mq_run_work_fn+0x50/0x60
      [  828.574814]  process_one_work+0x578/0xf1c
      [  828.578814]  worker_thread+0x5dc/0xea0
      [  828.582547]  kthread+0x270/0x2d4
      [  828.585765]  ret_from_fork+0x10/0x30
      
      Signed-off-by: default avatarDavid Decotigny <ddecotig@google.com>
      Reviewed-by: default avatarRichard Weinberger <richard@nod.at>
      Signed-off-by: default avatarMiquel Raynal <miquel.raynal@bootlin.com>
      Link: https://lore.kernel.org/linux-mtd/20220126101120.676021-1-decot+git@google.com
      ca6263a0
  8. Jan 23, 2022