qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: qemu-devel@nongnu.org
Cc: Peter Maydell <peter.maydell@linaro.org>,
	Eduardo Habkost <ehabkost@redhat.com>,
	Gabriel Somlo <somlo@cmu.edu>,
	qemu-stable@nongnu.org, Anthony Liguori <aliguori@amazon.com>,
	Igor Mammedov <imammedo@redhat.com>
Subject: [Qemu-devel] [PULL v2 1/9] smbios: Fix assertion on socket count calculation
Date: Wed, 22 Oct 2014 11:18:03 +0300	[thread overview]
Message-ID: <1413965859-7698-2-git-send-email-mst@redhat.com> (raw)
In-Reply-To: <1413965859-7698-1-git-send-email-mst@redhat.com>

From: Eduardo Habkost <ehabkost@redhat.com>

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 <somlo@cmu.edu>
Cc: qemu-stable@nongnu.org
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-By: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 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++) {
-- 
MST

  reply	other threads:[~2014-10-22  8:14 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-22  8:18 [Qemu-devel] [PULL v2 0/9] pc, virtio, misc bugfixes Michael S. Tsirkin
2014-10-22  8:18 ` Michael S. Tsirkin [this message]
2014-10-22  8:18 ` [Qemu-devel] [PULL v2 2/9] well-defined listing order for machine types Michael S. Tsirkin
2014-11-03 13:04   ` Laszlo Ersek
2014-11-03 13:10     ` Laszlo Ersek
2014-11-03 13:11     ` Andreas Färber
2014-11-03 13:11     ` Michael S. Tsirkin
2014-10-22  8:18 ` [Qemu-devel] [PULL v2 3/9] i386/pc: add piix and q35 machtypes to sorting families for -M \? Michael S. Tsirkin
2014-10-22  8:18 ` [Qemu-devel] [PULL v2 4/9] pc: Fix disabling of vapic for compat PC models Michael S. Tsirkin
2014-10-22  8:18 ` [Qemu-devel] [PULL v2 5/9] i386: Add an ACPI_EXTRACT_NAME_BUFFER16 directive Michael S. Tsirkin
2014-10-22  8:18 ` [Qemu-devel] [PULL v2 6/9] pcie: change confused comment clearer Michael S. Tsirkin
2014-10-22  8:18 ` [Qemu-devel] [PULL v2 7/9] virtio-pci: fix migration for pci bus master Michael S. Tsirkin
2014-10-22  8:18 ` [Qemu-devel] [PULL v2 8/9] intel_iommu: fix VTD_SID_TO_BUS Michael S. Tsirkin
2014-10-22  8:18 ` [Qemu-devel] [PULL v2 9/9] tests: fix rebuild-expected-aml.sh for acpi-test rename Michael S. Tsirkin
2014-10-22 20:42 ` [Qemu-devel] [PULL v2 0/9] pc, virtio, misc bugfixes Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1413965859-7698-2-git-send-email-mst@redhat.com \
    --to=mst@redhat.com \
    --cc=aliguori@amazon.com \
    --cc=ehabkost@redhat.com \
    --cc=imammedo@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-stable@nongnu.org \
    --cc=somlo@cmu.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).