From: Greg Kurz <groug@kaod.org>
To: qemu-ppc@nongnu.org, qemu-devel@nongnu.org
Cc: David Gibson <david@gibson.dropbear.id.au>,
Cedric Le Goater <clg@kaod.org>,
Bharata B Rao <bharata@linux.vnet.ibm.com>
Subject: Re: [Qemu-devel] [Qemu-ppc] [PATCH 6/6] spapr: fix migration of ICP objects from/to older QEMU
Date: Tue, 16 May 2017 11:53:42 +0200 [thread overview]
Message-ID: <20170516115342.5530d62d@bahia> (raw)
In-Reply-To: <149484840466.20089.893964776019028654.stgit@bahia.lan>
[-- Attachment #1: Type: text/plain, Size: 3552 bytes --]
On Mon, 15 May 2017 13:40:04 +0200
Greg Kurz <groug@kaod.org> wrote:
> Commit 5bc8d26de20c ("spapr: allocate the ICPState object from under
> sPAPRCPUCore") moved ICP objects from the machine to CPU cores. This
> is an improvement since we no longer allocate ICP objects that will
> never be used. But it has the side-effect of breaking migration of
> older machine types from older QEMU versions.
>
> This patch introduces a compat flag in the sPAPR machine class so
> that all pseries machine up to 2.9 go on with the previous behavior
> of pre-allocating ICP objects.
>
> While here, we also ensure that object_property_add_child() errors cause
> QEMU to abort for newer machines.
>
Looking at the code again...
> Signed-off-by: Greg Kurz <groug@kaod.org>
> ---
> hw/ppc/spapr.c | 36 ++++++++++++++++++++++++++++++++++++
> hw/ppc/spapr_cpu_core.c | 28 ++++++++++++++++++++--------
> include/hw/ppc/spapr.h | 2 ++
> 3 files changed, 58 insertions(+), 8 deletions(-)
[...]
> @@ -142,12 +145,19 @@ static void spapr_cpu_core_realize_child(Object *child, Error **errp)
> PowerPCCPU *cpu = POWERPC_CPU(cs);
> Object *obj;
>
> - obj = object_new(spapr->icp_type);
> - object_property_add_child(OBJECT(cpu), "icp", obj, NULL);
... I now realize that we're lacking
object_unref(obj);
and the ref count of the ICP object can never go down to zero...
I'll fix that in a preparatory patch for v2.
> - object_property_add_const_link(obj, "xics", OBJECT(spapr), &error_abort);
> - object_property_set_bool(obj, true, "realized", &local_err);
> - if (local_err) {
> - goto error;
> + if (spapr->legacy_icps) {
> + int index = cpu->parent_obj.cpu_index;
> +
> + obj = OBJECT(&spapr->legacy_icps[index]);
> + } else {
> + obj = object_new(spapr->icp_type);
> + object_property_add_child(OBJECT(cpu), "icp", obj, &error_abort);
> + object_property_add_const_link(obj, "xics", OBJECT(spapr),
> + &error_abort);
> + object_property_set_bool(obj, true, "realized", &local_err);
> + if (local_err) {
> + goto error;
> + }
> }
>
> object_property_set_bool(child, true, "realized", &local_err);
> @@ -164,7 +174,9 @@ static void spapr_cpu_core_realize_child(Object *child, Error **errp)
> return;
>
> error:
> - object_unparent(obj);
> + if (!spapr->legacy_icps) {
> + object_unparent(obj);
> + }
> error_propagate(errp, local_err);
> }
>
> diff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h
> index 5802f888c39d..72cd5af2679b 100644
> --- a/include/hw/ppc/spapr.h
> +++ b/include/hw/ppc/spapr.h
> @@ -53,6 +53,7 @@ struct sPAPRMachineClass {
> bool dr_lmb_enabled; /* enable dynamic-reconfig/hotplug of LMBs */
> bool use_ohci_by_default; /* use USB-OHCI instead of XHCI */
> const char *tcg_default_cpu; /* which (TCG) CPU to simulate by default */
> + bool must_pre_allocate_icps; /* only for pseries-2.9 and older */
> void (*phb_placement)(sPAPRMachineState *spapr, uint32_t index,
> uint64_t *buid, hwaddr *pio,
> hwaddr *mmio32, hwaddr *mmio64,
> @@ -109,6 +110,7 @@ struct sPAPRMachineState {
> MemoryHotplugState hotplug_memory;
>
> const char *icp_type;
> + ICPState *legacy_icps;
> };
>
> #define H_SUCCESS 0
>
>
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]
next prev parent reply other threads:[~2017-05-16 9:53 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-15 11:38 [Qemu-devel] [PATCH 0/6] spapr/xics: fix migration of older machine types Greg Kurz
2017-05-15 11:39 ` [Qemu-devel] [PATCH 1/6] ppc/xics: simplify prototype of xics_spapr_init() Greg Kurz
2017-05-15 12:09 ` Cédric Le Goater
2017-05-15 13:36 ` Philippe Mathieu-Daudé
2017-05-16 4:30 ` David Gibson
2017-05-15 11:39 ` [Qemu-devel] [PATCH 2/6] spapr: fix error path of required kernel-irqchip Greg Kurz
2017-05-15 11:47 ` Cédric Le Goater
2017-05-16 4:35 ` David Gibson
2017-05-16 5:56 ` Greg Kurz
2017-05-16 6:08 ` David Gibson
2017-05-16 6:22 ` Greg Kurz
2017-05-15 11:39 ` [Qemu-devel] [PATCH 3/6] spapr: fix error reporting in xics_system_init() Greg Kurz
2017-05-15 11:48 ` Cédric Le Goater
2017-05-16 4:37 ` David Gibson
2017-05-15 11:39 ` [Qemu-devel] [PATCH 4/6] spapr: sanitize error handling in spapr_ics_create() Greg Kurz
2017-05-15 11:59 ` Cédric Le Goater
2017-05-15 12:06 ` Greg Kurz
2017-05-16 4:39 ` David Gibson
2017-05-16 4:39 ` David Gibson
2017-05-15 11:39 ` [Qemu-devel] [PATCH 5/6] spapr-cpu-core: release ICP object when realization fails Greg Kurz
2017-05-15 12:02 ` Cédric Le Goater
2017-05-15 12:17 ` Greg Kurz
2017-05-16 4:41 ` David Gibson
2017-05-15 11:40 ` [Qemu-devel] [PATCH 6/6] spapr: fix migration of ICP objects from/to older QEMU Greg Kurz
2017-05-15 12:22 ` Cédric Le Goater
2017-05-15 13:16 ` Greg Kurz
2017-05-15 16:09 ` Cédric Le Goater
2017-05-15 16:20 ` Greg Kurz
2017-05-17 4:17 ` David Gibson
2017-05-15 16:11 ` Cédric Le Goater
2017-05-15 16:22 ` Greg Kurz
2017-05-17 4:18 ` David Gibson
2017-05-17 20:33 ` Greg Kurz
2017-05-19 6:40 ` David Gibson
2017-05-17 4:16 ` David Gibson
2017-05-17 4:14 ` David Gibson
2017-05-16 9:53 ` Greg Kurz [this message]
2017-05-15 12:13 ` [Qemu-devel] [PATCH 0/6] spapr/xics: fix migration of older machine types no-reply
2017-05-15 12:19 ` Greg Kurz
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=20170516115342.5530d62d@bahia \
--to=groug@kaod.org \
--cc=bharata@linux.vnet.ibm.com \
--cc=clg@kaod.org \
--cc=david@gibson.dropbear.id.au \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.