From: Michael Roth <mdroth@linux.vnet.ibm.com>
To: Anthony Liguori <aliguori@us.ibm.com>
Cc: Kevin Wolf <kwolf@redhat.com>,
Lucas Meneghel Rodrigues <lmr@redhat.com>,
Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>,
Juan Quintela <quintela@redhat.com>,
qemu-devel@nongnu.org, Avi Kivity <avi@redhat.com>
Subject: Re: [Qemu-devel] [PATCH 2/5] ivshmem: use migration blockers to prevent live migration in peer mode (v2)
Date: Mon, 14 Nov 2011 15:31:58 -0600 [thread overview]
Message-ID: <4EC188CE.50704@linux.vnet.ibm.com> (raw)
In-Reply-To: <1321304987-23041-2-git-send-email-aliguori@us.ibm.com>
On 11/14/2011 03:09 PM, Anthony Liguori wrote:
> Now when you try to migrate with ivshmem, you get a proper QMP error:
>
> (qemu) migrate tcp:localhost:1025
> Migration is disabled when using feature 'peer mode' in device 'ivshmem'
> (qemu)
>
> Signed-off-by: Anthony Liguori<aliguori@us.ibm.com>
> ---
> v1 -> v2
> - remove register_device_unmigratable as ivshmem was the only user
> ---
> hw/ivshmem.c | 12 +-
> qerror.c | 4 +
> qerror.h | 3 +
> savevm.c | 25 ---
> vmstate.h | 610 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> 5 files changed, 628 insertions(+), 26 deletions(-)
> create mode 100644 vmstate.h
>
> diff --git a/hw/ivshmem.c b/hw/ivshmem.c
> index 242fbea..a3a0e98 100644
> --- a/hw/ivshmem.c
> +++ b/hw/ivshmem.c
> @@ -18,6 +18,8 @@
> #include "pci.h"
> #include "msix.h"
> #include "kvm.h"
> +#include "migration.h"
> +#include "qerror.h"
>
> #include<sys/mman.h>
> #include<sys/types.h>
> @@ -78,6 +80,8 @@ typedef struct IVShmemState {
> uint32_t features;
> EventfdEntry *eventfd_table;
>
> + Error *migration_blocker;
> +
> char * shmobj;
> char * sizearg;
> char * role;
> @@ -646,7 +650,8 @@ static int pci_ivshmem_init(PCIDevice *dev)
> }
>
> if (s->role_val == IVSHMEM_PEER) {
> - register_device_unmigratable(&s->dev.qdev, "ivshmem", s);
> + error_set(&s->migration_blocker, QERR_DEVICE_FEATURE_BLOCKS_MIGRATION, "ivshmem", "peer mode");
> + migrate_add_blocker(s->migration_blocker);
> }
>
> pci_conf = s->dev.config;
> @@ -741,6 +746,11 @@ static int pci_ivshmem_uninit(PCIDevice *dev)
> {
> IVShmemState *s = DO_UPCAST(IVShmemState, dev, dev);
>
> + if (s->migration_blocker) {
> + migrate_del_blocker(s->migration_blocker);
> + error_free(s->migration_blocker);
> + }
> +
> memory_region_destroy(&s->ivshmem_mmio);
> memory_region_del_subregion(&s->bar,&s->ivshmem);
> memory_region_destroy(&s->ivshmem);
> diff --git a/qerror.c b/qerror.c
> index 4b48b39..8e30e2d 100644
> --- a/qerror.c
> +++ b/qerror.c
> @@ -73,6 +73,10 @@ static const QErrorStringTable qerror_table[] = {
> .desc = "Device '%(device)' is in use",
> },
> {
> + .error_fmt = QERR_DEVICE_FEATURE_BLOCKS_MIGRATION,
> + .desc = "Migration is disabled when using feature '%(feature)' in device '%(device)'",
> + },
> + {
> .error_fmt = QERR_DEVICE_LOCKED,
> .desc = "Device '%(device)' is locked",
> },
> diff --git a/qerror.h b/qerror.h
> index d4bfcfd..7e2eebf 100644
> --- a/qerror.h
> +++ b/qerror.h
> @@ -72,6 +72,9 @@ QError *qobject_to_qerror(const QObject *obj);
> #define QERR_DEVICE_IN_USE \
> "{ 'class': 'DeviceInUse', 'data': { 'device': %s } }"
>
> +#define QERR_DEVICE_FEATURE_BLOCKS_MIGRATION \
> + "{ 'class': 'DeviceFeatureBlocksMigration', 'data': { 'device': %s, 'feature': %s } }"
> +
> #define QERR_DEVICE_LOCKED \
> "{ 'class': 'DeviceLocked', 'data': { 'device': %s } }"
>
> diff --git a/savevm.c b/savevm.c
> index bee16c0..f53cd4c 100644
> --- a/savevm.c
> +++ b/savevm.c
> @@ -1255,31 +1255,6 @@ void unregister_savevm(DeviceState *dev, const char *idstr, void *opaque)
> }
> }
>
> -/* mark a device as not to be migrated, that is the device should be
> - unplugged before migration */
> -void register_device_unmigratable(DeviceState *dev, const char *idstr,
> - void *opaque)
> -{
> - SaveStateEntry *se;
> - char id[256] = "";
> -
> - if (dev&& dev->parent_bus&& dev->parent_bus->info->get_dev_path) {
> - char *path = dev->parent_bus->info->get_dev_path(dev);
> - if (path) {
> - pstrcpy(id, sizeof(id), path);
> - pstrcat(id, sizeof(id), "/");
> - g_free(path);
> - }
> - }
> - pstrcat(id, sizeof(id), idstr);
> -
> - QTAILQ_FOREACH(se,&savevm_handlers, entry) {
> - if (strcmp(se->idstr, id) == 0&& se->opaque == opaque) {
> - se->no_migrate = 1;
> - }
> - }
> -}
> -
> int vmstate_register_with_alias_id(DeviceState *dev, int instance_id,
> const VMStateDescription *vmsd,
> void *opaque, int alias_id,
> diff --git a/vmstate.h b/vmstate.h
> new file mode 100644
> index 0000000..9ea4783
> --- /dev/null
> +++ b/vmstate.h
> @@ -0,0 +1,610 @@
> +/*
> + * QEMU migration/snapshot declarations
> + *
I take it these were meant for a separate series? We still have these
defs in hw/hw.h
next prev parent reply other threads:[~2011-11-14 21:32 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-14 21:09 [Qemu-devel] [PATCH 1/5] migrate: add migration blockers Anthony Liguori
2011-11-14 21:09 ` [Qemu-devel] [PATCH 2/5] ivshmem: use migration blockers to prevent live migration in peer mode (v2) Anthony Liguori
2011-11-14 21:31 ` Michael Roth [this message]
2011-11-14 21:38 ` Anthony Liguori
2011-11-14 21:09 ` [Qemu-devel] [PATCH 3/5] block: allow migration to work with image files (v3) Anthony Liguori
2011-11-14 21:09 ` [Qemu-devel] [PATCH 4/5] qcow2: implement bdrv_invalidate_cache (v2) Anthony Liguori
2011-11-14 21:09 ` [Qemu-devel] [PATCH 5/5] qed: add migration blocker (v2) Anthony Liguori
2011-11-14 21:29 ` [Qemu-devel] [PATCH 0/5] migration: support migration with image files Anthony Liguori
2011-11-22 0:21 ` [Qemu-devel] [PATCH 1/5] migrate: add migration blockers Anthony Liguori
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=4EC188CE.50704@linux.vnet.ibm.com \
--to=mdroth@linux.vnet.ibm.com \
--cc=aliguori@us.ibm.com \
--cc=avi@redhat.com \
--cc=kwolf@redhat.com \
--cc=lmr@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.com \
--cc=stefanha@linux.vnet.ibm.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).