qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Bharata B Rao <bharata@linux.vnet.ibm.com>
To: qemu-devel@nongnu.org
Cc: qemu-ppc@nongnu.org, david@gibson.dropbear.id.au,
	imammedo@redhat.com, groug@kaod.org, nikunj@linux.vnet.ibm.com,
	pbonzini@redhat.com, Bharata B Rao <bharata@linux.vnet.ibm.com>
Subject: [Qemu-devel] [RFC PATCH v0 5/5] spapr: Prefer arch_id over cpu_index
Date: Tue,  5 Jul 2016 10:12:52 +0530	[thread overview]
Message-ID: <1467693772-7391-6-git-send-email-bharata@linux.vnet.ibm.com> (raw)
In-Reply-To: <1467693772-7391-1-git-send-email-bharata@linux.vnet.ibm.com>

Starting from pseries-2.7, prefer the use of arch_id (cpu_dt_id) over
cpu_index for cpu vmstate registration and in XICS code.

This allows migration to work when CPU cores are not necessarily
unplugged in LIFO order.

Signed-off-by: Bharata B Rao <bharata@linux.vnet.ibm.com>
---
 hw/ppc/spapr.c          | 2 ++
 hw/ppc/spapr_cpu_core.c | 5 +++++
 2 files changed, 7 insertions(+)

diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index 7f33a1b..caa6254 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -2426,6 +2426,7 @@ static void spapr_machine_class_init(ObjectClass *oc, void *data)
     hc->unplug = spapr_machine_device_unplug;
     mc->cpu_index_to_socket_id = spapr_cpu_index_to_socket_id;
     mc->query_hotpluggable_cpus = spapr_query_hotpluggable_cpus;
+    mc->prefer_arch_id_over_cpu_index = true;
 
     smc->dr_lmb_enabled = true;
     smc->dr_cpu_enabled = true;
@@ -2512,6 +2513,7 @@ static void spapr_machine_2_6_class_options(MachineClass *mc)
     sPAPRMachineClass *smc = SPAPR_MACHINE_CLASS(mc);
 
     spapr_machine_2_7_class_options(mc);
+    mc->prefer_arch_id_over_cpu_index = false;
     smc->dr_cpu_enabled = false;
     SET_MACHINE_COMPAT(mc, SPAPR_COMPAT_2_6);
 }
diff --git a/hw/ppc/spapr_cpu_core.c b/hw/ppc/spapr_cpu_core.c
index 70b6b0b..4bfd01e 100644
--- a/hw/ppc/spapr_cpu_core.c
+++ b/hw/ppc/spapr_cpu_core.c
@@ -281,6 +281,8 @@ static void spapr_cpu_core_realize_child(Object *child, Error **errp)
 
 static void spapr_cpu_core_realize(DeviceState *dev, Error **errp)
 {
+    MachineState *machine = MACHINE(qdev_get_machine());
+    MachineClass *mc = MACHINE_GET_CLASS(machine);
     sPAPRCPUCore *sc = SPAPR_CPU_CORE(OBJECT(dev));
     CPUCore *cc = CPU_CORE(OBJECT(dev));
     const char *typename = object_class_get_name(sc->cpu_class);
@@ -295,6 +297,9 @@ static void spapr_cpu_core_realize(DeviceState *dev, Error **errp)
         obj = sc->threads + i * size;
 
         object_initialize(obj, size, typename);
+        if (mc->prefer_arch_id_over_cpu_index) {
+            CPU(obj)->prefer_arch_id_over_cpu_index = true;
+        }
         snprintf(id, sizeof(id), "thread[%d]", i);
         object_property_add_child(OBJECT(sc), id, obj, &local_err);
         if (local_err) {
-- 
2.7.4

  parent reply	other threads:[~2016-07-05  4:43 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-05  4:42 [Qemu-devel] [RFC PATCH v0 0/5] sPAPR: Fix migration when CPUs are removed in random order Bharata B Rao
2016-07-05  4:42 ` [Qemu-devel] [RFC PATCH v0 1/5] cpu: Factor out cpu vmstate_[un]register into separate routines Bharata B Rao
2016-07-05  4:56   ` David Gibson
2016-07-05  5:16     ` Bharata B Rao
2016-07-05  5:49       ` Igor Mammedov
2016-07-05  6:35         ` Bharata B Rao
2016-07-05  7:22           ` Igor Mammedov
2016-07-05  7:38             ` Bharata B Rao
2016-07-05  8:01               ` Igor Mammedov
2016-07-05  7:29           ` Greg Kurz
2016-07-05  4:42 ` [Qemu-devel] [RFC PATCH v0 2/5] cpu: Optionally use arch_id instead of cpu_index in cpu vmstate_register() Bharata B Rao
2016-07-05  4:56   ` David Gibson
2016-07-05  5:22     ` Bharata B Rao
2016-07-05  6:59   ` Igor Mammedov
2016-07-05  7:15   ` Igor Mammedov
2016-07-05 12:43     ` Bharata B Rao
2016-07-06  5:25       ` Igor Mammedov
2016-07-06  8:25         ` Bharata B Rao
2016-07-07  2:08           ` David Gibson
2016-07-07 17:19         ` Greg Kurz
2016-07-05  7:20   ` Greg Kurz
2016-07-05  4:42 ` [Qemu-devel] [RFC PATCH v0 3/5] spapr: Implement CPUClass.get_arch_id() for PowerPC CPUs Bharata B Rao
2016-07-05  4:58   ` David Gibson
2016-07-05  4:42 ` [Qemu-devel] [RFC PATCH v0 4/5] xics: Use arch_id instead of cpu_index in XICS code Bharata B Rao
2016-07-05  4:59   ` David Gibson
2016-07-05  7:03     ` Igor Mammedov
2016-07-05  4:42 ` Bharata B Rao [this message]
2016-07-05  7:10 ` [Qemu-devel] [RFC PATCH v0 0/5] sPAPR: Fix migration when CPUs are removed in random order 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=1467693772-7391-6-git-send-email-bharata@linux.vnet.ibm.com \
    --to=bharata@linux.vnet.ibm.com \
    --cc=david@gibson.dropbear.id.au \
    --cc=groug@kaod.org \
    --cc=imammedo@redhat.com \
    --cc=nikunj@linux.vnet.ibm.com \
    --cc=pbonzini@redhat.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).