qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: David Gibson <david@gibson.dropbear.id.au>
To: Jianjun Duan <duanj@linux.vnet.ibm.com>
Cc: qemu-devel@nongnu.org, qemu-ppc@nongnu.org, mdroth@linux.vnet.ibm.com
Subject: Re: [Qemu-devel] [PATCH 2/5] Migration: Defined VMStateDescription struct for spapr_drc
Date: Wed, 20 Apr 2016 14:32:52 +1000	[thread overview]
Message-ID: <20160420043252.GF1133@voom> (raw)
In-Reply-To: <1460752385-13259-3-git-send-email-duanj@linux.vnet.ibm.com>

[-- Attachment #1: Type: text/plain, Size: 3101 bytes --]

On Fri, Apr 15, 2016 at 01:33:02PM -0700, Jianjun Duan wrote:
> To manage hotplug/unplug of dynamic resources such as PCI cards,
> memory, and CPU on sPAPR guests, a firmware abstraction known as
> a Dynamic Resource Connector (DRC) is used to assign a particular
> dynamic resource to the guest, and provide an interface for the
> guest to manage configuration/removal of the resource associated
> with it.
> 
> To migrate the hotplugged resources in migration, the
> associated DRC state need be migrated. To migrate the DRC state,
> we defined the VMStateDescription struct for spapr_drc to enable
> the transmission of spapr_drc state in migration.
> 
> Not all the elements in the DRC state are migrated. Only those
> ones modifiable by guest actions or device add/remove operation
> are migrated.
> 
> Signed-off-by: Jianjun Duan <duanj@linux.vnet.ibm.com>

Urgh.  It would be really nice if we could avoid this and instead
calculate these states from other information.  I hate migrating
what's essentially transitory state if we can possibly avoid it - is
there any way to defer or retry hotplug operations to make this
unnececessary?

Even if we have to migrate some state here, I'm a bit dubious about
whether directly migrating the PAPR indicator states is the best way.
It does have the advantage of having a spec, on the other hand the
PAPR indicators are really weird and hard to understand the meaning
of.

> ---
>  hw/ppc/spapr_drc.c | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)
> 
> diff --git a/hw/ppc/spapr_drc.c b/hw/ppc/spapr_drc.c
> index 3173940..5f7a25f 100644
> --- a/hw/ppc/spapr_drc.c
> +++ b/hw/ppc/spapr_drc.c
> @@ -610,6 +610,20 @@ static void spapr_dr_connector_instance_init(Object *obj)
>                          NULL, NULL, NULL, NULL);
>  }
>  
> +static const VMStateDescription vmstate_spapr_drc = {
> +    .name = "spapr_drc",
> +    .version_id = 1,
> +    .minimum_version_id = 1,
> +    .fields  = (VMStateField []) {
> +        VMSTATE_UINT32(isolation_state, sPAPRDRConnector),
> +        VMSTATE_UINT32(allocation_state, sPAPRDRConnector),
> +        VMSTATE_UINT32(indicator_state, sPAPRDRConnector),
> +        VMSTATE_BOOL(configured, sPAPRDRConnector),
> +        VMSTATE_BOOL(awaiting_release, sPAPRDRConnector),
> +        VMSTATE_END_OF_LIST()
> +    }
> +};
> +
>  static void spapr_dr_connector_class_init(ObjectClass *k, void *data)
>  {
>      DeviceClass *dk = DEVICE_CLASS(k);
> @@ -618,6 +632,7 @@ static void spapr_dr_connector_class_init(ObjectClass *k, void *data)
>      dk->reset = reset;
>      dk->realize = realize;
>      dk->unrealize = unrealize;
> +    dk->vmsd = &vmstate_spapr_drc;
>      drck->set_isolation_state = set_isolation_state;
>      drck->set_indicator_state = set_indicator_state;
>      drck->set_allocation_state = set_allocation_state;

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

  reply	other threads:[~2016-04-20  5:15 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-15 20:33 [Qemu-devel] [PATCH 0/5] migration: ensure hotplug and migration work together Jianjun Duan
2016-04-15 20:33 ` [Qemu-devel] [PATCH 1/5] spapr: ensure device trees are always associated with DRC Jianjun Duan
2016-04-20  4:30   ` David Gibson
2016-04-21 16:53     ` [Qemu-devel] [Qemu-ppc] " Jianjun Duan
2016-04-15 20:33 ` [Qemu-devel] [PATCH 2/5] Migration: Defined VMStateDescription struct for spapr_drc Jianjun Duan
2016-04-20  4:32   ` David Gibson [this message]
2016-04-21 17:03     ` Jianjun Duan
2016-04-22  4:25       ` David Gibson
2016-04-22 16:47         ` [Qemu-devel] [Qemu-ppc] " Jianjun Duan
2016-04-15 20:33 ` [Qemu-devel] [PATCH 3/5] vmstate: Define VARRAY with VMS_ALLOC Jianjun Duan
2016-04-15 20:33 ` [Qemu-devel] [PATCH 4/5] Migration: migrate ccs_list in spapr state Jianjun Duan
2016-04-20  5:14   ` David Gibson
2016-04-21 17:22     ` Jianjun Duan
2016-04-22  4:28       ` David Gibson
2016-04-22 16:55         ` Jianjun Duan
2016-04-15 20:33 ` [Qemu-devel] [PATCH 5/5] Migration: migrate pending_events of " Jianjun Duan
2016-04-20  4:29 ` [Qemu-devel] [PATCH 0/5] migration: ensure hotplug and migration work together David Gibson

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=20160420043252.GF1133@voom \
    --to=david@gibson.dropbear.id.au \
    --cc=duanj@linux.vnet.ibm.com \
    --cc=mdroth@linux.vnet.ibm.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@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).