1. 30 9月, 2022 1 次提交
  2. 29 9月, 2022 1 次提交
  3. 27 9月, 2022 1 次提交
    • K
      blk-mq: use quiesced elevator switch when reinitializing queues · 8237c01f
      Keith Busch 提交于
      The hctx's run_work may be racing with the elevator switch when
      reinitializing hardware queues. The queue is merely frozen in this
      context, but that only prevents requests from allocating and doesn't
      stop the hctx work from running. The work may get an elevator pointer
      that's being torn down, and can result in use-after-free errors and
      kernel panics (example below). Use the quiesced elevator switch instead,
      and make the previous one static since it is now only used locally.
      
        nvme nvme0: resetting controller
        nvme nvme0: 32/0/0 default/read/poll queues
        BUG: kernel NULL pointer dereference, address: 0000000000000008
        #PF: supervisor read access in kernel mode
        #PF: error_code(0x0000) - not-present page
        PGD 80000020c8861067 P4D 80000020c8861067 PUD 250f8c8067 PMD 0
        Oops: 0000 [#1] SMP PTI
        Workqueue: kblockd blk_mq_run_work_fn
        RIP: 0010:kyber_has_work+0x29/0x70
      
      ...
      
        Call Trace:
         __blk_mq_do_dispatch_sched+0x83/0x2b0
         __blk_mq_sched_dispatch_requests+0x12e/0x170
         blk_mq_sched_dispatch_requests+0x30/0x60
         __blk_mq_run_hw_queue+0x2b/0x50
         process_one_work+0x1ef/0x380
         worker_thread+0x2d/0x3e0
      Signed-off-by: NKeith Busch <kbusch@kernel.org>
      Reviewed-by: NMing Lei <ming.lei@redhat.com>
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      Link: https://lore.kernel.org/r/20220927155652.3260724-1-kbusch@fb.comSigned-off-by: NJens Axboe <axboe@kernel.dk>
      8237c01f
  4. 24 9月, 2022 1 次提交
  5. 22 9月, 2022 1 次提交
  6. 06 9月, 2022 1 次提交
  7. 23 8月, 2022 1 次提交
  8. 20 8月, 2022 1 次提交
    • Y
      blk-mq: fix io hung due to missing commit_rqs · 65fac0d5
      Yu Kuai 提交于
      Currently, in virtio_scsi, if 'bd->last' is not set to true while
      dispatching request, such io will stay in driver's queue, and driver
      will wait for block layer to dispatch more rqs. However, if block
      layer failed to dispatch more rq, it should trigger commit_rqs to
      inform driver.
      
      There is a problem in blk_mq_try_issue_list_directly() that commit_rqs
      won't be called:
      
      // assume that queue_depth is set to 1, list contains two rq
      blk_mq_try_issue_list_directly
       blk_mq_request_issue_directly
       // dispatch first rq
       // last is false
        __blk_mq_try_issue_directly
         blk_mq_get_dispatch_budget
         // succeed to get first budget
         __blk_mq_issue_directly
          scsi_queue_rq
           cmd->flags |= SCMD_LAST
            virtscsi_queuecommand
             kick = (sc->flags & SCMD_LAST) != 0
             // kick is false, first rq won't issue to disk
       queued++
      
       blk_mq_request_issue_directly
       // dispatch second rq
        __blk_mq_try_issue_directly
         blk_mq_get_dispatch_budget
         // failed to get second budget
       ret == BLK_STS_RESOURCE
        blk_mq_request_bypass_insert
       // errors is still 0
      
       if (!list_empty(list) || errors && ...)
        // won't pass, commit_rqs won't be called
      
      In this situation, first rq relied on second rq to dispatch, while
      second rq relied on first rq to complete, thus they will both hung.
      
      Fix the problem by also treat 'BLK_STS_*RESOURCE' as 'errors' since
      it means that request is not queued successfully.
      
      Same problem exists in blk_mq_dispatch_rq_list(), 'BLK_STS_*RESOURCE'
      can't be treated as 'errors' here, fix the problem by calling
      commit_rqs if queue_rq return 'BLK_STS_*RESOURCE'.
      
      Fixes: d666ba98 ("blk-mq: add mq_ops->commit_rqs()")
      Signed-off-by: NYu Kuai <yukuai3@huawei.com>
      Reviewed-by: NMing Lei <ming.lei@redhat.com>
      Link: https://lore.kernel.org/r/20220726122224.1790882-1-yukuai1@huaweicloud.comSigned-off-by: NJens Axboe <axboe@kernel.dk>
      65fac0d5
  9. 18 8月, 2022 2 次提交
  10. 03 8月, 2022 3 次提交
  11. 22 7月, 2022 1 次提交
  12. 15 7月, 2022 1 次提交
  13. 06 7月, 2022 4 次提交
  14. 29 6月, 2022 1 次提交
  15. 28 6月, 2022 1 次提交
  16. 27 6月, 2022 5 次提交
  17. 22 6月, 2022 1 次提交
  18. 17 6月, 2022 4 次提交
  19. 30 5月, 2022 1 次提交
  20. 28 5月, 2022 3 次提交
  21. 23 5月, 2022 1 次提交
  22. 21 5月, 2022 1 次提交
  23. 12 5月, 2022 1 次提交
  24. 11 5月, 2022 1 次提交
  25. 28 4月, 2022 1 次提交
    • T
      Revert "block: inherit request start time from bio for BLK_CGROUP" · 4cddeaca
      Tejun Heo 提交于
      This reverts commit 00067077. It has a
      couple problems:
      
      * bio_issue_time() is stored in bio->bi_issue truncated to 51 bits. This
        overflows in slightly over 26 days. Setting rq->io_start_time_ns with it
        means that io duration calculation would yield >26days after 26 days of
        uptime. This, for example, confuses kyber making it cause high IO
        latencies.
      
      * rq->io_start_time_ns should record the time that the IO is issued to the
        device so that on-device latency can be measured. However,
        bio_issue_time() is set before the bio goes through the rq-qos controllers
        (wbt, iolatency, iocost), so when the bio gets throttled in any of the
        mechanisms, the measured latencies make no sense - on-device latencies end
        up higher than request-alloc-to-completion latencies.
      
      We'll need a smarter way to avoid calling ktime_get_ns() repeatedly
      back-to-back. For now, let's revert the commit.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Cc: stable@vger.kernel.org # v5.16+
      Link: https://lore.kernel.org/r/YmmeOLfo5lzc+8yI@slm.duckdns.orgSigned-off-by: NJens Axboe <axboe@kernel.dk>
      4cddeaca