1. 29 3月, 2023 1 次提交
  2. 12 12月, 2022 1 次提交
    • Y
      blk-mq: fix kabi broken due to request_wrapper · 31c285dd
      Yu Kuai 提交于
      hulk inclusion
      category: bugfix
      bugzilla: https://gitee.com/openeuler/kernel/issues/I65K8D
      CVE: NA
      
      --------------------------------
      
      Before commit f60df4a0 ("blk-mq: fix kabi broken in struct
      request"), drivers will got cmd address right after request, however,
      after this commit, drivers will got cmd address after request_wrapper
      instead, which is bigger than request and will cause compatibility
      issues.
      
      Fix the problem by placing request_wrapper behind cmd, so that the
      cmd address for drivers will stay the same.
      
      Before commit:		|request|cmd|
      After commit:		|request|request_wrapper|cmd|
      With this patch:	|request|cmd|request_wrapper|
      
      Performance test: arm64 Kunpeng-920 96 core
      
      1) null_blk setup:
      modprobe null_blk nr_devices=0 &&
          udevadm settle &&
          cd /sys/kernel/config/nullb &&
          mkdir nullb0 &&
          cd nullb0 &&
          echo 0 > completion_nsec &&
          echo 512 > blocksize &&
          echo 0 > home_node &&
          echo 0 > irqmode &&
          echo 1024 > size &&
          echo 0 > memory_backed &&
          echo 2 > queue_mode &&
      	echo 4096 > hw_queue_depth &&
      	echo 96 > submit_queues &&
          echo 1 > power
      
      2) fio test script:
      [global]
      ioengine=libaio
      direct=1
      numjobs=96
      iodepth=32
      bs=4k
      rw=randwrite
      allow_mounted_write=0
      time_based
      runtime=60
      group_reporting=1
      ioscheduler=none
      cpus_allowed_policy=split
      cpus_allowed=0-95
      
      [test]
      filename=/dev/nullb0
      
      3) iops test result:
      
      without this patch:	23.9M
      with this patch:	24.1M
      
      Fixes: f60df4a0 ("blk-mq: fix kabi broken in struct request")
      Signed-off-by: NYu Kuai <yukuai3@huawei.com>
      Reviewed-by: NHou Tao <houtao1@huawei.com>
      Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
      31c285dd
  3. 02 11月, 2022 3 次提交
  4. 13 7月, 2022 1 次提交
  5. 21 3月, 2022 1 次提交
  6. 08 3月, 2022 3 次提交
  7. 31 12月, 2021 1 次提交
  8. 15 11月, 2021 1 次提交
  9. 06 7月, 2021 1 次提交
  10. 27 1月, 2021 2 次提交
  11. 29 10月, 2020 1 次提交
  12. 04 9月, 2020 4 次提交
  13. 02 9月, 2020 1 次提交
  14. 29 7月, 2020 1 次提交
  15. 01 7月, 2020 1 次提交
  16. 30 6月, 2020 1 次提交
  17. 29 6月, 2020 1 次提交
  18. 24 6月, 2020 2 次提交
  19. 30 5月, 2020 2 次提交
    • M
      blk-mq: drain I/O when all CPUs in a hctx are offline · bf0beec0
      Ming Lei 提交于
      Most of blk-mq drivers depend on managed IRQ's auto-affinity to setup
      up queue mapping. Thomas mentioned the following point[1]:
      
      "That was the constraint of managed interrupts from the very beginning:
      
       The driver/subsystem has to quiesce the interrupt line and the associated
       queue _before_ it gets shutdown in CPU unplug and not fiddle with it
       until it's restarted by the core when the CPU is plugged in again."
      
      However, current blk-mq implementation doesn't quiesce hw queue before
      the last CPU in the hctx is shutdown.  Even worse, CPUHP_BLK_MQ_DEAD is a
      cpuhp state handled after the CPU is down, so there isn't any chance to
      quiesce the hctx before shutting down the CPU.
      
      Add new CPUHP_AP_BLK_MQ_ONLINE state to stop allocating from blk-mq hctxs
      where the last CPU goes away, and wait for completion of in-flight
      requests.  This guarantees that there is no inflight I/O before shutting
      down the managed IRQ.
      
      Add a BLK_MQ_F_STACKING and set it for dm-rq and loop, so we don't need
      to wait for completion of in-flight requests from these drivers to avoid
      a potential dead-lock. It is safe to do this for stacking drivers as those
      do not use interrupts at all and their I/O completions are triggered by
      underlying devices I/O completion.
      
      [1] https://lore.kernel.org/linux-block/alpine.DEB.2.21.1904051331270.1802@nanos.tec.linutronix.de/
      
      [hch: different retry mechanism, merged two patches, minor cleanups]
      Signed-off-by: NMing Lei <ming.lei@redhat.com>
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      Reviewed-by: NHannes Reinecke <hare@suse.de>
      Reviewed-by: NDaniel Wagner <dwagner@suse.de>
      Signed-off-by: NJens Axboe <axboe@kernel.dk>
      bf0beec0
    • K
      blk-mq: blk-mq: provide forced completion method · 7b11eab0
      Keith Busch 提交于
      Drivers may need to bypass error injection for error recovery. Rename
      __blk_mq_complete_request() to blk_mq_force_complete_rq() and export
      that function so drivers may skip potential fake timeouts after they've
      reclaimed lost requests.
      Signed-off-by: NKeith Busch <kbusch@kernel.org>
      Reviewed-by: NDaniel Wagner <dwagner@suse.de>
      Signed-off-by: NJens Axboe <axboe@kernel.dk>
      7b11eab0
  20. 25 4月, 2020 1 次提交
  21. 21 4月, 2020 1 次提交
  22. 19 4月, 2020 1 次提交
    • G
      blk-mq: Replace zero-length array with flexible-array member · f36aaf8b
      Gustavo A. R. Silva 提交于
      The current codebase makes use of the zero-length array language
      extension to the C90 standard, but the preferred mechanism to declare
      variable-length types such as these ones is a flexible array member[1][2],
      introduced in C99:
      
      struct foo {
              int stuff;
              struct boo array[];
      };
      
      By making use of the mechanism above, we will get a compiler warning
      in case the flexible array does not occur last in the structure, which
      will help us prevent some kind of undefined behavior bugs from being
      inadvertently introduced[3] to the codebase from now on.
      
      Also, notice that, dynamic memory allocations won't be affected by
      this change:
      
      "Flexible array members have incomplete type, and so the sizeof operator
      may not be applied. As a quirk of the original implementation of
      zero-length arrays, sizeof evaluates to zero."[1]
      
      This issue was found with the help of Coccinelle.
      
      [1] https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html
      [2] https://github.com/KSPP/linux/issues/21
      [3] commit 76497732 ("cxgb3/l2t: Fix undefined behaviour")
      Signed-off-by: NGustavo A. R. Silva <gustavo@embeddedor.com>
      f36aaf8b
  23. 28 3月, 2020 1 次提交
  24. 10 3月, 2020 1 次提交
  25. 14 11月, 2019 1 次提交
  26. 01 11月, 2019 1 次提交
  27. 26 10月, 2019 1 次提交
  28. 07 10月, 2019 2 次提交
  29. 06 9月, 2019 1 次提交
    • D
      block: Delay default elevator initialization · 737eb78e
      Damien Le Moal 提交于
      When elevator_init_mq() is called from blk_mq_init_allocated_queue(),
      the only information known about the device is the number of hardware
      queues as the block device scan by the device driver is not completed
      yet for most drivers. The device type and elevator required features
      are not set yet, preventing to correctly select the default elevator
      most suitable for the device.
      
      This currently affects all multi-queue zoned block devices which default
      to the "none" elevator instead of the required "mq-deadline" elevator.
      These drives currently include host-managed SMR disks connected to a
      smartpqi HBA and null_blk block devices with zoned mode enabled.
      Upcoming NVMe Zoned Namespace devices will also be affected.
      
      Fix this by adding the boolean elevator_init argument to
      blk_mq_init_allocated_queue() to control the execution of
      elevator_init_mq(). Two cases exist:
      1) elevator_init = false is used for calls to
         blk_mq_init_allocated_queue() within blk_mq_init_queue(). In this
         case, a call to elevator_init_mq() is added to __device_add_disk(),
         resulting in the delayed initialization of the queue elevator
         after the device driver finished probing the device information. This
         effectively allows elevator_init_mq() access to more information
         about the device.
      2) elevator_init = true preserves the current behavior of initializing
         the elevator directly from blk_mq_init_allocated_queue(). This case
         is used for the special request based DM devices where the device
         gendisk is created before the queue initialization and device
         information (e.g. queue limits) is already known when the queue
         initialization is executed.
      
      Additionally, to make sure that the elevator initialization is never
      done while requests are in-flight (there should be none when the device
      driver calls device_add_disk()), freeze and quiesce the device request
      queue before calling blk_mq_init_sched() in elevator_init_mq().
      Reviewed-by: NMing Lei <ming.lei@redhat.com>
      Signed-off-by: NDamien Le Moal <damien.lemoal@wdc.com>
      Signed-off-by: NJens Axboe <axboe@kernel.dk>
      737eb78e