qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: David Gibson <david@gibson.dropbear.id.au>
To: Igor Mammedov <imammedo@redhat.com>
Cc: mjrosato@linux.vnet.ibm.com, thuth@redhat.com,
	pkrempa@redhat.com, ehabkost@redhat.com, aik@ozlabs.ru,
	armbru@redhat.com, agraf@suse.de, qemu-devel@nongnu.org,
	borntraeger@de.ibm.com, qemu-ppc@nongnu.org,
	Bharata B Rao <bharata@linux.vnet.ibm.com>,
	pbonzini@redhat.com, afaerber@suse.de, mdroth@linux.vnet.ibm.com
Subject: Re: [Qemu-devel] [RFC PATCH v2 6/9] spapr: CPU core device
Date: Wed, 16 Mar 2016 10:33:37 +1100	[thread overview]
Message-ID: <20160315233337.GJ9032@voom> (raw)
In-Reply-To: <20160315144637.38f190f4@nial.brq.redhat.com>

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

On Tue, Mar 15, 2016 at 02:46:37PM +0100, Igor Mammedov wrote:
> On Tue, 15 Mar 2016 20:34:28 +1100
> David Gibson <david@gibson.dropbear.id.au> wrote:
> > On Tue, Mar 15, 2016 at 02:44:01PM +0530, Bharata B Rao wrote:
> > > On Mon, Mar 14, 2016 at 11:25:23AM +0100, Igor Mammedov wrote:  
> > > > On Fri, 11 Mar 2016 10:24:35 +0530
> > > > Bharata B Rao <bharata@linux.vnet.ibm.com> wrote:
[snip]
> > > > > +    if (!core->oc) {
> > > > > +        error_setg(&local_err, "cpu_model property isn't set");
> > > > > +        goto out;
> > > > > +    }
> > > > > +
> > > > > +    core_dt_id = object_property_get_int(OBJECT(dev), "core", &local_err);
> > > > > +    if (local_err) {
> > > > > +        goto out;
> > > > > +    }
> > > > > +
> > > > > +    if (core_dt_id % smt) {
> > > > > +        error_setg(&local_err, "invalid core id %d\n", core_dt_id);
> > > > > +        goto out;
> > > > > +    }
> > > > > +
> > > > > +    core_id = core_dt_id / smt;
> > > > > +    if (core_id < 0 || core_id >= spapr_max_cores) {
> > > > > +        error_setg(&local_err, "core id %d out of range", core_dt_id);
> > > > > +        goto out;
> > > > > +    }  
> > > > maybe due to nameing it's a bit confusing,
> > > > what's difference between core_id and core_dt_id?  
> > > 
> > > core_dt_id is the device tree IDs that we use with PowerPC cores. This is
> > > what we use with "core" property of CPU_CORE. Since core_dt_id doesn't
> > > grow contiguously (Eg. it will be 0, 8, 16 etc for SMT8 guest on a POWER8 host),
> > > I am translating that to contiguous integer core_id so that I can
> > > store the pointer of the realized core in the appropriate slot of
> > > spapr->cpu_cores[] array.  
> > 
> > So, I see why the distinction is there, but it is kinda confusing.
> > I'm wondering if we could do away with the spapr->cores array entirely
> > and instead just access the core objects via the QOM tree - QOM
> > "arrays" (i.e. properties named like foo[NNN]) can be sparse, so
> > there's no need to allocate dense ids.
> Wouldn't be lookups for duplicate in QOM tree take O(N^2)
> when hot-plugging N cpus?

With the present QOM implementation, yes, although I know Paolo has
made noises about changing that to a hash table.

> It should be less with sorted array at least.

It would, but I doubt the O(N^2) will actually be a problem with
realistic numbers of cpus.

-- 
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-03-15 23:37 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
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 [this message]
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=20160315233337.GJ9032@voom \
    --to=david@gibson.dropbear.id.au \
    --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=ehabkost@redhat.com \
    --cc=imammedo@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).