qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Xu <peterx@redhat.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 15/25] migration: introduce vmstate_event_notifier
Date: Thu, 16 Oct 2025 14:59:56 -0400	[thread overview]
Message-ID: <aPFArPHrqwerez2g@x1.local> (raw)
In-Reply-To: <20251016114104.1384675-16-vsementsov@yandex-team.ru>

On Thu, Oct 16, 2025 at 02:40:52PM +0300, Vladimir Sementsov-Ogievskiy wrote:
> This will be used to support backend-transfer migration for
> vhost-user-blk, we'll migrate event notifier fds through
> migration stream, to avoid extra contact with backend.
> 
> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>

Acked-by: Peter Xu <peterx@redhat.com>

Note: we recently merged _errp versions of all below three hooks.  You can
also switch to that if all of them can fail.  You can keep my A-b if you
switch over.

> ---
>  include/migration/vmstate.h        |  7 ++++
>  migration/meson.build              |  1 +
>  migration/vmstate-event-notifier.c | 54 ++++++++++++++++++++++++++++++
>  3 files changed, 62 insertions(+)
>  create mode 100644 migration/vmstate-event-notifier.c
> 
> diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h
> index f243518fb5..7f1f1c166a 100644
> --- a/include/migration/vmstate.h
> +++ b/include/migration/vmstate.h
> @@ -1294,4 +1294,11 @@ void vmstate_register_ram_global(struct MemoryRegion *memory);
>  
>  bool vmstate_check_only_migratable(const VMStateDescription *vmsd);
>  
> +extern const VMStateDescription vmstate_event_notifier;
> +
> +#define VMSTATE_EVENT_NOTIFIER(_field, _struct) \
> +    VMSTATE_STRUCT(_field, _struct, 0, vmstate_event_notifier, \
> +                   EventNotifier)
> +
> +
>  #endif
> diff --git a/migration/meson.build b/migration/meson.build
> index 16909d54c5..b5341ae0cb 100644
> --- a/migration/meson.build
> +++ b/migration/meson.build
> @@ -5,6 +5,7 @@ migration_files = files(
>    'xbzrle.c',
>    'vmstate-types.c',
>    'vmstate.c',
> +  'vmstate-event-notifier.c',
>    'qemu-file.c',
>    'yank_functions.c',
>  )
> diff --git a/migration/vmstate-event-notifier.c b/migration/vmstate-event-notifier.c
> new file mode 100644
> index 0000000000..2076eec961
> --- /dev/null
> +++ b/migration/vmstate-event-notifier.c
> @@ -0,0 +1,54 @@
> +/*
> + * Event notifier migration support
> + * Copyright (c) Yandex Technologies LLC, 2025
> + * SPDX-License-Identifier: GPL-2.0-or-later
> + */
> +
> +#include "qemu/osdep.h"
> +#include "qemu/event_notifier.h"
> +#include "migration/vmstate.h"
> +
> +static int event_notifier_pre_save(void *opaque)
> +{
> +    struct EventNotifier *e = opaque;
> +
> +    if (!e->initialized || e->rfd != e->wfd) {
> +        return -1;
> +    }
> +
> +    return 0;
> +}
> +
> +static int event_notifier_pre_load(void *opaque)
> +{
> +    struct EventNotifier *e = opaque;
> +
> +    if (e->initialized) {
> +        return -1;
> +    }
> +
> +    return 0;
> +}
> +
> +static int event_notifier_post_load(void *opaque, int version_id)
> +{
> +    struct EventNotifier *e = opaque;
> +
> +    if (e->rfd < 0) {
> +        return -1;
> +    }
> +
> +    e->wfd = e->rfd;
> +    e->initialized = true;
> +
> +    return 0;
> +}
> +
> +const VMStateDescription vmstate_event_notifier = {
> +    .name = "event-notifier",
> +    .pre_save = event_notifier_pre_save,
> +    .pre_load = event_notifier_pre_load,
> +    .post_load = event_notifier_post_load,
> +    .fields = (const VMStateField[]){VMSTATE_FD(rfd, EventNotifier),
> +                                     VMSTATE_END_OF_LIST()},
> +};
> -- 
> 2.48.1
> 

-- 
Peter Xu



  reply	other threads:[~2025-10-16 19:01 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
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 [this message]
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=aPFArPHrqwerez2g@x1.local \
    --to=peterx@redhat.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).