From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57260) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bCdGu-0002FK-Hu for qemu-devel@nongnu.org; Mon, 13 Jun 2016 21:36:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bCdGs-0007Fi-1y for qemu-devel@nongnu.org; Mon, 13 Jun 2016 21:36:03 -0400 Date: Tue, 14 Jun 2016 11:15:26 +1000 From: David Gibson Message-ID: <20160614011526.GE4882@voom.fritz.box> References: <1465580427-13596-1-git-send-email-drjones@redhat.com> <1465580427-13596-2-git-send-email-drjones@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="HeFlAV5LIbMFYYuh" Content-Disposition: inline In-Reply-To: <1465580427-13596-2-git-send-email-drjones@redhat.com> Subject: Re: [Qemu-devel] [PATCH RFC 01/16] vl: smp_parse: cleanups List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Andrew Jones Cc: qemu-devel@nongnu.org, qemu-ppc@nongnu.org, qemu-arm@nongnu.org, imammedo@redhat.com, ehabkost@redhat.com, pbonzini@redhat.com, peter.maydell@linaro.org, dgibson@redhat.com, agraf@suse.de --HeFlAV5LIbMFYYuh Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Jun 10, 2016 at 07:40:12PM +0200, Andrew Jones wrote: > No functional changes; only some code movement and removal of > dead code (impossible conditions). Also, max_cpus can be > initialized to 1, like smp_cpus, because it's either set by the > user or set to smp_cpus, when smp_cpus is set by the user, or > set to 1, when nothing is set. >=20 > Signed-off-by: Andrew Jones Reviewed-by: David Gibson > --- > vl.c | 34 +++++++++++++++------------------- > 1 file changed, 15 insertions(+), 19 deletions(-) >=20 > diff --git a/vl.c b/vl.c > index b0bcc255ee9a5..7b96e787922f9 100644 > --- a/vl.c > +++ b/vl.c > @@ -154,7 +154,7 @@ CharDriverState *sclp_hds[MAX_SCLP_CONSOLES]; > int win2k_install_hack =3D 0; > int singlestep =3D 0; > int smp_cpus =3D 1; > -int max_cpus =3D 0; > +int max_cpus =3D 1; > int smp_cores =3D 1; > int smp_threads =3D 1; > int acpi_enabled =3D 1; > @@ -1223,7 +1223,6 @@ static QemuOptsList qemu_smp_opts =3D { > static void smp_parse(QemuOpts *opts) > { > if (opts) { > - > unsigned cpus =3D qemu_opt_get_number(opts, "cpus", 0); > unsigned sockets =3D qemu_opt_get_number(opts, "sockets", 0); > unsigned cores =3D qemu_opt_get_number(opts, "cores", 0); > @@ -1251,6 +1250,17 @@ static void smp_parse(QemuOpts *opts) > } > =20 > max_cpus =3D qemu_opt_get_number(opts, "maxcpus", cpus); > + > + if (max_cpus > MAX_CPUMASK_BITS) { > + error_report("unsupported number of maxcpus"); > + exit(1); > + } > + > + if (max_cpus < cpus) { > + error_report("maxcpus must be equal to or greater than smp"); > + exit(1); > + } > + > if (sockets * cores * threads > max_cpus) { > error_report("cpu topology: " > "sockets (%u) * cores (%u) * threads (%u) > " > @@ -1260,25 +1270,11 @@ static void smp_parse(QemuOpts *opts) > } > =20 > smp_cpus =3D cpus; > - smp_cores =3D cores > 0 ? cores : 1; > - smp_threads =3D threads > 0 ? threads : 1; > - > - } > - > - if (max_cpus =3D=3D 0) { > - max_cpus =3D smp_cpus; > - } > - > - if (max_cpus > MAX_CPUMASK_BITS) { > - error_report("unsupported number of maxcpus"); > - exit(1); > - } > - if (max_cpus < smp_cpus) { > - error_report("maxcpus must be equal to or greater than smp"); > - exit(1); > + smp_cores =3D cores; > + smp_threads =3D threads; > } > =20 > - if (smp_cpus > 1 || smp_cores > 1 || smp_threads > 1) { > + if (smp_cpus > 1) { > Error *blocker =3D NULL; > error_setg(&blocker, QERR_REPLAY_NOT_SUPPORTED, "smp"); > replay_add_blocker(blocker); --=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 --HeFlAV5LIbMFYYuh Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJXX1quAAoJEGw4ysog2bOSAqUP/R2Q/tX70QgME0XMJYxRo0b0 /zuniIHTGIyOcRltwTq2ZG3i+8iN+EFabyitOvUZVPlIgObCbE6MPATIDrl1ZeMp SpAAKrE7nPkjuTIcWo2Zi4xoWrxjPucMukoKXIUW7hoN8eR12fQQzmiz7c4hUuWq FAZqvEGNYdJUG3BN6+mBpNl4l5/Uk7/W6b1tDrHiTiyFo1OhFu/SYiz+5z15jNWn 8BrCsk9cj6PKEHQNVmB62C97gOfmBhCFckFqlYf9hdNOgj1ANaIcDVjzX2uoXo7Y plrW8MLelJOv6Ign9fvngkWlapqA0QYxUeWOe9WwK7yBuFLYbu1osW4mmALQyEpL N91Qst/QpCk+wUaITysOsPNHjmN9nJYxuNysFBEBLLYMAcJUZYiClp7QDR9n+SL8 wqKD+6J4Q5FjIrdrDA7XoEC1O54gNZyQuLO/OxOAwp9HWUGivk3qV0ATuMfDuJz5 9Yw0U0OJRbPNbMo2eDSVCPk7hPc8GqM/W9Ih2JfuqpiRjol+oaFF1pRgBiueaGjg 6fRTqSBwRPnEwpLRfd7+tHSX706huv6ARX2rTNUQmmcglzyLvGVfrIaxesx5YTno qoFJq0K3j9AiKyUaVd9I8LpgUX8gn9VjOM2rAiLOlOiOZLjUdn+NtQMFywi420Rz yO2t4h5L8D/ofe/2/mal =Dq9h -----END PGP SIGNATURE----- --HeFlAV5LIbMFYYuh--