From: David Gibson <david@gibson.dropbear.id.au>
To: Michael Roth <mdroth@linux.vnet.ibm.com>
Cc: aik@ozlabs.ru, qemu-devel@nongnu.org, agraf@suse.de,
qemu-ppc@nongnu.org, bharata@linux.vnet.ibm.com,
pbonzini@redhat.com
Subject: Re: [Qemu-devel] [RFCv2 2/2] spapr: Don't use QOM [*] syntax for DR connectors.
Date: Wed, 16 Sep 2015 13:18:04 +1000 [thread overview]
Message-ID: <20150916031804.GZ2547@voom.fritz.box> (raw)
In-Reply-To: <20150915040300.19285.85127@loki>
[-- Attachment #1: Type: text/plain, Size: 4043 bytes --]
On Mon, Sep 14, 2015 at 11:03:00PM -0500, Michael Roth wrote:
> Quoting David Gibson (2015-09-13 20:41:53)
> > The dynamic reconfiguration (hotplug) code for the pseries machine type
> > uses a "DR connector" QOM object for each resource it will be possible
> > to hotplug. Each of these is added to its owner using
> > object_property_add_child(owner, "dr-connector[*], ...);
> >
> > That works ok, mostly, but it means that the property indices are
> > arbitrary, depending on the order in which the connectors are constructed.
> > When we have both memory and cpu hotplug, the connectors will be under the
> > same parent (at least in the current drafts), meaning the indices don't
> > correspond to any meaningful ID.
> >
> > It gets worse when large amounts of hotpluggable RAM is configured. For
> > RAM, there's a DR connector object for every 256MB of potential memory. So
> > if maxmem=2T, for example, there are 8192 objects under the same parent.
> >
> > The QOM interfaces aren't really designed for this. In particular
> > object_property_add() with [*] has O(n^2) time complexity (in the number of
> > existing children): first it has a linear search through array indices to
> > find a free slot, each of which is attempted to a recursive call to
> > object_property_add() with a specific [N]. Those calls are O(n) because
> > there's a linear search through all properties to check for duplicates.
> >
> > By using a meaningful index value, which we already know is unique we can
> > avoid the [*] special behaviour. That lets us reduce the total time for
> > creating the DR objects from O(n^3) to O(n^2).
> >
> > O(n^2) is still kind of crappy, but it's enough to reduce the startup time
> > of qemu with maxmem=2T from ~20 minutes to ~4 seconds.
> >
> > Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
> > Cc: Bharata B Rao <bharata@linux.vnet.ibm.com>
>
> This is the second patch I've seen that drops use of "[*]" for
> performance reasons, but looking at the code I don't really see
> any reason that logic can't be implemented in object_property_add()
> in O(n) time. For instance I think it can be achieved by
> storing/hashing the base string to an array of auto-incremented
> indicies that we update whenever a child with the corresponding
> <base_string>[n] format is added.
Oh, there's no question that could be done. The question is: is
thousands of QOM objects under a single parent a use case that we
actually want to build QOM for?
> I wouldn't hold this real fix up for that though, and in fact the
> use of DRC indexes make for much easier debugging anyway so I'd
> probably still prefer this approach anyway.
>
> Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com>
>
> > ---
> > hw/ppc/spapr_drc.c | 5 ++++-
> > 1 file changed, 4 insertions(+), 1 deletion(-)
> >
> > diff --git a/hw/ppc/spapr_drc.c b/hw/ppc/spapr_drc.c
> > index 68e0c3e..2f95259 100644
> > --- a/hw/ppc/spapr_drc.c
> > +++ b/hw/ppc/spapr_drc.c
> > @@ -451,13 +451,16 @@ sPAPRDRConnector *spapr_dr_connector_new(Object *owner,
> > {
> > sPAPRDRConnector *drc =
> > SPAPR_DR_CONNECTOR(object_new(TYPE_SPAPR_DR_CONNECTOR));
> > + char *prop_name;
> >
> > g_assert(type);
> >
> > drc->type = type;
> > drc->id = id;
> > - object_property_add_child(owner, "dr-connector[*]", OBJECT(drc), NULL);
> > + prop_name = g_strdup_printf("dr-connector[%"PRIu32"]", get_index(drc));
> > + object_property_add_child(owner, prop_name, OBJECT(drc), NULL);
> > object_property_set_bool(OBJECT(drc), true, "realized", NULL);
> > + g_free(prop_name);
> >
> > /* human-readable name for a DRC to encode into the DT
> > * description. this is mainly only used within a guest in place
>
--
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: Type: application/pgp-signature, Size: 819 bytes --]
prev parent reply other threads:[~2015-09-16 3:25 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-14 1:41 [Qemu-devel] [RFCv2 0/2] spapr: Cleanups to dynamic reconfiguration mechanism David Gibson
2015-09-14 1:41 ` [Qemu-devel] [RFCv2 1/2] spapr: Remove unnecessary owner field from sPAPRDRConnector David Gibson
2015-09-14 6:23 ` Bharata B Rao
2015-09-14 8:22 ` Alexey Kardashevskiy
2015-09-14 11:45 ` David Gibson
2015-09-14 12:11 ` Paolo Bonzini
2015-09-14 14:06 ` Alexey Kardashevskiy
2015-09-14 14:24 ` Paolo Bonzini
2015-09-16 3:16 ` David Gibson
2015-09-17 15:50 ` Michael Roth
2015-09-17 15:53 ` Paolo Bonzini
2015-09-17 23:03 ` Michael Roth
2015-09-17 15:01 ` Michael Roth
2015-09-15 0:31 ` David Gibson
2015-09-15 0:30 ` David Gibson
2015-09-15 11:05 ` Paolo Bonzini
2015-09-14 1:41 ` [Qemu-devel] [RFCv2 2/2] spapr: Don't use QOM [*] syntax for DR connectors David Gibson
2015-09-14 4:07 ` Bharata B Rao
2015-09-14 4:14 ` David Gibson
2015-09-14 4:41 ` Bharata B Rao
2015-09-14 5:20 ` David Gibson
2015-09-14 8:13 ` Alexey Kardashevskiy
2015-09-15 4:03 ` Michael Roth
2015-09-15 4:21 ` Michael Roth
2015-09-16 3:18 ` David Gibson [this message]
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=20150916031804.GZ2547@voom.fritz.box \
--to=david@gibson.dropbear.id.au \
--cc=agraf@suse.de \
--cc=aik@ozlabs.ru \
--cc=bharata@linux.vnet.ibm.com \
--cc=mdroth@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).