From: Raphael Norwitz <raphael.s.norwitz@gmail.com>
To: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
Cc: mst@redhat.com, sgarzare@redhat.com, raphael@enfabrica.net,
qemu-devel@nongnu.org, yc-core@yandex-team.ru,
d-tatianin@yandex-team.ru
Subject: Re: [PATCH v2 19/23] vhost: vhost_dev_init(): simplify features initialization
Date: Mon, 13 Oct 2025 16:51:15 -0400 [thread overview]
Message-ID: <CAFubqFuC1xdfpJprp3Tno_TLet-aMRyN1arMtDDze6FrfLNKZQ@mail.gmail.com> (raw)
In-Reply-To: <20251011232404.561024-20-vsementsov@yandex-team.ru>
Reviewed-by: Raphael Norwitz <raphael.s.norwitz@gmail.com>
On Sat, Oct 11, 2025 at 7:24 PM Vladimir Sementsov-Ogievskiy
<vsementsov@yandex-team.ru> wrote:
>
> Drop extra variable and extra function parameter passing, initialize
> dev._features directly.
>
> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
> ---
> hw/virtio/vhost.c | 14 +++++---------
> 1 file changed, 5 insertions(+), 9 deletions(-)
>
> diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c
> index c990029756..d02d1d4c34 100644
> --- a/hw/virtio/vhost.c
> +++ b/hw/virtio/vhost.c
> @@ -1557,18 +1557,17 @@ static void vhost_virtqueue_cleanup(struct vhost_virtqueue *vq)
> }
> }
>
> -static int vhost_dev_get_features(struct vhost_dev *hdev,
> - uint64_t *features)
> +static int vhost_dev_init_features(struct vhost_dev *hdev)
> {
> uint64_t features64;
> int r;
>
> if (hdev->vhost_ops->vhost_get_features_ex) {
> - return hdev->vhost_ops->vhost_get_features_ex(hdev, features);
> + return hdev->vhost_ops->vhost_get_features_ex(hdev, hdev->_features_ex);
> }
>
> r = hdev->vhost_ops->vhost_get_features(hdev, &features64);
> - virtio_features_from_u64(features, features64);
> + virtio_features_from_u64(hdev->_features_ex, features64);
> return r;
> }
>
> @@ -1615,7 +1614,6 @@ int vhost_dev_init(struct vhost_dev *hdev, void *opaque,
> VhostBackendType backend_type, uint32_t busyloop_timeout,
> Error **errp)
> {
> - uint64_t features[VIRTIO_FEATURES_NU64S];
> int i, r, n_initialized_vqs = 0;
>
> hdev->vdev = NULL;
> @@ -1635,9 +1633,9 @@ int vhost_dev_init(struct vhost_dev *hdev, void *opaque,
> goto fail;
> }
>
> - r = vhost_dev_get_features(hdev, features);
> + r = vhost_dev_init_features(hdev);
> if (r < 0) {
> - error_setg_errno(errp, -r, "vhost_get_features failed");
> + error_setg_errno(errp, -r, "vhost_init_features failed");
> goto fail;
> }
>
> @@ -1650,8 +1648,6 @@ int vhost_dev_init(struct vhost_dev *hdev, void *opaque,
> }
> }
>
> - virtio_features_copy(hdev->_features_ex, features);
> -
> hdev->memory_listener = (MemoryListener) {
> .name = "vhost",
> .begin = vhost_begin,
> --
> 2.48.1
>
next prev parent reply other threads:[~2025-10-13 20:52 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-11 23:23 [PATCH v2 00/23] vhost refactoring and fixes Vladimir Sementsov-Ogievskiy
2025-10-11 23:23 ` [PATCH v2 01/23] vhost-user: rework enabling vrings Vladimir Sementsov-Ogievskiy
2025-10-13 18:25 ` Raphael Norwitz
2025-10-11 23:23 ` [PATCH v2 02/23] vhost: drop backend_features field Vladimir Sementsov-Ogievskiy
2025-10-13 4:42 ` Markus Armbruster
2025-10-13 8:32 ` Vladimir Sementsov-Ogievskiy
2025-10-13 18:40 ` Raphael Norwitz
2025-10-11 23:23 ` [PATCH v2 03/23] vhost-user: introduce vhost_user_has_protocol_feature() helper Vladimir Sementsov-Ogievskiy
2025-10-13 18:46 ` Raphael Norwitz
2025-10-11 23:23 ` [PATCH v2 04/23] vhost: move protocol_features to vhost_user Vladimir Sementsov-Ogievskiy
2025-10-13 18:53 ` Raphael Norwitz
2025-10-11 23:23 ` [PATCH v2 05/23] vhost-user-gpu: drop code duplication Vladimir Sementsov-Ogievskiy
2025-10-11 23:23 ` [PATCH v2 06/23] vhost: make vhost_dev.features private Vladimir Sementsov-Ogievskiy
2025-10-13 19:52 ` Raphael Norwitz
2025-10-11 23:23 ` [PATCH v2 07/23] virtio: move common part of _set_guest_notifier to generic code Vladimir Sementsov-Ogievskiy
2025-10-11 23:23 ` [PATCH v2 08/23] virtio: drop *_set_guest_notifier_fd_handler() helpers Vladimir Sementsov-Ogievskiy
2025-10-11 23:23 ` [PATCH v2 09/23] vhost-user: keep QIOChannelSocket for backend channel Vladimir Sementsov-Ogievskiy
2025-10-11 23:23 ` [PATCH v2 10/23] vhost: vhost_virtqueue_start(): fix failure path Vladimir Sementsov-Ogievskiy
2025-10-13 20:13 ` Raphael Norwitz
2025-10-11 23:23 ` [PATCH v2 11/23] vhost: make vhost_memory_unmap() null-safe Vladimir Sementsov-Ogievskiy
2025-10-13 20:23 ` Raphael Norwitz
2025-10-11 23:23 ` [PATCH v2 12/23] vhost: simplify calls to vhost_memory_unmap() Vladimir Sementsov-Ogievskiy
2025-10-13 20:26 ` Raphael Norwitz
2025-10-11 23:23 ` [PATCH v2 13/23] vhost: move vrings mapping to the top of vhost_virtqueue_start() Vladimir Sementsov-Ogievskiy
2025-10-11 23:23 ` [PATCH v2 14/23] vhost: vhost_virtqueue_start(): drop extra local variables Vladimir Sementsov-Ogievskiy
2025-10-11 23:23 ` [PATCH v2 15/23] vhost: final refactoring of vhost vrings map/unmap Vladimir Sementsov-Ogievskiy
2025-10-13 20:39 ` Raphael Norwitz
2025-10-11 23:23 ` [PATCH v2 16/23] vhost: simplify vhost_dev_init() error-path Vladimir Sementsov-Ogievskiy
2025-10-11 23:23 ` [PATCH v2 17/23] vhost: move busyloop timeout initialization to vhost_virtqueue_init() Vladimir Sementsov-Ogievskiy
2025-10-11 23:23 ` [PATCH v2 18/23] vhost: introduce check_memslots() helper Vladimir Sementsov-Ogievskiy
2025-10-11 23:23 ` [PATCH v2 19/23] vhost: vhost_dev_init(): simplify features initialization Vladimir Sementsov-Ogievskiy
2025-10-13 20:51 ` Raphael Norwitz [this message]
2025-10-11 23:23 ` [PATCH v2 20/23] hw/virtio/virtio-bus: refactor virtio_bus_set_host_notifier() Vladimir Sementsov-Ogievskiy
2025-10-11 23:24 ` [PATCH v2 21/23] vhost-user: make trace events more readable Vladimir Sementsov-Ogievskiy
2025-10-11 23:24 ` [PATCH v2 22/23] vhost-user-blk: add some useful trace-points Vladimir Sementsov-Ogievskiy
2025-10-13 20:55 ` Raphael Norwitz
2025-10-11 23:24 ` [PATCH v2 23/23] vhost: " Vladimir Sementsov-Ogievskiy
2025-10-13 21:04 ` Raphael Norwitz
2025-10-13 14:04 ` [PATCH v2 00/23] vhost refactoring and fixes Daniil Tatianin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAFubqFuC1xdfpJprp3Tno_TLet-aMRyN1arMtDDze6FrfLNKZQ@mail.gmail.com \
--to=raphael.s.norwitz@gmail.com \
--cc=d-tatianin@yandex-team.ru \
--cc=mst@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=raphael@enfabrica.net \
--cc=sgarzare@redhat.com \
--cc=vsementsov@yandex-team.ru \
--cc=yc-core@yandex-team.ru \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).