From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55682) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XYvtx-0007i0-Tq for qemu-devel@nongnu.org; Tue, 30 Sep 2014 07:47:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XYvtt-0001zV-Et for qemu-devel@nongnu.org; Tue, 30 Sep 2014 07:47:29 -0400 Date: Tue, 30 Sep 2014 14:50:43 +0300 From: "Michael S. Tsirkin" Message-ID: <20140930115043.GA7796@redhat.com> References: <1412040105-21256-1-git-send-email-ehabkost@redhat.com> <20140930120717.541b1ded@nial.usersys.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20140930120717.541b1ded@nial.usersys.redhat.com> Subject: Re: [Qemu-devel] [PATCH] smbios: Fix assertion on socket count calculation List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Igor Mammedov Cc: Gabriel Somlo , qemu-stable@nongnu.org, Gerd Hoffmann , Eduardo Habkost , qemu-devel@nongnu.org On Tue, Sep 30, 2014 at 12:07:17PM +0200, Igor Mammedov wrote: > On Mon, 29 Sep 2014 22:21:45 -0300 > Eduardo Habkost wrote: > > > QEMU currently allows the number of VCPUs to not be a multiple of the > > number of threads per socket, but the smbios socket count calculation > > introduced by commit c97294ec1b9e36887e119589d456557d72ab37b5 doesn't > > take that into account, triggering an assertion. e.g.: > > > > $ ./x86_64-softmmu/qemu-system-x86_64 -smp 4,sockets=2,cores=6,threads=1 > > qemu-system-x86_64: /home/ehabkost/rh/proj/virt/qemu/hw/i386/smbios.c:825: smbios_get_tables: Assertion `smbios_smp_sockets >= 1' failed. > > Aborted (core dumped) > > > > Socket count calculation doesn't belong to smbios.c and should > > eventually be moved to the main SMP topology configuration code. But > > while we don't move the code, at least make it correct by rounding up > > the division. > > > > Cc: Gabriel Somlo > > Cc: qemu-stable@nongnu.org > > Signed-off-by: Eduardo Habkost > > --- > > hw/i386/smbios.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/hw/i386/smbios.c b/hw/i386/smbios.c > > index e3fa1b2..0ae5960 100644 > > --- a/hw/i386/smbios.c > > +++ b/hw/i386/smbios.c > > @@ -821,7 +821,7 @@ void smbios_get_tables(uint8_t **tables, size_t *tables_len, > > smbios_build_type_2_table(); > > smbios_build_type_3_table(); > > > > - smbios_smp_sockets = smp_cpus / (smp_cores * smp_threads); > > + smbios_smp_sockets = DIV_ROUND_UP(smp_cpus, smp_cores * smp_threads); > > assert(smbios_smp_sockets >= 1); > > > > for (i = 0; i < smbios_smp_sockets; i++) { > > Reviewed-By: Igor Mammedov Please spell it with lower-case b: Reviewed-by: Igor Mammedov Applied, thanks!