qemu-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-commits] [qemu/qemu] 9359c4: block/blkio: enable the completion ev


From: Richard Henderson
Subject: [Qemu-commits] [qemu/qemu] 9359c4: block/blkio: enable the completion eventfd
Date: Fri, 28 Jul 2023 05:56:03 -0700

  Branch: refs/heads/master
  Home:   https://github.com/qemu/qemu
  Commit: 9359c459889fce1804c4e1b2a2ff8f182b4a9ae8
      
https://github.com/qemu/qemu/commit/9359c459889fce1804c4e1b2a2ff8f182b4a9ae8
  Author: Stefano Garzarella <sgarzare@redhat.com>
  Date:   2023-07-25 (Tue, 25 Jul 2023)

  Changed paths:
    M block/blkio.c

  Log Message:
  -----------
  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: fd66dbd424f5 ("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>


  Commit: a5942c177b7bcc1357e496b7d68668befcfc2bb9
      
https://github.com/qemu/qemu/commit/a5942c177b7bcc1357e496b7d68668befcfc2bb9
  Author: Stefano Garzarella <sgarzare@redhat.com>
  Date:   2023-07-26 (Wed, 26 Jul 2023)

  Changed paths:
    M block/blkio.c

  Log Message:
  -----------
  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: cad2ccc395 ("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>


  Commit: 29a242e165610df9b158bdb8d6b84e83d8733fc4
      
https://github.com/qemu/qemu/commit/29a242e165610df9b158bdb8d6b84e83d8733fc4
  Author: Sam Li <faithilikerun@gmail.com>
  Date:   2023-07-27 (Thu, 27 Jul 2023)

  Changed paths:
    M block/file-posix.c

  Log Message:
  -----------
  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>


  Commit: ef256751e970bff435d40a8348dd51d81e67e52e
      
https://github.com/qemu/qemu/commit/ef256751e970bff435d40a8348dd51d81e67e52e
  Author: Hanna Czenczek <hreitz@redhat.com>
  Date:   2023-07-27 (Thu, 27 Jul 2023)

  Changed paths:
    M block/io.c

  Log Message:
  -----------
  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: 18743311b829cafc1737a5f20bc3248d5f91ee2a
       ("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>


  Commit: 69785d66ae1ec43f77fc65109a21721992bead9f
      
https://github.com/qemu/qemu/commit/69785d66ae1ec43f77fc65109a21721992bead9f
  Author: Stefano Garzarella <sgarzare@redhat.com>
  Date:   2023-07-27 (Thu, 27 Jul 2023)

  Changed paths:
    M block/blkio.c

  Log Message:
  -----------
  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>


  Commit: 809c319f8a089fbc49223dc29e1cc2b978beeada
      
https://github.com/qemu/qemu/commit/809c319f8a089fbc49223dc29e1cc2b978beeada
  Author: Stefano Garzarella <sgarzare@redhat.com>
  Date:   2023-07-27 (Thu, 27 Jul 2023)

  Changed paths:
    M block/blkio.c

  Log Message:
  -----------
  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 cad2ccc395 ("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: cad2ccc395 ("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>


  Commit: 723bea27b127969931fa26bc0de79372a3d9e148
      
https://github.com/qemu/qemu/commit/723bea27b127969931fa26bc0de79372a3d9e148
  Author: Stefano Garzarella <sgarzare@redhat.com>
  Date:   2023-07-27 (Thu, 27 Jul 2023)

  Changed paths:
    M block/blkio.c

  Log Message:
  -----------
  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: cad2ccc395 ("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>


  Commit: 1c38fe69e2b8a05c1762b122292fa7e3662f06fd
      
https://github.com/qemu/qemu/commit/1c38fe69e2b8a05c1762b122292fa7e3662f06fd
  Author: Stefano Garzarella <sgarzare@redhat.com>
  Date:   2023-07-27 (Thu, 27 Jul 2023)

  Changed paths:
    M block/blkio.c

  Log Message:
  -----------
  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>


  Commit: f33c74576425fac2cbb0725229895fe096df4261
      
https://github.com/qemu/qemu/commit/f33c74576425fac2cbb0725229895fe096df4261
  Author: Richard Henderson <richard.henderson@linaro.org>
  Date:   2023-07-27 (Thu, 27 Jul 2023)

  Changed paths:
    M block/blkio.c
    M block/file-posix.c
    M block/io.c

  Log Message:
  -----------
  Merge tag 'block-pull-request' of https://gitlab.com/stefanha/qemu into 
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>


Compare: https://github.com/qemu/qemu/compare/ccdd31267678...f33c74576425



reply via email to

[Prev in Thread] Current Thread [Next in Thread]