qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Jens Freimann <jfreimann@redhat.com>
To: qemu-devel@nongnu.org
Cc: pkrempa@redhat.com, berrange@redhat.com, ehabkost@redhat.com,
	mst@redhat.com, aadam@redhat.com, laine@redhat.com,
	ailan@redhat.com
Subject: [Qemu-devel] [PATCH 4/9] migration: allow unplug during migration for failover devices
Date: Fri,  2 Aug 2019 17:06:00 +0200	[thread overview]
Message-ID: <20190802150605.5880-5-jfreimann@redhat.com> (raw)
In-Reply-To: <20190802150605.5880-1-jfreimann@redhat.com>

In "b06424de62 migration: Disable hotplug/unplug during migration" we
added a check to disable unplug for all devices until we have figured
out what works. For failover primary devices qdev_unplug() is called
from the migration handler, i.e. during migration.

This patch adds a flag to DeviceState which is set to false for all
devices and makes an exception for vfio-pci devices that are also
primary devices in a failover pair.

Signed-off-by: Jens Freimann <jfreimann@redhat.com>
---
 hw/core/qdev.c         | 1 +
 include/hw/qdev-core.h | 1 +
 qdev-monitor.c         | 2 +-
 3 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/hw/core/qdev.c b/hw/core/qdev.c
index 31e90ebaa2..f43f744133 100644
--- a/hw/core/qdev.c
+++ b/hw/core/qdev.c
@@ -973,6 +973,7 @@ static void device_initfn(Object *obj)
 
     dev->instance_id_alias = -1;
     dev->realized = false;
+    dev->allow_unplug_during_migration = false;
 
     object_property_add_bool(obj, "realized",
                              device_get_realized, device_set_realized, NULL);
diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h
index 6174538b01..af4857d391 100644
--- a/include/hw/qdev-core.h
+++ b/include/hw/qdev-core.h
@@ -147,6 +147,7 @@ struct DeviceState {
     bool pending_deleted_event;
     QemuOpts *opts;
     int hotplugged;
+    bool allow_unplug_during_migration;
     BusState *parent_bus;
     QLIST_HEAD(, NamedGPIOList) gpios;
     QLIST_HEAD(, BusState) child_bus;
diff --git a/qdev-monitor.c b/qdev-monitor.c
index c69e283419..e7ab5cacb3 100644
--- a/qdev-monitor.c
+++ b/qdev-monitor.c
@@ -845,7 +845,7 @@ void qdev_unplug(DeviceState *dev, Error **errp)
         return;
     }
 
-    if (!migration_is_idle() && !migration_in_setup(migrate_get_current())) {
+    if (!migration_is_idle() && !dev->allow_unplug_during_migration) {
         error_setg(errp, "device_del not allowed while migrating");
         return;
     }
-- 
2.21.0



  parent reply	other threads:[~2019-08-02 15:09 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-02 15:05 [Qemu-devel] [PATCH v2 0/9] add failover feature for assigned network devices Jens Freimann
2019-08-02 15:05 ` [Qemu-devel] [PATCH 1/9] qdev/qbus: Add hidden device support Jens Freimann
2019-08-02 15:05 ` [Qemu-devel] [PATCH 2/9] net/virtio: add failover support Jens Freimann
2019-08-02 15:05 ` [Qemu-devel] [PATCH 3/9] vfio: unplug failover primary device before migration Jens Freimann
2019-08-12 15:18   ` Cornelia Huck
2019-08-12 21:22     ` Alex Williamson
2019-08-13  6:45       ` Jens Freimann
2019-08-13  9:35         ` Cornelia Huck
2019-08-13  6:50     ` Jens Freimann
2019-08-02 15:06 ` Jens Freimann [this message]
2019-08-02 15:06 ` [Qemu-devel] [PATCH 5/9] qapi: add unplug primary event Jens Freimann
2019-08-02 15:06 ` [Qemu-devel] [PATCH 6/9] qapi: Add failover negotiated event Jens Freimann
2019-08-02 15:06 ` [Qemu-devel] [PATCH 7/9] migration: Add new migration state wait-unplug Jens Freimann
2019-08-02 15:06 ` [Qemu-devel] [PATCH 8/9] pci: mark devices partially unplugged Jens Freimann
2019-08-02 15:06 ` [Qemu-devel] [PATCH 9/9] pci: mark device having guest unplug request pending Jens Freimann
2019-08-02 15:22 ` [Qemu-devel] [PATCH v2 0/9] add failover feature for assigned network devices Michael S. Tsirkin
2019-08-05 13:12   ` Jens Freimann
2019-08-05 14:22     ` Michael S. Tsirkin
2019-08-05 18:49       ` Jens Freimann
2019-08-06  8:43         ` Michael S. Tsirkin
2019-08-07  9:15           ` Jens Freimann
2019-08-02 15:22 ` no-reply
2019-08-02 16:12 ` no-reply
2019-08-12 14:53 ` Michael S. Tsirkin

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=20190802150605.5880-5-jfreimann@redhat.com \
    --to=jfreimann@redhat.com \
    --cc=aadam@redhat.com \
    --cc=ailan@redhat.com \
    --cc=berrange@redhat.com \
    --cc=ehabkost@redhat.com \
    --cc=laine@redhat.com \
    --cc=mst@redhat.com \
    --cc=pkrempa@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /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).