From: Igor Mammedov <imammedo@redhat.com>
To: Thomas Huth <thuth@redhat.com>
Cc: mjrosato@linux.vnet.ibm.com, agraf@suse.de, pkrempa@redhat.com,
ehabkost@redhat.com, aik@ozlabs.ru, armbru@redhat.com,
qemu-devel@nongnu.org, borntraeger@de.ibm.com,
qemu-ppc@nongnu.org, Bharata B Rao <bharata@linux.vnet.ibm.com>,
pbonzini@redhat.com, mdroth@linux.vnet.ibm.com, afaerber@suse.de,
david@gibson.dropbear.id.au
Subject: Re: [Qemu-devel] [RFC PATCH v2 6/9] spapr: CPU core device
Date: Mon, 14 Mar 2016 13:08:54 +0100 [thread overview]
Message-ID: <20160314130854.43a259e7@nial.brq.redhat.com> (raw)
In-Reply-To: <56E698F4.9000401@redhat.com>
On Mon, 14 Mar 2016 11:56:52 +0100
Thomas Huth <thuth@redhat.com> wrote:
> On 14.03.2016 11:25, Igor Mammedov wrote:
> > On Fri, 11 Mar 2016 10:24:35 +0530
> > Bharata B Rao <bharata@linux.vnet.ibm.com> wrote:
> >
> >> Add sPAPR specific CPU core device that is based on generic CPU core device.
> >> Creating this core device will result in creation of all the CPU thread
> >> devices that are part of this core.
> >>
> >> Introduce sPAPRMachineClass.dr_cpu_enabled to indicate support for
> >> CPU core hotplug. Initialize boot time CPUs as core deivces and prevent
> >> topologies that result in partially filled cores. Both of these are done
> >> only if CPU core hotplug is supported.
> >>
> >> Note: An unrelated change in the call to xics_system_init() is done
> >> in this patch as it makes sense to use the local variable smt introduced
> >> in this patch instead of kvmppc_smt_threads() call here.
> >>
> >> Signed-off-by: Bharata B Rao <bharata@linux.vnet.ibm.com>
> >> ---
> >> hw/ppc/Makefile.objs | 1 +
> >> hw/ppc/spapr.c | 68 +++++++++++---
> >> hw/ppc/spapr_cpu_core.c | 199 ++++++++++++++++++++++++++++++++++++++++
> >> include/hw/ppc/spapr.h | 4 +
> >> include/hw/ppc/spapr_cpu_core.h | 28 ++++++
> >> 5 files changed, 287 insertions(+), 13 deletions(-)
> >> create mode 100644 hw/ppc/spapr_cpu_core.c
> >> create mode 100644 include/hw/ppc/spapr_cpu_core.h
> >>
> >> diff --git a/hw/ppc/Makefile.objs b/hw/ppc/Makefile.objs
> >> index c1ffc77..5cc6608 100644
> >> --- a/hw/ppc/Makefile.objs
> >> +++ b/hw/ppc/Makefile.objs
> >> @@ -4,6 +4,7 @@ obj-y += ppc.o ppc_booke.o
> >> obj-$(CONFIG_PSERIES) += spapr.o spapr_vio.o spapr_events.o
> >> obj-$(CONFIG_PSERIES) += spapr_hcall.o spapr_iommu.o spapr_rtas.o
> >> obj-$(CONFIG_PSERIES) += spapr_pci.o spapr_rtc.o spapr_drc.o spapr_rng.o
> >> +obj-$(CONFIG_PSERIES) += spapr_cpu_core.o
> >> ifeq ($(CONFIG_PCI)$(CONFIG_PSERIES)$(CONFIG_LINUX), yyy)
> >> obj-y += spapr_pci_vfio.o
> >> endif
> >> diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
> >> index 64c4acc..cffe8c8 100644
> >> --- a/hw/ppc/spapr.c
> >> +++ b/hw/ppc/spapr.c
> ...
> >> @@ -1800,13 +1818,34 @@ static void ppc_spapr_init(MachineState *machine)
> >> if (machine->cpu_model == NULL) {
> >> machine->cpu_model = kvm_enabled() ? "host" : "POWER7";
> >> }
> >> - for (i = 0; i < smp_cpus; i++) {
> >> - cpu = cpu_ppc_init(machine->cpu_model);
> >> - if (cpu == NULL) {
> >> - error_report("Unable to find PowerPC CPU definition");
> >> - exit(1);
> >> +
> >> + if (smc->dr_cpu_enabled) {
> >> + spapr->cores = g_new0(Object *, spapr_max_cores);
>
> The spapr->cores _pointer_ is allocate with g_new0 here ...
>
> >> + for (i = 0; i < spapr_max_cores; i++) {
> >> + int core_dt_id = i * smt;
> >> +
> >> + if (i < spapr_cores) {
> >> + Object *core = object_new(TYPE_SPAPR_CPU_CORE);
> >> +
> >> + object_property_set_str(core, machine->cpu_model, "cpu_model",
> >> + &error_fatal);
> >> + object_property_set_int(core, smp_threads, "threads",
> >> + &error_fatal);
> >> + object_property_set_int(core, core_dt_id, CPU_CORE_PROP_CORE,
> >> + &error_fatal);
> >> + object_property_set_bool(core, true, "realized", &error_fatal);
> >> + }
> >> }
> >> - spapr_cpu_init(spapr, cpu, &error_fatal);
> >> + } else {
> >> + for (i = 0; i < smp_cpus; i++) {
> >> + PowerPCCPU *cpu = cpu_ppc_init(machine->cpu_model);
> >> + if (cpu == NULL) {
> >> + error_report("Unable to find PowerPC CPU definition");
> >> + exit(1);
> >> + }
> >> + spapr_cpu_init(spapr, cpu, &error_fatal);
> >> + }
> >> }
> ...
> >> diff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h
> >> index 098d85d..c099c3c 100644
> >> --- a/include/hw/ppc/spapr.h
> >> +++ b/include/hw/ppc/spapr.h
> >> @@ -36,6 +36,7 @@ struct sPAPRMachineClass {
> >>
> >> /*< public >*/
> >> bool dr_lmb_enabled; /* enable dynamic-reconfig/hotplug of LMBs */
> >> + bool dr_cpu_enabled; /* enable dynamic-reconfig/hotplug of CPUs */
> >> bool use_ohci_by_default; /* use USB-OHCI instead of XHCI */
> >> };
> >>
> >> @@ -79,6 +80,7 @@ struct sPAPRMachineState {
> >> /*< public >*/
> >> char *kvm_type;
> >> MemoryHotplugState hotplug_memory;
> >> + Object **cores;
> > I'd prefer "Object *cores[0];" as it tells us that it's an array
>
> ... so you can not declare it as an array here, can you??
I can't
>
> Thomas
>
next prev parent reply other threads:[~2016-03-14 12:09 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-11 4:54 [Qemu-devel] [RFC PATCH v2 0/9] Core based CPU hotplug for PowerPC sPAPR Bharata B Rao
2016-03-11 4:54 ` [Qemu-devel] [RFC PATCH v2 1/9] exec: Remove cpu from cpus list during cpu_exec_exit() Bharata B Rao
2016-03-11 11:34 ` Thomas Huth
2016-03-11 4:54 ` [Qemu-devel] [RFC PATCH v2 2/9] exec: Do vmstate unregistration from cpu_exec_exit() Bharata B Rao
2016-03-11 11:39 ` Thomas Huth
2016-03-15 6:15 ` David Gibson
2016-03-11 4:54 ` [Qemu-devel] [RFC PATCH v2 3/9] cpu: Reclaim vCPU objects Bharata B Rao
2016-03-11 11:49 ` Thomas Huth
2016-03-15 6:20 ` David Gibson
2016-03-11 4:54 ` [Qemu-devel] [RFC PATCH v2 4/9] cpu: Add a sync version of cpu_remove() Bharata B Rao
2016-03-11 4:54 ` [Qemu-devel] [RFC PATCH v2 5/9] cpu: Abstract CPU core type Bharata B Rao
2016-03-15 6:34 ` David Gibson
2016-03-11 4:54 ` [Qemu-devel] [RFC PATCH v2 6/9] spapr: CPU core device Bharata B Rao
2016-03-14 10:25 ` Igor Mammedov
2016-03-14 10:56 ` Thomas Huth
2016-03-14 12:08 ` Igor Mammedov [this message]
2016-03-15 9:14 ` Bharata B Rao
2016-03-15 9:34 ` David Gibson
2016-03-15 13:46 ` Igor Mammedov
2016-03-15 23:33 ` David Gibson
2016-03-15 13:38 ` Igor Mammedov
2016-03-11 4:54 ` [Qemu-devel] [RFC PATCH v2 7/9] spapr: CPU hotplug support Bharata B Rao
2016-03-16 5:19 ` David Gibson
2016-03-16 15:30 ` Igor Mammedov
2016-03-11 4:54 ` [Qemu-devel] [RFC PATCH v2 8/9] xics, xics_kvm: Handle CPU unplug correctly Bharata B Rao
2016-03-11 4:54 ` [Qemu-devel] [RFC PATCH v2 9/9] spapr: CPU hot unplug support Bharata B Rao
2016-03-16 5:27 ` David Gibson
2016-03-16 5:37 ` Bharata B Rao
2016-03-14 9:47 ` [Qemu-devel] [RFC PATCH v2 0/9] Core based CPU hotplug for PowerPC sPAPR Igor Mammedov
2016-03-16 3:48 ` Bharata B Rao
2016-03-16 15:48 ` Igor Mammedov
2016-03-17 10:03 ` David Gibson
2016-03-18 3:29 ` Bharata B Rao
2016-03-21 3:57 ` David Gibson
2016-03-21 10:43 ` Igor Mammedov
2016-03-22 0:22 ` David Gibson
2016-03-22 9:18 ` Igor Mammedov
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=20160314130854.43a259e7@nial.brq.redhat.com \
--to=imammedo@redhat.com \
--cc=afaerber@suse.de \
--cc=agraf@suse.de \
--cc=aik@ozlabs.ru \
--cc=armbru@redhat.com \
--cc=bharata@linux.vnet.ibm.com \
--cc=borntraeger@de.ibm.com \
--cc=david@gibson.dropbear.id.au \
--cc=ehabkost@redhat.com \
--cc=mdroth@linux.vnet.ibm.com \
--cc=mjrosato@linux.vnet.ibm.com \
--cc=pbonzini@redhat.com \
--cc=pkrempa@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
--cc=thuth@redhat.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).