qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: David Gibson <david@gibson.dropbear.id.au>
To: Bharata B Rao <bharata@linux.vnet.ibm.com>
Cc: peter.maydell@linaro.org, agraf@suse.de, pbonzini@redhat.com,
	qemu-ppc@nongnu.org, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PULL 1/2] spapr: Error out when CPU hotplug is attempted on older pseries machines
Date: Fri, 5 Aug 2016 12:16:42 +1000	[thread overview]
Message-ID: <20160805021641.GI9189@voom.fritz.box> (raw)
In-Reply-To: <20160804104453.GB13652@in.ibm.com>

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

On Thu, Aug 04, 2016 at 04:14:53PM +0530, Bharata B Rao wrote:
> On Wed, Aug 03, 2016 at 03:25:50PM +1000, David Gibson wrote:
> > From: Bharata B Rao <bharata@linux.vnet.ibm.com>
> > 
> > CPU hotplug and coldplug aren't supported prior to pseries-2.7.  Further,
> > earlier machine types don't use CPU core objects at all.  These mean that
> > query-hotpluggable-cpus and coldplug on older pseries machines will crash
> > QEMU.  It also means that hotpluggable_cpus flag in query-machines will
> > be incorrectly set to true for pseries < 2.7, since it is based on the
> > presence of the query_hotpluggable_cpus hook.
> > 
> > - Don't assign the query_hotpluggable_cpus hook for pseries < 2.7
> > - query_hotpluggable_cpus should therefore never be called on pseries <
> >   2.7, so add an assert
> > - spapr_core_pre_plug() should fail hot/cold plug attempts for pseries <
> >   2.7, since core objects are never used there
> > - spapr_core_plug() should therefore never be called for pseries < 2.7, so
> >   add an assert.
> > 
> > Signed-off-by: Bharata B Rao <bharata@linux.vnet.ibm.com>
> > [dwg: Change from query_hotpluggable_cpus returning NULL for pseries < 2.7
> >  to not being called at all, reword commit message for accuracy]
> > Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
> > ---
> >  hw/ppc/spapr.c          |  7 ++++++-
> >  hw/ppc/spapr_cpu_core.c | 19 ++++++-------------
> >  2 files changed, 12 insertions(+), 14 deletions(-)
> > 
> > diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
> > index fbbd051..bce2371 100644
> > --- a/hw/ppc/spapr.c
> > +++ b/hw/ppc/spapr.c
> > @@ -2376,8 +2376,11 @@ static HotpluggableCPUList *spapr_query_hotpluggable_cpus(MachineState *machine)
> >      int i;
> >      HotpluggableCPUList *head = NULL;
> >      sPAPRMachineState *spapr = SPAPR_MACHINE(machine);
> > +    sPAPRMachineClass *smc = SPAPR_MACHINE_GET_CLASS(machine);
> >      int spapr_max_cores = max_cpus / smp_threads;
> > 
> > +    g_assert(smc->dr_cpu_enabled);
> > +
> >      for (i = 0; i < spapr_max_cores; i++) {
> >          HotpluggableCPUList *list_item = g_new0(typeof(*list_item), 1);
> >          HotpluggableCPU *cpu_item = g_new0(typeof(*cpu_item), 1);
> > @@ -2432,7 +2435,9 @@ static void spapr_machine_class_init(ObjectClass *oc, void *data)
> >      hc->plug = spapr_machine_device_plug;
> >      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;
> > +    if (smc->dr_cpu_enabled) {
> > +        mc->query_hotpluggable_cpus = spapr_query_hotpluggable_cpus;
> > +    }
> > 
> >      smc->dr_lmb_enabled = true;
> >      smc->dr_cpu_enabled = true;
> 
> Unfortunately smc->dr_cpu_enabled is always false when you set
> mc->query_hotpluggable_cpus and will be set to true immediately
> afterwards as seen in above hunk.
> 
> This leads to query-hotpluggable-cpus being unavailable for all
> machine type versions. Your first version of setting
> mc->query_hotpluggable_cpus to NULL explicitly for 2.6 and downwards
> was correct.

*facepalm* I can't believe I forgot to check that.


In fact.. we could just replace dr_lmb_enabled with the NULL or
not-NULL status of query_hotpluggable_cpus.

I'll send a fix shortly.

-- 
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-08-05  6:47 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-03  5:25 [Qemu-devel] [PULL 0/2] ppc-for-2.7 queue 20160803 David Gibson
2016-08-03  5:25 ` [Qemu-devel] [PULL 1/2] spapr: Error out when CPU hotplug is attempted on older pseries machines David Gibson
2016-08-04 10:44   ` Bharata B Rao
2016-08-05  2:16     ` David Gibson [this message]
2016-08-03  5:25 ` [Qemu-devel] [PULL 2/2] kvm-irqchip: only commit route when irqchip is used David Gibson
2016-08-03 12:40 ` [Qemu-devel] [PULL 0/2] ppc-for-2.7 queue 20160803 Peter Maydell

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=20160805021641.GI9189@voom.fritz.box \
    --to=david@gibson.dropbear.id.au \
    --cc=agraf@suse.de \
    --cc=bharata@linux.vnet.ibm.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --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).