Received: from eggs.gnu.org ([2001:4830:134:3::10]:50710) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bFOyB-0005hy-SA for qemu-devel@nongnu.org; Tue, 21 Jun 2016 12:56:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bFOy9-0000v9-Tc for qemu-devel@nongnu.org; Tue, 21 Jun 2016 12:56:10 -0400 Received: from mail-lf0-x242.google.com ([2a00:1450:4010:c07::242]:35848) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bFOy9-0000v2-LT for qemu-devel@nongnu.org; Tue, 21 Jun 2016 12:56:09 -0400 Received: by mail-lf0-x242.google.com with SMTP id a2so4881543lfe.3 for ; Tue, 21 Jun 2016 09:56:09 -0700 (PDT) Sender: Paolo Bonzini References: <1466526844-29245-1-git-send-email-drjones@redhat.com> From: Paolo Bonzini Message-ID: Date: Tue, 21 Jun 2016 18:56:07 +0200 MIME-Version: 1.0 In-Reply-To: <1466526844-29245-1-git-send-email-drjones@redhat.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] vl: smp_parse: fix regression List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Andrew Jones , qemu-devel@nongnu.org Cc: imammedo@redhat.com On 21/06/2016 18:34, Andrew Jones wrote: > Commit 0544edd88a "vl: smp_parse: cleanups" regressed any -smp > config that left either cores or threads unspecified, and specified > a topology supporting more cpus than the given online cpus. The > correct way to calculate the missing parameter would be to use > maxcpus, but it's too late to change that now. Restore the old > way, which is to calculate it with the online cpus (as is still > done), but then, if the result is zero, just set it to one. > > Signed-off-by: Andrew Jones > --- > vl.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/vl.c b/vl.c > index c85833a63c28e..b2137ca87078d 100644 > --- a/vl.c > +++ b/vl.c > @@ -1234,8 +1234,10 @@ static void smp_parse(QemuOpts *opts) > } else if (cores == 0) { > threads = threads > 0 ? threads : 1; > cores = cpus / (sockets * threads); > + cores = cores > 0 ? cores : 1; > } else if (threads == 0) { > threads = cpus / (cores * sockets); > + threads = threads > 0 ? threads : 1; > } else if (sockets * cores * threads < cpus) { > error_report("cpu topology: " > "sockets (%u) * cores (%u) * threads (%u) < " > Queued, thanks. Paolo