Received: from eggs.gnu.org ([2001:4830:134:3::10]:49768) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bSeql-000399-4g for qemu-devel@nongnu.org; Thu, 28 Jul 2016 02:31:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bSeqh-0004Tr-0u for qemu-devel@nongnu.org; Thu, 28 Jul 2016 02:31:18 -0400 Received: from ozlabs.org ([103.22.144.67]:59853) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bSeqg-0004Tl-LJ for qemu-devel@nongnu.org; Thu, 28 Jul 2016 02:31:14 -0400 Date: Thu, 28 Jul 2016 15:49:53 +1000 From: David Gibson Message-ID: <20160728054953.GD2588@voom.fritz.box> References: <1469440764-61619-1-git-send-email-imammedo@redhat.com> <1469611494-163855-1-git-send-email-imammedo@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="sgneBHv3152wZ8jf" Content-Disposition: inline In-Reply-To: <1469611494-163855-1-git-send-email-imammedo@redhat.com> Subject: Re: [Qemu-devel] [PATCH v2 7/6] exec: ensure the only one cpu_index allocation method is used List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Igor Mammedov Cc: qemu-devel@nongnu.org, ehabkost@redhat.com, bharata@linux.vnet.ibm.com, Paolo Bonzini , Peter Crosthwaite , Richard Henderson --sgneBHv3152wZ8jf Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Jul 27, 2016 at 11:24:54AM +0200, Igor Mammedov wrote: > Make sure that cpu_index auto allocation isn't used in > combination with manual cpu_index assignment. And > dissallow out of order cpu removal if auto allocation > is in use. >=20 > Target that wishes to support out of order unplug should > switch to manual cpu_index assignment. Following patch > could be used as an example: > (pc: init CPUState->cpu_index with index in possible_cpus[])) >=20 > Signed-off-by: Igor Mammedov Reviewed-by: David Gibson > --- > exec.c | 7 +++++++ > 1 file changed, 7 insertions(+) >=20 > diff --git a/exec.c b/exec.c > index 8e8416b..e0d8f18 100644 > --- a/exec.c > +++ b/exec.c > @@ -598,11 +598,14 @@ AddressSpace *cpu_get_address_space(CPUState *cpu, = int asidx) > } > #endif > =20 > +static bool cpu_index_auto_assigned; > + > static int cpu_get_free_index(void) > { > CPUState *some_cpu; > int cpu_index =3D 0; > =20 > + cpu_index_auto_assigned =3D true; > CPU_FOREACH(some_cpu) { > cpu_index++; > } > @@ -620,6 +623,8 @@ void cpu_exec_exit(CPUState *cpu) > return; > } > =20 > + assert(!(cpu_index_auto_assigned && cpu !=3D QTAILQ_LAST(&cpus, CPUT= ailQ))); > + > QTAILQ_REMOVE(&cpus, cpu, node); > cpu->cpu_index =3D UNASSIGNED_CPU_INDEX; > cpu_list_unlock(); > @@ -662,6 +667,8 @@ void cpu_exec_init(CPUState *cpu, Error **errp) > if (cpu->cpu_index =3D=3D UNASSIGNED_CPU_INDEX) { > cpu->cpu_index =3D cpu_get_free_index(); > assert(cpu->cpu_index !=3D UNASSIGNED_CPU_INDEX); > + } else { > + assert(!cpu_index_auto_assigned); > } > QTAILQ_INSERT_TAIL(&cpus, cpu, node); > cpu_list_unlock(); --=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 --sgneBHv3152wZ8jf Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJXmZ0BAAoJEGw4ysog2bOSZOgP/3wSuq9bFwZWZAP6vFBHbtt2 RI1YTmdtfWcDnyEo8vI68m4fls7z2OAYy9QBJt4W50ZqcdEIWTgOCSS+Xd0VH985 SxI0frNQgdo6NRZB90nmQqrV4BtUS3ANsnWZw1wODacg8XNDHJFzhQJ9ETx4YAU3 jLch6aYjzlGpfF7iRSwJux+auCRQ71xB9OwSM45Ls7uCkDSW/3Uvp145Kt8WeN49 448lCR3xpaMUs5hxg4nXXpnNd2aC6cyaLdRK7dfxAj/fEeSiMm/i/iYR0IjeX1xR eOSbLv/0alx4TfbycY0YqbMAaa0zw9bTFBWQWejaisGhZ7MSRgfUOzGUNBv3BH0H E8yNNfmmLlaDdcq2IeM7dl0lmijMsl2DxF0Jh15jZPNw+3OboZOB7q7F8Fs0K9ed YYZZAP7v5m0yguZlsdcrYdhHV/aLYN+myWm/AN2mFlneF2aYs5nWoNoiwYgCIcH9 EYGcD+Tp4bvF+JtKVed504M8QW2MZi87aJat3xsNvKWp25cNmBi/b/AAPeDLn8R0 b63LFN/e7bW1HK6Ju9VWbHJzPOLLPl2PS3b775KKxIBoDi1LLmqe7tfuTfk33CRS bhapUcREHrY/KX0zpXY2uE5Opl4v0bzBh0KQw5Mtebbyqs0y2UZvS5d5pNY2XWdb qe+uyb1qCbla1V+k4dlW =MLOF -----END PGP SIGNATURE----- --sgneBHv3152wZ8jf--