Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: qemu/qemu
base: 19a720b74fde
Choose a base ref
...
head repository: qemu/qemu
compare: 9eb400cdd7b0
Choose a head ref
  • 9 commits
  • 20 files changed
  • 3 contributors

Commits on Jun 1, 2023

  1. block: add blk_io_plug_call() API

    Introduce a new API for thread-local blk_io_plug() that does not
    traverse the block graph. The goal is to make blk_io_plug() multi-queue
    friendly.
    
    Instead of having block drivers track whether or not we're in a plugged
    section, provide an API that allows them to defer a function call until
    we're unplugged: blk_io_plug_call(fn, opaque). If blk_io_plug_call() is
    called multiple times with the same fn/opaque pair, then fn() is only
    called once at the end of the function - resulting in batching.
    
    This patch introduces the API and changes blk_io_plug()/blk_io_unplug().
    blk_io_plug()/blk_io_unplug() no longer require a BlockBackend argument
    because the plug state is now thread-local.
    
    Later patches convert block drivers to blk_io_plug_call() and then we
    can finally remove .bdrv_co_io_plug() once all block drivers have been
    converted.
    
    Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
    Reviewed-by: Eric Blake <eblake@redhat.com>
    Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
    Acked-by: Kevin Wolf <kwolf@redhat.com>
    Message-id: 20230530180959.1108766-2-stefanha@redhat.com
    Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
    Stefan Hajnoczi committed Jun 1, 2023
    Copy the full SHA
    41abca8 View commit details
    Browse the repository at this point in the history
  2. block/nvme: convert to blk_io_plug_call() API

    Stop using the .bdrv_co_io_plug() API because it is not multi-queue
    block layer friendly. Use the new blk_io_plug_call() API to batch I/O
    submission instead.
    
    Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
    Reviewed-by: Eric Blake <eblake@redhat.com>
    Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
    Acked-by: Kevin Wolf <kwolf@redhat.com>
    Message-id: 20230530180959.1108766-3-stefanha@redhat.com
    Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
    Stefan Hajnoczi committed Jun 1, 2023
    Copy the full SHA
    f2e5900 View commit details
    Browse the repository at this point in the history
  3. block/blkio: convert to blk_io_plug_call() API

    Stop using the .bdrv_co_io_plug() API because it is not multi-queue
    block layer friendly. Use the new blk_io_plug_call() API to batch I/O
    submission instead.
    
    Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
    Reviewed-by: Eric Blake <eblake@redhat.com>
    Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
    Acked-by: Kevin Wolf <kwolf@redhat.com>
    Message-id: 20230530180959.1108766-4-stefanha@redhat.com
    Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
    Stefan Hajnoczi committed Jun 1, 2023
    Copy the full SHA
    28ff7b4 View commit details
    Browse the repository at this point in the history
  4. block/io_uring: convert to blk_io_plug_call() API

    Stop using the .bdrv_co_io_plug() API because it is not multi-queue
    block layer friendly. Use the new blk_io_plug_call() API to batch I/O
    submission instead.
    
    Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
    Reviewed-by: Eric Blake <eblake@redhat.com>
    Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
    Acked-by: Kevin Wolf <kwolf@redhat.com>
    Message-id: 20230530180959.1108766-5-stefanha@redhat.com
    Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
    Stefan Hajnoczi committed Jun 1, 2023
    Copy the full SHA
    6a6da23 View commit details
    Browse the repository at this point in the history
  5. block/linux-aio: convert to blk_io_plug_call() API

    Stop using the .bdrv_co_io_plug() API because it is not multi-queue
    block layer friendly. Use the new blk_io_plug_call() API to batch I/O
    submission instead.
    
    Note that a dev_max_batch check is dropped in laio_io_unplug() because
    the semantics of unplug_fn() are different from .bdrv_co_unplug():
    1. unplug_fn() is only called when the last blk_io_unplug() call occurs,
       not every time blk_io_unplug() is called.
    2. unplug_fn() is per-thread, not per-BlockDriverState, so there is no
       way to get per-BlockDriverState fields like dev_max_batch.
    
    Therefore this condition cannot be moved to laio_unplug_fn(). It is not
    obvious that this condition affects performance in practice, so I am
    removing it instead of trying to come up with a more complex mechanism
    to preserve the condition.
    
    Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
    Reviewed-by: Eric Blake <eblake@redhat.com>
    Acked-by: Kevin Wolf <kwolf@redhat.com>
    Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
    Message-id: 20230530180959.1108766-6-stefanha@redhat.com
    Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
    Stefan Hajnoczi committed Jun 1, 2023
    Copy the full SHA
    0766828 View commit details
    Browse the repository at this point in the history
  6. block: remove bdrv_co_io_plug() API

    No block driver implements .bdrv_co_io_plug() anymore. Get rid of the
    function pointers.
    
    Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
    Reviewed-by: Eric Blake <eblake@redhat.com>
    Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
    Acked-by: Kevin Wolf <kwolf@redhat.com>
    Message-id: 20230530180959.1108766-7-stefanha@redhat.com
    Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
    Stefan Hajnoczi committed Jun 1, 2023
    Copy the full SHA
    2a0d7cb View commit details
    Browse the repository at this point in the history
  7. block/blkio: use qemu_open() to support fd passing for virtio-blk

    Some virtio-blk drivers (e.g. virtio-blk-vhost-vdpa) supports the fd
    passing. Let's expose this to the user, so the management layer
    can pass the file descriptor of an already opened path.
    
    If the libblkio virtio-blk driver supports fd passing, let's always
    use qemu_open() to open the `path`, so we can handle fd passing
    from the management layer through the "/dev/fdset/N" special path.
    
    Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
    Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
    Message-id: 20230530071941.8954-2-sgarzare@redhat.com
    Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
    stefano-garzarella authored and Stefan Hajnoczi committed Jun 1, 2023
    Copy the full SHA
    cad2ccc View commit details
    Browse the repository at this point in the history
  8. qapi: add '@fdset' feature for BlockdevOptionsVirtioBlkVhostVdpa

    The virtio-blk-vhost-vdpa driver in libblkio 1.3.0 supports the fd
    passing through the new 'fd' property.
    
    Since now we are using qemu_open() on '@path' if the virtio-blk driver
    supports the fd passing, let's announce it.
    In this way, the management layer can pass the file descriptor of an
    already opened vhost-vdpa character device. This is useful especially
    when the device can only be accessed with certain privileges.
    
    Add the '@fdset' feature only when the virtio-blk-vhost-vdpa driver
    in libblkio supports it.
    
    Suggested-by: Markus Armbruster <armbru@redhat.com>
    Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
    Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
    Message-id: 20230530071941.8954-3-sgarzare@redhat.com
    Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
    stefano-garzarella authored and Stefan Hajnoczi committed Jun 1, 2023
    Copy the full SHA
    98b126f View commit details
    Browse the repository at this point in the history
  9. Merge tag 'block-pull-request' of https://gitlab.com/stefanha/qemu in…

    …to staging
    
    Pull request
    
    - Stefano Garzarella's blkio block driver 'fd' parameter
    - My thread-local blk_io_plug() series
    
    # -----BEGIN PGP SIGNATURE-----
    #
    # iQEzBAABCAAdFiEEhpWov9P5fNqsNXdanKSrs4Grc8gFAmR4uHoACgkQnKSrs4Gr
    # c8hFBAgAo+SFrOteYgdELM9s0EWb0AU39MTOyNXW7i5mPZNXrn5J7pfRD/5wvI6l
    # wl5GNMQ+M5HVYO7CumKWr4M1IpKV5Jin6FN/2h15fWkeg17lBOmNHUF+LctLYQbq
    # HwtNA4hdw1+SEv8kQLBgiqSJMqWcn80X09emgPMCIwET9zxokRYwVjQJx2alM5bd
    # SqgitDp5qlHyj5HQPX2orT9KrXYWQdGr8i50bn0S67r1wdqTRMu93wrWdEUUncId
    # 7otlUaq8cARbRMJzIwDmy/cF24Ynr0wCJb4aHW+trRtf+PNgx1Ki+YOiz+LFyjq7
    # t6KOMeignzhz9Uzq8EVG4XW8SHpGkw==
    # =Ms48
    # -----END PGP SIGNATURE-----
    # gpg: Signature made Thu 01 Jun 2023 08:25:46 AM PDT
    # gpg:                using RSA key 8695A8BFD3F97CDAAC35775A9CA4ABB381AB73C8
    # gpg: Good signature from "Stefan Hajnoczi <stefanha@redhat.com>" [full]
    # gpg:                 aka "Stefan Hajnoczi <stefanha@gmail.com>" [full]
    
    * tag 'block-pull-request' of https://gitlab.com/stefanha/qemu:
      qapi: add '@fdset' feature for BlockdevOptionsVirtioBlkVhostVdpa
      block/blkio: use qemu_open() to support fd passing for virtio-blk
      block: remove bdrv_co_io_plug() API
      block/linux-aio: convert to blk_io_plug_call() API
      block/io_uring: convert to blk_io_plug_call() API
      block/blkio: convert to blk_io_plug_call() API
      block/nvme: convert to blk_io_plug_call() API
      block: add blk_io_plug_call() API
    
    Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
    rth7680 committed Jun 1, 2023
    Copy the full SHA
    9eb400c View commit details
    Browse the repository at this point in the history