From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38782) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1anc0e-0007QC-MG for qemu-devel@nongnu.org; Tue, 05 Apr 2016 21:11:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1anc0d-0005h6-Ek for qemu-devel@nongnu.org; Tue, 05 Apr 2016 21:11:52 -0400 Date: Wed, 6 Apr 2016 10:43:46 +1000 From: David Gibson Message-ID: <20160406004346.GW16485@voom.fritz.box> References: <1459413561-30745-1-git-send-email-bharata@linux.vnet.ibm.com> <1459413561-30745-12-git-send-email-bharata@linux.vnet.ibm.com> <20160406002439.589.59245@loki> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="RCcFxJ34+mAtH0DM" Content-Disposition: inline In-Reply-To: <20160406002439.589.59245@loki> Subject: Re: [Qemu-devel] [RFC PATCH v2.1 11/12] xics, xics_kvm: Handle CPU unplug correctly List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Michael Roth Cc: mjrosato@linux.vnet.ibm.com, agraf@suse.de, thuth@redhat.com, pkrempa@redhat.com, ehabkost@redhat.com, aik@ozlabs.ru, armbru@redhat.com, qemu-devel@nongnu.org, borntraeger@de.ibm.com, pbonzini@redhat.com, qemu-ppc@nongnu.org, Bharata B Rao , imammedo@redhat.com, afaerber@suse.de --RCcFxJ34+mAtH0DM Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Apr 05, 2016 at 07:24:39PM -0500, Michael Roth wrote: > Quoting Bharata B Rao (2016-03-31 03:39:20) > > XICS is setup for each CPU during initialization. Provide a routine > > to undo the same when CPU is unplugged. While here, move ss->cs managem= ent > > into xics from xics_kvm since there is nothing KVM specific in it. > > Also ensure xics reset doesn't set irq for CPUs that are already unplug= ged. > >=20 > > This allows reboot of a VM that has undergone CPU hotplug and unplug > > to work correctly. > >=20 > > Signed-off-by: Bharata B Rao > > Reviewed-by: David Gibson > > --- > > hw/intc/xics.c | 14 ++++++++++++++ > > hw/intc/xics_kvm.c | 8 ++++---- > > include/hw/ppc/xics.h | 1 + > > 3 files changed, 19 insertions(+), 4 deletions(-) > >=20 > > diff --git a/hw/intc/xics.c b/hw/intc/xics.c > > index 213a370..9fdb551 100644 > > --- a/hw/intc/xics.c > > +++ b/hw/intc/xics.c > > @@ -45,6 +45,18 @@ static int get_cpu_index_by_dt_id(int cpu_dt_id) > > return -1; > > } > >=20 > > +void xics_cpu_destroy(XICSState *icp, PowerPCCPU *cpu) > > +{ > > + CPUState *cs =3D CPU(cpu); > > + ICPState *ss =3D &icp->ss[cs->cpu_index]; > > + >=20 > If the following assertion is false, I think you'd get an OOB before you > reached it due to the assignment above. It should be ok. The assignment above will compute an out of bounds address, but it doesn't dereference it. > > + assert(cs->cpu_index < icp->nr_servers); > > + assert(cs =3D=3D ss->cs); > > + > > + ss->output =3D NULL; > > + ss->cs =3D NULL; > > +} > > + >=20 --=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 --RCcFxJ34+mAtH0DM Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJXBFvCAAoJEGw4ysog2bOSUD8QAM7vSVAKEk2J44rZ0NnPgKL0 W5sxlaYrxqZXsBZA5XDitvSQkRmDrEAMpg2QPpsEIHt+HPGAEtBTkIUZ/sQJ3460 xVOzLkOijnujdtzT9BDe9NK8VWY9DKTFrc/PWG43prM52J251YFu2xWdE7uxqen2 WWsyQkxt1oLCKgmdlNEW3Ky0folAqpzJq3N/LfNNlxpueehTRkwXCcE0deQQa7sc 2/mY1VJ9K7CYgvOU8E0/F+hDir3WjHxP1ASDIiltEPnNp9eZ9jU5FzWkLyU2D2SH 02oqF1OnzCUgtP4L9CgA9xQHRnCj+CpeJc+991s0nT22Zh2WteAJnlR8uZfrInPs PdcOMhx4Aj/9G/mZi/58CQbiV+bx4baoos0U4b6aOFwlkw88977pL8nUgh5uz8hF uTnm1zBKOn0I5CjMqHQHl2dDLwaFD5wR5+sb7q3Xo9cemKH4JEjYBBdFzzo8EbSm 7A0zB4gXj9Qh7aDjxq9ZytGUnM9kXbhhSxiqZ/L2p2ZgCPx384BahXj+EE/e7imp vCwEQ8pd0ZqaMZgMrgCmNxySwJt0qR6kd86pA7S/LxiG2+28+vVp8Ghs4QtlaLG1 Ixx4JzLceSRBaMd9k2tGFJAdK7e3BdnCmXjrn75/ENbEHpPKyeslUXKgAjQgVJ2K LSyeF7EtmeLF3CItWfCN =Eyf3 -----END PGP SIGNATURE----- --RCcFxJ34+mAtH0DM--