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: ccdd31267678
Choose a base ref
...
head repository: qemu/qemu
compare: f33c74576425
Choose a head ref
  • 9 commits
  • 3 files changed
  • 4 contributors

Commits on Jul 25, 2023

  1. block/blkio: enable the completion eventfd

    Until libblkio 1.3.0, virtio-blk drivers had completion eventfd
    notifications enabled from the start, but from the next releases
    this is no longer the case, so we have to explicitly enable them.
    
    In fact, the libblkio documentation says they could be disabled,
    so we should always enable them at the start if we want to be
    sure to get completion eventfd notifications:
    
        By default, the driver might not generate completion events for
        requests so it is necessary to explicitly enable the completion
        file descriptor before use:
    
        void blkioq_set_completion_fd_enabled(struct blkioq *q, bool enable);
    
    I discovered this while trying a development version of libblkio:
    the guest kernel hangs during boot, while probing the device.
    
    Fixes: fd66dbd ("blkio: add libblkio block driver")
    Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
    Message-id: 20230725103744.77343-1-sgarzare@redhat.com
    Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
    stefano-garzarella authored and Stefan Hajnoczi committed Jul 25, 2023
    Copy the full SHA
    9359c45 View commit details
    Browse the repository at this point in the history

Commits on Jul 26, 2023

  1. block/blkio: do not use open flags in qemu_open()

    qemu_open() in blkio_virtio_blk_common_open() is used to open the
    character device (e.g. /dev/vhost-vdpa-0 or /dev/vfio/vfio) or in
    the future eventually the unix socket.
    
    In all these cases we cannot open the path in read-only mode,
    when the `read-only` option of blockdev is on, because the exchange
    of IOCTL commands for example will fail.
    
    In order to open the device read-only, we have to use the `read-only`
    property of the libblkio driver as we already do in blkio_file_open().
    
    Fixes: cad2ccc ("block/blkio: use qemu_open() to support fd passing for virtio-blk")
    Buglink: https://bugzilla.redhat.com/show_bug.cgi?id=2225439
    Reported-by: Qing Wang <qinwang@redhat.com>
    Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
    Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
    Message-id: 20230726074807.14041-1-sgarzare@redhat.com
    Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
    stefano-garzarella authored and Stefan Hajnoczi committed Jul 26, 2023
    Copy the full SHA
    a5942c1 View commit details
    Browse the repository at this point in the history

Commits on Jul 27, 2023

  1. block/file-posix: fix g_file_get_contents return path

    The g_file_get_contents() function returns a g_boolean. If it fails, the
    returned value will be 0 instead of -1. Solve the issue by skipping
    assigning ret value.
    
    This issue was found by Matthew Rosato using virtio-blk-{pci,ccw} backed
    by an NVMe partition e.g. /dev/nvme0n1p1 on s390x.
    
    Signed-off-by: Sam Li <faithilikerun@gmail.com>
    Reviewed-by: Matthew Rosato <mjrosato@linux.ibm.com>
    Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
    Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
    Message-id: 20230727115844.8480-1-faithilikerun@gmail.com
    Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
    sgzerolc authored and Stefan Hajnoczi committed Jul 27, 2023
    Copy the full SHA
    29a242e View commit details
    Browse the repository at this point in the history
  2. block: Fix pad_request's request restriction

    bdrv_pad_request() relies on requests' lengths not to exceed SIZE_MAX,
    which bdrv_check_qiov_request() does not guarantee.
    
    bdrv_check_request32() however will guarantee this, and both of
    bdrv_pad_request()'s callers (bdrv_co_preadv_part() and
    bdrv_co_pwritev_part()) already run it before calling
    bdrv_pad_request().  Therefore, bdrv_pad_request() can safely call
    bdrv_check_request32() without expecting error, too.
    
    In effect, this patch will not change guest-visible behavior.  It is a
    clean-up to tighten a condition to match what is guaranteed by our
    callers, and which exists purely to show clearly why the subsequent
    assertion (`assert(*bytes <= SIZE_MAX)`) is always true.
    
    Note there is a difference between the interfaces of
    bdrv_check_qiov_request() and bdrv_check_request32(): The former takes
    an errp, the latter does not, so we can no longer just pass
    &error_abort.  Instead, we need to check the returned value.  While we
    do expect success (because the callers have already run this function),
    an assert(ret == 0) is not much simpler than just to return an error if
    it occurs, so let us handle errors by returning them up the stack now.
    
    Reported-by: Peter Maydell <peter.maydell@linaro.org>
    Signed-off-by: Hanna Czenczek <hreitz@redhat.com>
    Message-id: 20230714085938.202730-1-hreitz@redhat.com
    Fixes: 1874331
           ("block: Collapse padded I/O vecs exceeding IOV_MAX")
    Signed-off-by: Hanna Czenczek <hreitz@redhat.com>
    Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
    XanClic authored and Stefan Hajnoczi committed Jul 27, 2023
    Copy the full SHA
    ef25675 View commit details
    Browse the repository at this point in the history
  3. block/blkio: move blkio_connect() in the drivers functions

    This is in preparation for the next patch, where for virtio-blk
    drivers we need to handle the failure of blkio_connect().
    
    Let's also rename the *_open() functions to *_connect() to make
    the code reflect the changes applied.
    
    Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
    Message-id: 20230727161020.84213-2-sgarzare@redhat.com
    Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
    stefano-garzarella authored and Stefan Hajnoczi committed Jul 27, 2023
    Copy the full SHA
    69785d6 View commit details
    Browse the repository at this point in the history
  4. block/blkio: retry blkio_connect() if it fails using fd

    libblkio 1.3.0 added support of "fd" property for virtio-blk-vhost-vdpa
    driver. In QEMU, starting from commit cad2ccc ("block/blkio: use
    qemu_open() to support fd passing for virtio-blk") we are using
    `blkio_get_int(..., "fd")` to check if the "fd" property is supported
    for all the virtio-blk-* driver.
    
    Unfortunately that property is also available for those driver that do
    not support it, such as virtio-blk-vhost-user.
    
    So, `blkio_get_int()` is not enough to check whether the driver supports
    the `fd` property or not. This is because the virito-blk common libblkio
    driver only checks whether or not `fd` is set during `blkio_connect()`
    and fails with -EINVAL for those transports that do not support it
    (all except vhost-vdpa for now).
    
    So let's handle the `blkio_connect()` failure, retrying it using `path`
    directly.
    
    Fixes: cad2ccc ("block/blkio: use qemu_open() to support fd passing for virtio-blk")
    Suggested-by: Stefan Hajnoczi <stefanha@redhat.com>
    Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
    Message-id: 20230727161020.84213-3-sgarzare@redhat.com
    Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
    stefano-garzarella authored and Stefan Hajnoczi committed Jul 27, 2023
    Copy the full SHA
    809c319 View commit details
    Browse the repository at this point in the history
  5. block/blkio: fall back on using path when fd setting fails

    qemu_open() fails if called with an unix domain socket in this way:
        -blockdev node-name=drive0,driver=virtio-blk-vhost-user,path=vhost-user-blk.sock,cache.direct=on: Could not open 'vhost-user-blk.sock': No such device or address
    
    Since virtio-blk-vhost-user does not support fd passing, let`s always fall back
    on using `path` if we fail the fd passing.
    
    Fixes: cad2ccc ("block/blkio: use qemu_open() to support fd passing for virtio-blk")
    Reported-by: Qing Wang <qinwang@redhat.com>
    Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
    Message-id: 20230727161020.84213-4-sgarzare@redhat.com
    Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
    stefano-garzarella authored and Stefan Hajnoczi committed Jul 27, 2023
    Copy the full SHA
    723bea2 View commit details
    Browse the repository at this point in the history
  6. block/blkio: use blkio_set_int("fd") to check fd support

    Setting the `fd` property fails with virtio-blk-* libblkio drivers
    that do not support fd passing since
    https://gitlab.com/libblkio/libblkio/-/merge_requests/208.
    
    Getting the `fd` property, on the other hand, always succeeds for
    virtio-blk-* libblkio drivers even when they don't support fd passing.
    
    This patch switches to setting the `fd` property because it is a
    better mechanism for probing fd passing support than getting the `fd`
    property.
    
    Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
    Message-id: 20230727161020.84213-5-sgarzare@redhat.com
    Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
    stefano-garzarella authored and Stefan Hajnoczi committed Jul 27, 2023
    Copy the full SHA
    1c38fe6 View commit details
    Browse the repository at this point in the history

Commits on Jul 28, 2023

  1. Merge tag 'block-pull-request' of https://gitlab.com/stefanha/qemu in…

    …to staging
    
    Pull request
    
    Please include these bug fixes in QEMU 8.1. Thanks!
    
    # -----BEGIN PGP SIGNATURE-----
    #
    # iQEzBAABCAAdFiEEhpWov9P5fNqsNXdanKSrs4Grc8gFAmTCzPUACgkQnKSrs4Gr
    # c8g1DAf/fPUQ4zRsCn079pHIyK9TFo4COm23p4kiusxj8otfjt8LH1Zsc9pGWC2+
    # bl2RlnPID8JlyJFDRN7b/RCEhj45a83GtCmhDDmqVgy1eO5vwOKm2XyyWeD+pq/U
    # Hf2QLPLZZ7tCD8Njpty+gB3Ux4zqthKGXSg8FpJ3w0tl4me2efLvjMa6jHMwtnHT
    # aAbyQ3WMpT9w4XHLqRQDHzBqrTSY4od3nl9SrM/DQ2klLIcz8ECTEZVBY9B3pq6m
    # QvAg24tfb0QvS14YnZv/PMCfOaVuE87M9G4f93pCynnMxMYze+XczL0sGhIAS9wp
    # 03NgGlhGumOix6r2kHjlG6p3xywV8A==
    # =jMf8
    # -----END PGP SIGNATURE-----
    # gpg: Signature made Thu 27 Jul 2023 01:00:53 PM 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:
      block/blkio: use blkio_set_int("fd") to check fd support
      block/blkio: fall back on using `path` when `fd` setting fails
      block/blkio: retry blkio_connect() if it fails using `fd`
      block/blkio: move blkio_connect() in the drivers functions
      block: Fix pad_request's request restriction
      block/file-posix: fix g_file_get_contents return path
      block/blkio: do not use open flags in qemu_open()
      block/blkio: enable the completion eventfd
    
    Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
    rth7680 committed Jul 28, 2023
    Copy the full SHA
    f33c745 View commit details
    Browse the repository at this point in the history