From: Raphael Norwitz <raphael.s.norwitz@gmail.com>
To: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
Cc: raphael@enfabrica.net, pbonzini@redhat.com, farosas@suse.de,
mst@redhat.com, sgarzare@redhat.com,
marcandre.lureau@redhat.com, kwolf@redhat.com,
hreitz@redhat.com, berrange@redhat.com, eblake@redhat.com,
armbru@redhat.com, qemu-devel@nongnu.org, qemu-block@nongnu.org,
steven.sistare@oracle.com, yc-core@yandex-team.ru,
d-tatianin@yandex-team.ru, jasowang@redhat.com
Subject: Re: [PATCH v2 02/25] vhost: reorder logic in vhost_dev_init()
Date: Mon, 20 Oct 2025 19:16:53 -0400 [thread overview]
Message-ID: <CAFubqFuFYvEjm=SatMXH0Z69Z-kDQGiCuUDQ5wTsA6BVKLcbBA@mail.gmail.com> (raw)
In-Reply-To: <20251016114104.1384675-3-vsementsov@yandex-team.ru>
Reviewed-by: Raphael Norwitz <raphael.s.norwitz@gmail.com>
On Thu, Oct 16, 2025 at 7:47 AM Vladimir Sementsov-Ogievskiy
<vsementsov@yandex-team.ru> wrote:
>
> We are going to split vhost_dev_init() so that the first part will do
> early initialization of QEMU structures, but don't communicate with
> backend, and the second part will do backend communication. We need
> this for future support for backend-transfer migration support for
> vhost-user-blk (backend will not be available in the early
> initialization point).
>
> With this commit, we simply reorder the logic in vhost_dev_init()
> in accordance with idea of further split.
>
> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
> ---
> hw/virtio/vhost.c | 60 +++++++++++++++++++++++------------------------
> 1 file changed, 30 insertions(+), 30 deletions(-)
>
> diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c
> index 9fc6e7ba65..551d1687fc 100644
> --- a/hw/virtio/vhost.c
> +++ b/hw/virtio/vhost.c
> @@ -1637,26 +1637,6 @@ int vhost_dev_init(struct vhost_dev *hdev, void *opaque,
> goto fail;
> }
>
> - r = hdev->vhost_ops->vhost_set_owner(hdev);
> - if (r < 0) {
> - error_setg_errno(errp, -r, "vhost_set_owner failed");
> - goto fail;
> - }
> -
> - r = vhost_dev_init_features(hdev);
> - if (r < 0) {
> - error_setg_errno(errp, -r, "vhost_init_features failed");
> - goto fail;
> - }
> -
> - for (i = 0; i < hdev->nvqs; ++i, ++n_initialized_vqs) {
> - r = vhost_virtqueue_init(hdev, hdev->vqs + i, hdev->vq_index + i);
> - if (r < 0) {
> - error_setg_errno(errp, -r, "Failed to initialize virtqueue %d", i);
> - goto fail;
> - }
> - }
> -
> hdev->memory_listener = (MemoryListener) {
> .name = "vhost",
> .begin = vhost_begin,
> @@ -1677,6 +1657,36 @@ int vhost_dev_init(struct vhost_dev *hdev, void *opaque,
> .region_del = vhost_iommu_region_del,
> };
>
> + hdev->mem = g_malloc0(offsetof(struct vhost_memory, regions));
> + hdev->n_mem_sections = 0;
> + hdev->mem_sections = NULL;
> + hdev->log = NULL;
> + hdev->log_size = 0;
> + hdev->log_enabled = false;
> + hdev->started = false;
> + memory_listener_register(&hdev->memory_listener, &address_space_memory);
> + QLIST_INSERT_HEAD(&vhost_devices, hdev, entry);
> +
> + r = hdev->vhost_ops->vhost_set_owner(hdev);
> + if (r < 0) {
> + error_setg_errno(errp, -r, "vhost_set_owner failed");
> + goto fail;
> + }
> +
> + r = vhost_dev_init_features(hdev);
> + if (r < 0) {
> + error_setg_errno(errp, -r, "vhost_init_features failed");
> + goto fail;
> + }
> +
> + for (i = 0; i < hdev->nvqs; ++i, ++n_initialized_vqs) {
> + r = vhost_virtqueue_init(hdev, hdev->vqs + i, hdev->vq_index + i);
> + if (r < 0) {
> + error_setg_errno(errp, -r, "Failed to initialize virtqueue %d", i);
> + goto fail;
> + }
> + }
> +
> if (hdev->migration_blocker == NULL) {
> if (!vhost_dev_has_feature_ex(hdev, VHOST_F_LOG_ALL)) {
> error_setg(&hdev->migration_blocker,
> @@ -1694,16 +1704,6 @@ int vhost_dev_init(struct vhost_dev *hdev, void *opaque,
> }
> }
>
> - hdev->mem = g_malloc0(offsetof(struct vhost_memory, regions));
> - hdev->n_mem_sections = 0;
> - hdev->mem_sections = NULL;
> - hdev->log = NULL;
> - hdev->log_size = 0;
> - hdev->log_enabled = false;
> - hdev->started = false;
> - memory_listener_register(&hdev->memory_listener, &address_space_memory);
> - QLIST_INSERT_HEAD(&vhost_devices, hdev, entry);
> -
> if (!check_memslots(hdev, errp)) {
> r = -EINVAL;
> goto fail;
> --
> 2.48.1
>
>
next prev parent reply other threads:[~2025-10-20 23:17 UTC|newest]
Thread overview: 55+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-16 11:40 [PATCH v2 00/25] vhost-user-blk: live-backend local migration Vladimir Sementsov-Ogievskiy
2025-10-16 11:40 ` [PATCH v2 01/25] vhost: store busyloop_timeout into struct vhost_dev Vladimir Sementsov-Ogievskiy
2025-10-20 23:14 ` Raphael Norwitz
2025-10-16 11:40 ` [PATCH v2 02/25] vhost: reorder logic in vhost_dev_init() Vladimir Sementsov-Ogievskiy
2025-10-20 23:16 ` Raphael Norwitz [this message]
2025-10-16 11:40 ` [PATCH v2 03/25] vhost: rework vhost_virtqueue_init() Vladimir Sementsov-Ogievskiy
2025-10-20 23:18 ` Raphael Norwitz
2025-10-16 11:40 ` [PATCH v2 04/25] vhost: add connect parameter to vhost_dev_init() Vladimir Sementsov-Ogievskiy
2025-10-20 23:20 ` Raphael Norwitz
2025-10-16 11:40 ` [PATCH v2 05/25] vhost: split vhost_dev_connect() out of vhost_dev_init() Vladimir Sementsov-Ogievskiy
2025-10-20 23:21 ` Raphael Norwitz
2025-10-16 11:40 ` [PATCH v2 06/25] vhost-user: support connect api Vladimir Sementsov-Ogievskiy
2025-10-20 23:21 ` Raphael Norwitz
2025-10-16 11:40 ` [PATCH v2 07/25] vhost-user-blk: vhost_user_blk_connect() move connected check to caller Vladimir Sementsov-Ogievskiy
2025-10-20 23:23 ` Raphael Norwitz
2025-10-16 11:40 ` [PATCH v2 08/25] vhost-user-blk: vhost_user_blk_connect(): call vhost_dev_connect() Vladimir Sementsov-Ogievskiy
2025-10-20 23:24 ` Raphael Norwitz
2025-10-16 11:40 ` [PATCH v2 09/25] vhost-user-blk: rename vhost_user_blk_connect to vhost_user_blk_init Vladimir Sementsov-Ogievskiy
2025-10-20 23:25 ` Raphael Norwitz
2025-10-16 11:40 ` [PATCH v2 10/25] vhost-user-blk: split vhost_user_blk_init() Vladimir Sementsov-Ogievskiy
2025-10-20 23:28 ` Raphael Norwitz
2025-10-16 11:40 ` [PATCH v2 11/25] vhost-user-blk: move initial reconnect loop to separate function Vladimir Sementsov-Ogievskiy
2025-10-20 23:28 ` Raphael Norwitz
2025-10-16 11:40 ` [PATCH v2 12/25] vhost-user-blk: move first vhost_user_blk_init() to _realize() Vladimir Sementsov-Ogievskiy
2025-10-20 23:35 ` Raphael Norwitz
2025-10-21 16:29 ` Vladimir Sementsov-Ogievskiy
2025-10-21 18:06 ` Raphael Norwitz
2025-10-22 5:45 ` Vladimir Sementsov-Ogievskiy
2025-10-16 11:40 ` [PATCH v2 13/25] vhost-user-blk: postpone connect to pre-incoming Vladimir Sementsov-Ogievskiy
2025-10-20 23:36 ` Raphael Norwitz
2025-10-16 11:40 ` [PATCH v2 14/25] virtio: introduce .skip_vhost_migration_log() handler Vladimir Sementsov-Ogievskiy
2025-10-20 23:37 ` Raphael Norwitz
2025-10-16 11:40 ` [PATCH v2 15/25] migration: introduce vmstate_event_notifier Vladimir Sementsov-Ogievskiy
2025-10-16 18:59 ` Peter Xu
2025-10-16 19:09 ` Vladimir Sementsov-Ogievskiy
2025-10-16 11:40 ` [PATCH v2 16/25] chardev: add .chr_get_client() handler Vladimir Sementsov-Ogievskiy
2025-10-16 11:51 ` Daniel P. Berrangé
2025-10-16 11:40 ` [PATCH v2 17/25] vhost: add inflight region backend-transfer vmstate Vladimir Sementsov-Ogievskiy
2025-10-20 23:39 ` Raphael Norwitz
2025-10-16 11:40 ` [PATCH v2 18/25] chardev: introduce backend-transfer vmstate for chardev Vladimir Sementsov-Ogievskiy
2025-10-16 11:55 ` Daniel P. Berrangé
2025-10-16 12:01 ` Vladimir Sementsov-Ogievskiy
2025-10-16 11:40 ` [PATCH v2 19/25] vhost: support backend-transfer migration Vladimir Sementsov-Ogievskiy
2025-10-20 23:50 ` Raphael Norwitz
2025-10-16 11:40 ` [PATCH v2 20/25] vhost-user: add vmstate Vladimir Sementsov-Ogievskiy
2025-10-20 23:51 ` Raphael Norwitz
2025-10-21 16:34 ` Vladimir Sementsov-Ogievskiy
2025-10-16 11:40 ` [PATCH v2 21/25] virtio: support vhost backend migration Vladimir Sementsov-Ogievskiy
2025-10-20 23:52 ` Raphael Norwitz
2025-10-16 11:40 ` [PATCH v2 22/25] virtio: support .needed for virtio vmsd Vladimir Sementsov-Ogievskiy
2025-10-16 11:41 ` [PATCH v2 23/25] RFC qapi: add local-vhost-user-blk migration capability Vladimir Sementsov-Ogievskiy
2025-10-16 11:41 ` [PATCH v2 24/25] vhost-user-blk: support vhost backend migration Vladimir Sementsov-Ogievskiy
2025-10-20 23:53 ` Raphael Norwitz
2025-10-21 16:38 ` Vladimir Sementsov-Ogievskiy
2025-10-16 11:41 ` [PATCH v2 25/25] tests/functional: add test_x86_64_vhost_user_blk_fd_migration.py Vladimir Sementsov-Ogievskiy
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='CAFubqFuFYvEjm=SatMXH0Z69Z-kDQGiCuUDQ5wTsA6BVKLcbBA@mail.gmail.com' \
--to=raphael.s.norwitz@gmail.com \
--cc=armbru@redhat.com \
--cc=berrange@redhat.com \
--cc=d-tatianin@yandex-team.ru \
--cc=eblake@redhat.com \
--cc=farosas@suse.de \
--cc=hreitz@redhat.com \
--cc=jasowang@redhat.com \
--cc=kwolf@redhat.com \
--cc=marcandre.lureau@redhat.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=raphael@enfabrica.net \
--cc=sgarzare@redhat.com \
--cc=steven.sistare@oracle.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).