From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44798) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1askTh-0005Fr-Tr for qemu-devel@nongnu.org; Wed, 20 Apr 2016 01:15:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1askTe-0008HL-Nw for qemu-devel@nongnu.org; Wed, 20 Apr 2016 01:15:05 -0400 Date: Wed, 20 Apr 2016 14:30:42 +1000 From: David Gibson Message-ID: <20160420043042.GE1133@voom> References: <1460752385-13259-1-git-send-email-duanj@linux.vnet.ibm.com> <1460752385-13259-2-git-send-email-duanj@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="0QFb0wBpEddLcDHQ" Content-Disposition: inline In-Reply-To: <1460752385-13259-2-git-send-email-duanj@linux.vnet.ibm.com> Subject: Re: [Qemu-devel] [PATCH 1/5] spapr: ensure device trees are always associated with DRC List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jianjun Duan Cc: qemu-devel@nongnu.org, qemu-ppc@nongnu.org, mdroth@linux.vnet.ibm.com --0QFb0wBpEddLcDHQ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Apr 15, 2016 at 01:33:01PM -0700, Jianjun Duan wrote: > There are possible racing situations involving hotplug events and > guest migration. For cases where a hotplug event is migrated, or > the guest is in the process of fetching device tree at the time of > migration, we need to ensure the device tree is created and > associated with the corresponding DRC for devices that were > hotplugged on the source, but 'coldplugged' on the target. >=20 > Signed-off-by: Jianjun Duan This seems fairly sensible - should be harmless and a bit cleaner whether or not we strictly speaking need it. However, it is likely to conflict with some of the device tree construction cleanups I have in my pipeline, so it may well need rework for that. > --- > hw/ppc/spapr.c | 16 ++++++---------- > hw/ppc/spapr_pci.c | 12 +++++------- > 2 files changed, 11 insertions(+), 17 deletions(-) >=20 > diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c > index feaab08..af4745c 100644 > --- a/hw/ppc/spapr.c > +++ b/hw/ppc/spapr.c > @@ -2132,15 +2132,6 @@ static void spapr_add_lmbs(DeviceState *dev, uint6= 4_t addr, uint64_t size, > int i, fdt_offset, fdt_size; > void *fdt; > =20 > - /* > - * Check for DRC connectors and send hotplug notification to the > - * guest only in case of hotplugged memory. This allows cold plugged > - * memory to be specified at boot time. > - */ > - if (!dev->hotplugged) { > - return; > - } > - > for (i =3D 0; i < nr_lmbs; i++) { > drc =3D spapr_dr_connector_by_id(SPAPR_DR_CONNECTOR_TYPE_LMB, > addr/SPAPR_MEMORY_BLOCK_SIZE); > @@ -2154,7 +2145,12 @@ static void spapr_add_lmbs(DeviceState *dev, uint6= 4_t addr, uint64_t size, > drck->attach(drc, dev, fdt, fdt_offset, !dev->hotplugged, errp); > addr +=3D SPAPR_MEMORY_BLOCK_SIZE; > } > - spapr_hotplug_req_add_by_count(SPAPR_DR_CONNECTOR_TYPE_LMB, nr_lmbs); > + /* send hotplug notification to the > + * guest only in case of hotplugged memory > + */ > + if (dev->hotplugged) { > + spapr_hotplug_req_add_by_count(SPAPR_DR_CONNECTOR_TYPE_LMB, nr_lm= bs); > + } > } > =20 > static void spapr_memory_plug(HotplugHandler *hotplug_dev, DeviceState *= dev, > diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c > index 8c20d34..b179e42 100644 > --- a/hw/ppc/spapr_pci.c > +++ b/hw/ppc/spapr_pci.c > @@ -1092,13 +1092,11 @@ static void spapr_phb_add_pci_device(sPAPRDRConne= ctor *drc, > spapr_tce_set_need_vfio(tcet, true); > } > =20 > - if (dev->hotplugged) { > - fdt =3D create_device_tree(&fdt_size); > - fdt_start_offset =3D spapr_create_pci_child_dt(phb, pdev, fdt, 0= ); > - if (!fdt_start_offset) { > - error_setg(errp, "Failed to create pci child device tree nod= e"); > - goto out; > - } > + fdt =3D create_device_tree(&fdt_size); > + fdt_start_offset =3D spapr_create_pci_child_dt(phb, pdev, fdt, 0); > + if (!fdt_start_offset) { > + error_setg(errp, "Failed to create pci child device tree node"); > + goto out; > } > =20 > drck->attach(drc, DEVICE(pdev), --=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 --0QFb0wBpEddLcDHQ Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJXFwXyAAoJEGw4ysog2bOSUaUP/28Yuf3MnP66Q3TZHO3wtzIK rOTFKTSotnfX+Xt3JBiBTfKG1WR1NjPRzJZDlyCsublK70PeataZCk8LLDkvMsdm vAHvZM9oe2hRLYVhlBaeGqeNha0mj2cG/Hx+kgl7zxgKrBuaIRfu98l2phksZ/hX joAQ+KpmCTe8bTVwOUH6n2umw/Yt5Bi2+2XpWhaz6p0f+AE6Jannp+gvG728AvOJ If4RFhFST/jCq5hyRZpuQflmW6XveqItqlTuJwql3P3+QgBei9+j4wL5l2XeYpU1 UAOAN5xctF2CoVZ8u7eCKeQNc/5BNONJu4QS3sC0YuAMrZWslmr8q8fc5Ui8Hdd/ KsNRuMHcr55bvRNLnuW9e3MgWHOJ8nxEquh91mp126Nl3zEC2ZADU1WQEKfs8VQP PcJvrGSkJgYa2v/wsJj9VwpkoP+9yMXqosfvgQK2SvFBpTCAAzO0MV8wuQ/W5FZ1 xzDT93Ie7+FVse445DHAbczjrMc2hJ1N7ssNLWdonly44iDKgH4gfX2WRua9lrAd Vn3xKIh+lItArco1sM6wSTzw/I4wOGsSQkV5d8fztjg9PnGTi+MHnFwCyQGJby5j i2q/I7IOITTsByQLKjInTNXRBNhTLO+HziIJrMHPVFbDhZK+kAICSmfD7fDvI9J7 i1KtfnB++nqJm+ZeSPGu =bo54 -----END PGP SIGNATURE----- --0QFb0wBpEddLcDHQ--