From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:32800) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZbMBY-0000k9-0A for qemu-devel@nongnu.org; Mon, 14 Sep 2015 01:20:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZbMBW-0002pw-VU for qemu-devel@nongnu.org; Mon, 14 Sep 2015 01:20:12 -0400 Date: Mon, 14 Sep 2015 15:20:30 +1000 From: David Gibson Message-ID: <20150914052030.GK2547@voom.fritz.box> References: <1442194913-26545-1-git-send-email-david@gibson.dropbear.id.au> <1442194913-26545-3-git-send-email-david@gibson.dropbear.id.au> <20150914040716.GO17433@in.ibm.com> <20150914041459.GJ2547@voom.fritz.box> <20150914044150.GP17433@in.ibm.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="C7Ke/meiCZutM6I/" Content-Disposition: inline In-Reply-To: <20150914044150.GP17433@in.ibm.com> Subject: Re: [Qemu-devel] [RFCv2 2/2] spapr: Don't use QOM [*] syntax for DR connectors. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Bharata B Rao Cc: agraf@suse.de, aik@ozlabs.ru, qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com, qemu-ppc@nongnu.org, pbonzini@redhat.com --C7Ke/meiCZutM6I/ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Sep 14, 2015 at 10:11:50AM +0530, Bharata B Rao wrote: > On Mon, Sep 14, 2015 at 02:14:59PM +1000, David Gibson wrote: > > On Mon, Sep 14, 2015 at 09:37:16AM +0530, Bharata B Rao wrote: > > > On Mon, Sep 14, 2015 at 11:41:53AM +1000, David Gibson wrote: > > > > The dynamic reconfiguration (hotplug) code for the pseries machine = type > > > > uses a "DR connector" QOM object for each resource it will be possi= ble > > > > to hotplug. Each of these is added to its owner using > > > > object_property_add_child(owner, "dr-connector[*], ...); > > > >=20 > > > > That works ok, mostly, but it means that the property indices are > > > > arbitrary, depending on the order in which the connectors are const= ructed. > > > > When we have both memory and cpu hotplug, the connectors will be un= der the > > > > same parent (at least in the current drafts), meaning the indices d= on't > > > > correspond to any meaningful ID. > > > >=20 > > > > It gets worse when large amounts of hotpluggable RAM is configured.= For > > > > RAM, there's a DR connector object for every 256MB of potential mem= ory. So > > > > if maxmem=3D2T, for example, there are 8192 objects under the same = parent. > > > >=20 > > > > The QOM interfaces aren't really designed for this. In particular > > > > object_property_add() with [*] has O(n^2) time complexity (in the n= umber of > > > > existing children): first it has a linear search through array indi= ces 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) be= cause > > > > there's a linear search through all properties to check for duplica= tes. > > > >=20 > > > > By using a meaningful index value, which we already know is unique = we can > > > > avoid the [*] special behaviour. That lets us reduce the total tim= e for > > > > creating the DR objects from O(n^3) to O(n^2). > > > >=20 > > > > O(n^2) is still kind of crappy, but it's enough to reduce the start= up time > > > > of qemu with maxmem=3D2T from ~20 minutes to ~4 seconds. > > > >=20 > > > > Signed-off-by: David Gibson > > > > Cc: Bharata B Rao > > >=20 > > > This patch works correctly with both CPU and memory hotplug. > >=20 > > Care to send a Reviewed-by and/or Tested-by in that case? >=20 > Sorry, >=20 > Tested-by: Bharata B Rao If you could send one for the cleanup in 1/2 as well, that would be nice. --=20 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 --C7Ke/meiCZutM6I/ Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJV9lkeAAoJEGw4ysog2bOSbqkQAMpWGep+I95TI20WqO2dmlr7 eBH+kyp7u+qpaNWOY2onv2jyB0uClC9pTAzIZPFPvIEAp2XSDzimYXbU0iJpls99 L298dffbMRIIFIsa4tyfn6tr9ivU5VY87XpalutUuoHXnhzlcP5RWXRrsxt8FzRM LuP7u0lVbWhFOYva1sS4oFSHbJHDn14qEn1KBh+ssHH+32JU++/Fmze7JyiC+lj+ hyP9GOHqrba67u7Am9Wm4Kie11b+aOI5PKNxsMPJviDBYKhKC8nZk2FnYicZGS8p lZYzX8W7DSFKuOyPJKUsWwkGSZQT8LAcK0r58ySGeUOLVXOmkwNn9Xjrkboz4TxJ YvIiIiVNTUN/zZETpdt9r1N/pC7OiuyLviR+5OBTT7A1D8pwmPxwV4qrKQziuoZJ nJrGyhfr84IT5/wgBs5TOV6MWGxgyn9PVtFTnA3+hD8PXEZbDwADcvVxxOd8DhTu sz+pLPKSFDIOtSALLIwu5taUqEH94FHcgDbK9IPvGOpT3wG8CCK5oifSpi+jNgMR eY/utTxeq3D0sRQGuF8rXNv7CpkfBCsHk3HgVDj/DvlHpIPrT8HBD65Xf+wl5CzU uj7q058+9YcQfJYrzQ7weOxn5jR/dRGSnFlkaeArWDaYukMTGuYAlFNIA/bG0vxo VznnRScrpMsIB6U6E1mg =mhjF -----END PGP SIGNATURE----- --C7Ke/meiCZutM6I/--