* [Qemu-devel] [PATCH] smbios: Fix assertion on socket count calculation
@ 2014-09-30 1:21 Eduardo Habkost
2014-09-30 10:07 ` Igor Mammedov
0 siblings, 1 reply; 3+ messages in thread
From: Eduardo Habkost @ 2014-09-30 1:21 UTC (permalink / raw)
To: qemu-devel
Cc: Igor Mammedov, Gabriel Somlo, qemu-stable, Gerd Hoffmann,
Michael S. Tsirkin
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>
---
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++) {
--
1.9.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] smbios: Fix assertion on socket count calculation
2014-09-30 1:21 [Qemu-devel] [PATCH] smbios: Fix assertion on socket count calculation Eduardo Habkost
@ 2014-09-30 10:07 ` Igor Mammedov
2014-09-30 11:50 ` Michael S. Tsirkin
0 siblings, 1 reply; 3+ messages in thread
From: Igor Mammedov @ 2014-09-30 10:07 UTC (permalink / raw)
To: Eduardo Habkost
Cc: Gabriel Somlo, Michael S. Tsirkin, Gerd Hoffmann, qemu-devel,
qemu-stable
On Mon, 29 Sep 2014 22:21:45 -0300
Eduardo Habkost <ehabkost@redhat.com> 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 <somlo@cmu.edu>
> Cc: qemu-stable@nongnu.org
> Signed-off-by: Eduardo Habkost <ehabkost@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++) {
Reviewed-By: Igor Mammedov <imammedo@redhat.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] smbios: Fix assertion on socket count calculation
2014-09-30 10:07 ` Igor Mammedov
@ 2014-09-30 11:50 ` Michael S. Tsirkin
0 siblings, 0 replies; 3+ messages in thread
From: Michael S. Tsirkin @ 2014-09-30 11:50 UTC (permalink / raw)
To: Igor Mammedov
Cc: Gabriel Somlo, qemu-stable, Gerd Hoffmann, Eduardo Habkost, qemu-devel
On Tue, Sep 30, 2014 at 12:07:17PM +0200, Igor Mammedov wrote:
> On Mon, 29 Sep 2014 22:21:45 -0300
> Eduardo Habkost <ehabkost@redhat.com> 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 <somlo@cmu.edu>
> > Cc: qemu-stable@nongnu.org
> > Signed-off-by: Eduardo Habkost <ehabkost@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++) {
>
> Reviewed-By: Igor Mammedov <imammedo@redhat.com>
Please spell it with lower-case b:
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Applied, thanks!
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-09-30 11:47 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-30 1:21 [Qemu-devel] [PATCH] smbios: Fix assertion on socket count calculation Eduardo Habkost
2014-09-30 10:07 ` Igor Mammedov
2014-09-30 11:50 ` Michael S. Tsirkin
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.