qemu-commits
[Top][All Lists]
Advanced

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

[Qemu-commits] [qemu/qemu] 41abca: block: add blk_io_plug_call() API


From: Richard Henderson
Subject: [Qemu-commits] [qemu/qemu] 41abca: block: add blk_io_plug_call() API
Date: Thu, 01 Jun 2023 14:29:06 -0700

  Branch: refs/heads/master
  Home:   https://github.com/qemu/qemu
  Commit: 41abca8c39244b7eeb06378c4aa18b10e0645a1c
      
https://github.com/qemu/qemu/commit/41abca8c39244b7eeb06378c4aa18b10e0645a1c
  Author: Stefan Hajnoczi <stefanha@redhat.com>
  Date:   2023-06-01 (Thu, 01 Jun 2023)

  Changed paths:
    M MAINTAINERS
    M block/block-backend.c
    M block/meson.build
    A block/plug.c
    M hw/block/dataplane/xen-block.c
    M hw/block/virtio-blk.c
    M hw/scsi/virtio-scsi.c
    M include/sysemu/block-backend-io.h

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


  Commit: f2e590002bd6765e2b79fcd05992ecf70cc1d229
      
https://github.com/qemu/qemu/commit/f2e590002bd6765e2b79fcd05992ecf70cc1d229
  Author: Stefan Hajnoczi <stefanha@redhat.com>
  Date:   2023-06-01 (Thu, 01 Jun 2023)

  Changed paths:
    M block/nvme.c
    M block/trace-events

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


  Commit: 28ff7b4dfbb5594fff86a2f283a96e0f3ce975d5
      
https://github.com/qemu/qemu/commit/28ff7b4dfbb5594fff86a2f283a96e0f3ce975d5
  Author: Stefan Hajnoczi <stefanha@redhat.com>
  Date:   2023-06-01 (Thu, 01 Jun 2023)

  Changed paths:
    M block/blkio.c

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


  Commit: 6a6da231b7076b8ed5409c4745e11cb14d962194
      
https://github.com/qemu/qemu/commit/6a6da231b7076b8ed5409c4745e11cb14d962194
  Author: Stefan Hajnoczi <stefanha@redhat.com>
  Date:   2023-06-01 (Thu, 01 Jun 2023)

  Changed paths:
    M block/file-posix.c
    M block/io_uring.c
    M block/trace-events
    M include/block/raw-aio.h

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


  Commit: 076682885d6fe521ed005b988fde6a67ec6818df
      
https://github.com/qemu/qemu/commit/076682885d6fe521ed005b988fde6a67ec6818df
  Author: Stefan Hajnoczi <stefanha@redhat.com>
  Date:   2023-06-01 (Thu, 01 Jun 2023)

  Changed paths:
    M block/file-posix.c
    M block/linux-aio.c
    M include/block/raw-aio.h

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


  Commit: 2a0d7cb6b7c1d1f325a81ec9f50a823318b045bb
      
https://github.com/qemu/qemu/commit/2a0d7cb6b7c1d1f325a81ec9f50a823318b045bb
  Author: Stefan Hajnoczi <stefanha@redhat.com>
  Date:   2023-06-01 (Thu, 01 Jun 2023)

  Changed paths:
    M block/io.c
    M include/block/block-io.h
    M include/block/block_int-common.h

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


  Commit: cad2ccc395c7113fb30bc9390774b67b34f06c68
      
https://github.com/qemu/qemu/commit/cad2ccc395c7113fb30bc9390774b67b34f06c68
  Author: Stefano Garzarella <sgarzare@redhat.com>
  Date:   2023-06-01 (Thu, 01 Jun 2023)

  Changed paths:
    M block/blkio.c

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


  Commit: 98b126f5e3228a346c774e569e26689943b401dd
      
https://github.com/qemu/qemu/commit/98b126f5e3228a346c774e569e26689943b401dd
  Author: Stefano Garzarella <sgarzare@redhat.com>
  Date:   2023-06-01 (Thu, 01 Jun 2023)

  Changed paths:
    M meson.build
    M qapi/block-core.json

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


  Commit: 9eb400cdd7b0940bd696aa01462dd53004ae04e9
      
https://github.com/qemu/qemu/commit/9eb400cdd7b0940bd696aa01462dd53004ae04e9
  Author: Richard Henderson <richard.henderson@linaro.org>
  Date:   2023-06-01 (Thu, 01 Jun 2023)

  Changed paths:
    M MAINTAINERS
    M block/blkio.c
    M block/block-backend.c
    M block/file-posix.c
    M block/io.c
    M block/io_uring.c
    M block/linux-aio.c
    M block/meson.build
    M block/nvme.c
    A block/plug.c
    M block/trace-events
    M hw/block/dataplane/xen-block.c
    M hw/block/virtio-blk.c
    M hw/scsi/virtio-scsi.c
    M include/block/block-io.h
    M include/block/block_int-common.h
    M include/block/raw-aio.h
    M include/sysemu/block-backend-io.h
    M meson.build
    M qapi/block-core.json

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


Compare: https://github.com/qemu/qemu/compare/19a720b74fde...9eb400cdd7b0



reply via email to

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