From: Steve Sistare <steven.sistare@oracle.com>
To: qemu-devel@nongnu.org
Cc: Juan Quintela <quintela@redhat.com>, Peter Xu <peterx@redhat.com>,
Fabiano Rosas <farosas@suse.de>,
Leonardo Bras <leobras@redhat.com>,
"Michael S. Tsirkin" <mst@redhat.com>,
Jason Wang <jasowang@redhat.com>,
Alex Williamson <alex.williamson@redhat.com>,
Cedric Le Goater <clg@redhat.com>,
Gerd Hoffmann <kraxel@redhat.com>,
Marc-Andre Lureau <marcandre.lureau@redhat.com>,
Steve Sistare <steven.sistare@oracle.com>
Subject: [PATCH V1 1/3] migration: check mode in notifiers
Date: Wed, 13 Dec 2023 10:11:31 -0800 [thread overview]
Message-ID: <1702491093-383782-2-git-send-email-steven.sistare@oracle.com> (raw)
In-Reply-To: <1702491093-383782-1-git-send-email-steven.sistare@oracle.com>
The existing notifiers should only apply to normal mode.
No functional change.
Signed-off-by: Steve Sistare <steven.sistare@oracle.com>
---
hw/net/virtio-net.c | 4 ++++
hw/vfio/migration.c | 3 +++
include/migration/misc.h | 1 +
migration/migration.c | 5 +++++
net/vhost-vdpa.c | 4 ++++
ui/spice-core.c | 2 +-
6 files changed, 18 insertions(+), 1 deletion(-)
diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
index 80c56f0..0fa083d 100644
--- a/hw/net/virtio-net.c
+++ b/hw/net/virtio-net.c
@@ -3532,6 +3532,10 @@ static void virtio_net_handle_migration_primary(VirtIONet *n, MigrationState *s)
static void virtio_net_migration_state_notifier(Notifier *notifier, void *data)
{
MigrationState *s = data;
+
+ if (migrate_mode_of(s) != MIG_MODE_NORMAL) {
+ return;
+ }
VirtIONet *n = container_of(notifier, VirtIONet, migration_state);
virtio_net_handle_migration_primary(n, s);
}
diff --git a/hw/vfio/migration.c b/hw/vfio/migration.c
index 28d422b..814132a 100644
--- a/hw/vfio/migration.c
+++ b/hw/vfio/migration.c
@@ -763,6 +763,9 @@ static void vfio_migration_state_notifier(Notifier *notifier, void *data)
migration_state);
VFIODevice *vbasedev = migration->vbasedev;
+ if (migrate_mode_of(s) != MIG_MODE_NORMAL) {
+ return;
+ }
trace_vfio_migration_state_notifier(vbasedev->name,
MigrationStatus_str(s->state));
diff --git a/include/migration/misc.h b/include/migration/misc.h
index 1bc8902..901d117 100644
--- a/include/migration/misc.h
+++ b/include/migration/misc.h
@@ -61,6 +61,7 @@ void migration_object_init(void);
void migration_shutdown(void);
bool migration_is_idle(void);
bool migration_is_active(MigrationState *);
+MigMode migrate_mode_of(MigrationState *);
void migration_add_notifier(Notifier *notify,
void (*func)(Notifier *notifier, void *data));
void migration_remove_notifier(Notifier *notify);
diff --git a/migration/migration.c b/migration/migration.c
index 2cc7e2a..d5bfe70 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -1559,6 +1559,11 @@ bool migration_is_active(MigrationState *s)
s->state == MIGRATION_STATUS_POSTCOPY_ACTIVE);
}
+MigMode migrate_mode_of(MigrationState *s)
+{
+ return s->parameters.mode;
+}
+
int migrate_init(MigrationState *s, Error **errp)
{
int ret;
diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c
index d0614d7..80acc4b 100644
--- a/net/vhost-vdpa.c
+++ b/net/vhost-vdpa.c
@@ -336,6 +336,10 @@ static void vdpa_net_migration_state_notifier(Notifier *notifier, void *data)
VhostVDPAState *s = container_of(notifier, VhostVDPAState,
migration_state);
+ if (migrate_mode_of(migration) != MIG_MODE_NORMAL) {
+ return;
+ }
+
if (migration_in_setup(migration)) {
vhost_vdpa_net_log_global_enable(s, true);
} else if (migration_has_failed(migration)) {
diff --git a/ui/spice-core.c b/ui/spice-core.c
index db21db2..0a04eb0 100644
--- a/ui/spice-core.c
+++ b/ui/spice-core.c
@@ -572,7 +572,7 @@ static void migration_state_notifier(Notifier *notifier, void *data)
{
MigrationState *s = data;
- if (!spice_have_target_host) {
+ if (!spice_have_target_host || migrate_mode_of(s) != MIG_MODE_NORMAL) {
return;
}
--
1.8.3.1
next prev parent reply other threads:[~2023-12-13 18:13 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-13 18:11 [PATCH V1 0/3] allow cpr-reboot for vfio Steve Sistare
2023-12-13 18:11 ` Steve Sistare [this message]
2024-01-10 7:09 ` [PATCH V1 1/3] migration: check mode in notifiers Peter Xu
2024-01-10 18:08 ` Steven Sistare
2024-01-11 1:45 ` Peter Xu
2023-12-13 18:11 ` [PATCH V1 2/3] migration: notifier error reporting Steve Sistare
2024-01-10 7:18 ` Peter Xu
2024-01-10 18:08 ` Steven Sistare
2024-01-11 2:16 ` Peter Xu
2024-01-11 13:49 ` Steven Sistare
2023-12-13 18:11 ` [PATCH V1 3/3] vfio: allow cpr-reboot migration if suspended Steve Sistare
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=1702491093-383782-2-git-send-email-steven.sistare@oracle.com \
--to=steven.sistare@oracle.com \
--cc=alex.williamson@redhat.com \
--cc=clg@redhat.com \
--cc=farosas@suse.de \
--cc=jasowang@redhat.com \
--cc=kraxel@redhat.com \
--cc=leobras@redhat.com \
--cc=marcandre.lureau@redhat.com \
--cc=mst@redhat.com \
--cc=peterx@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.com \
/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).