Skip to content
  1. Jul 14, 2022
    • Ming Lei's avatar
      ublk_drv: add io_uring based userspace block driver · 71f28f31
      Ming Lei authored
      
      
      This is the driver part of userspace block driver(ublk driver), the other
      part is userspace daemon part(ublksrv)[1].
      
      The two parts communicate by io_uring's IORING_OP_URING_CMD with one
      shared cmd buffer for storing io command, and the buffer is read only for
      ublksrv, each io command is indexed by io request tag directly, and is
      written by ublk driver.
      
      For example, when one READ io request is submitted to ublk block driver,
      ublk driver stores the io command into cmd buffer first, then completes
      one IORING_OP_URING_CMD for notifying ublksrv, and the URING_CMD is issued
      to ublk driver beforehand by ublksrv for getting notification of any new
      io request, and each URING_CMD is associated with one io request by tag.
      
      After ublksrv gets the io command, it translates and handles the ublk io
      request, such as, for the ublk-loop target, ublksrv translates the request
      into same request on another file or disk, like the kernel loop block
      driver. In ublksrv's implementation, the io is still handled by io_uring,
      and share same ring with IORING_OP_URING_CMD command. When the target io
      request is done, the same IORING_OP_URING_CMD is issued to ublk driver for
      both committing io request result and getting future notification of new
      io request.
      
      Another thing done by ublk driver is to copy data between kernel io
      request and ublksrv's io buffer:
      
      1) before ubsrv handles WRITE request, copy the request's data into
         ublksrv's userspace io buffer, so that ublksrv can handle the write
         request
      
      2) after ubsrv handles READ request, copy ublksrv's userspace io buffer
         into this READ request, then ublk driver can complete the READ request
      
      Zero copy may be switched if mm is ready to support it.
      
      ublk driver doesn't handle any logic of the specific user space driver,
      so it is small/simple enough.
      
      [1] ublksrv
      
      https://github.com/ming1/ubdsrv
      
      Signed-off-by: default avatarMing Lei <ming.lei@redhat.com>
      Link: https://lore.kernel.org/r/20220713140711.97356-2-ming.lei@redhat.com
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      71f28f31
  2. Jul 13, 2022
    • Uros Bizjak's avatar
      blk-cgroup: Use atomic{,64}_try_cmpxchg · 96388f57
      Uros Bizjak authored
      
      
      Use atomic_try_cmpxchg instead of atomic_cmpxchg (*ptr, old, new) == old
      in blkcg_unuse_delay, blkcg_set_delay and blkcg_clear_delay and
      atomic64_try_cmpxchg in blkcg_scale_delay.  x86 CMPXCHG instruction
      returns success in ZF flag, so this change saves a compare after cmpxchg
      (and related move instruction in front of cmpxchg).
      
      Also, atomic_try_cmpxchg implicitly assigns old *ptr value to "old" when
      cmpxchg fails, enabling further code simplifications.
      
      No functional change intended.
      
      Signed-off-by: default avatarUros Bizjak <ubizjak@gmail.com>
      Cc: Jens Axboe <axboe@kernel.dk>
      Link: https://lore.kernel.org/r/20220712154455.66868-1-ubizjak@gmail.com
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      96388f57
    • Uros Bizjak's avatar
      blk-iolatency: Use atomic{,64}_try_cmpxchg · aee8960c
      Uros Bizjak authored
      
      
      Use atomic_try_cmpxchg instead of atomic_cmpxchg (*ptr, old, new) == old
      in check_scale_change and atomic64_try_cmpxchg in blkcg_iolatency_done_bio.
      x86 CMPXCHG instruction returns success in ZF flag, so this change saves a
      compare after cmpxchg (and related move instruction in front of cmpxchg).
      
      No functional change intended.
      
      Signed-off-by: default avatarUros Bizjak <ubizjak@gmail.com>
      Cc: Jens Axboe <axboe@kernel.dk>
      Link: https://lore.kernel.org/r/20220712151947.6783-1-ubizjak@gmail.com
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      aee8960c
    • Uros Bizjak's avatar
      block: Use try_cmpxchg in update_io_ticks · 939f9dd0
      Uros Bizjak authored
      
      
      Use try_cmpxchg instead of cmpxchg (*ptr, old, new) == old in
      update_io_ticks. x86 CMPXCHG instruction returns success in ZF flag,
      so this change saves a compare after cmpxchg (and related
      move instruction in front of cmpxchg).
      
      No functional change intended.
      
      Signed-off-by: default avatarUros Bizjak <ubizjak@gmail.com>
      Cc: Jens Axboe <axboe@kernel.dk>
      Link: https://lore.kernel.org/r/20220712152741.7324-1-ubizjak@gmail.com
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      939f9dd0
    • Uros Bizjak's avatar
      block/rq_qos: Use atomic_try_cmpxchg in atomic_inc_below · f4b1e27d
      Uros Bizjak authored
      
      
      Use atomic_try_cmpxchg instead of atomic_cmpxchg (*ptr, old, new) == old in
      atomic_inc_below. x86 CMPXCHG instruction returns success in ZF flag,
      so this change saves a compare after cmpxchg (and related move instruction
      in front of cmpxchg).
      
      Also, atomic_try_cmpxchg implicitly assigns old *ptr value to "old" when
      cmpxchg fails, enabling further code simplifications.
      
      No functional change intended.
      
      Signed-off-by: default avatarUros Bizjak <ubizjak@gmail.com>
      Cc: Jens Axboe <axboe@kernel.dk>
      Link: https://lore.kernel.org/r/20220712150547.5786-1-ubizjak@gmail.com
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      f4b1e27d
  3. Jul 12, 2022
  4. Jul 06, 2022
  5. Jun 30, 2022
  6. Jun 29, 2022
  7. Jun 28, 2022