[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-ppc] [PULL 03/45] vl:c: make sure that sockets are calculated
From: |
David Gibson |
Subject: |
Re: [Qemu-ppc] [PULL 03/45] vl:c: make sure that sockets are calculated correctly in '-smp X' case |
Date: |
Tue, 23 Oct 2018 16:06:24 +0100 |
User-agent: |
Mutt/1.10.1 (2018-07-13) |
On Thu, Oct 18, 2018 at 05:03:40PM -0300, Eduardo Habkost wrote:
> From: Igor Mammedov <address@hidden>
>
> commit
> (5cdc9b76e3 vl.c: Remove dead assignment)
> removed sockets calculation when 'sockets' weren't provided on CLI
> since there wasn't any users for it back then. Exiting checks
> are neither reachable
> } else if (sockets * cores * threads < cpus) {
> or nor triggerable
> if (sockets * cores * threads > max_cpus)
> so we weren't noticing wrong topology since then, since users
> recalculate sockets adhoc on their own.
>
> However with deprecation check it becomes noticable, for example
> -smp 2
> will start printing warning:
> "warning: Invalid CPU topology deprecated: sockets (1) * cores (1) *
> threads (1) != maxcpus (2)"
> calculating sockets if they weren't specified.
>
> Fix it by returning back sockets calculation if it's omitted on CLI.
>
> Signed-off-by: Igor Mammedov <address@hidden>
> Reviewed-by: Andrew Jones <address@hidden>
> Message-Id: <address@hidden>
> Signed-off-by: Eduardo Habkost <address@hidden>
Reviewed-by: David Gibson <address@hidden>
> ---
> vl.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/vl.c b/vl.c
> index 027d04c7ca..2324321d91 100644
> --- a/vl.c
> +++ b/vl.c
> @@ -1199,11 +1199,14 @@ static void smp_parse(QemuOpts *opts)
>
> /* compute missing values, prefer sockets over cores over threads */
> if (cpus == 0 || sockets == 0) {
> - sockets = sockets > 0 ? sockets : 1;
> cores = cores > 0 ? cores : 1;
> threads = threads > 0 ? threads : 1;
> if (cpus == 0) {
> + sockets = sockets > 0 ? sockets : 1;
> cpus = cores * threads * sockets;
> + } else {
> + max_cpus = qemu_opt_get_number(opts, "maxcpus", cpus);
> + sockets = max_cpus / (cores * threads);
> }
> } else if (cores == 0) {
> threads = threads > 0 ? threads : 1;
--
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
signature.asc
Description: PGP signature
- [Qemu-ppc] [PULL 00/45] Machine queue, 2018-10-18, Eduardo Habkost, 2018/10/18
- [Qemu-ppc] [PULL 01/45] hostmem-file: fixed the memory leak while get pmem path., Eduardo Habkost, 2018/10/18
- [Qemu-ppc] [PULL 02/45] vl.c deprecate incorrect CPUs topology, Eduardo Habkost, 2018/10/18
- [Qemu-ppc] [PULL 03/45] vl:c: make sure that sockets are calculated correctly in '-smp X' case, Eduardo Habkost, 2018/10/18
- Re: [Qemu-ppc] [PULL 03/45] vl:c: make sure that sockets are calculated correctly in '-smp X' case,
David Gibson <=
- [Qemu-ppc] [PULL 04/45] numa: Fix QMP command set-numa-node error handling, Eduardo Habkost, 2018/10/18
- [Qemu-ppc] [PULL 05/45] trace-events: Fix copy/paste typo, Eduardo Habkost, 2018/10/18
- [Qemu-ppc] [PULL 06/45] hw/timer/sun4v-rtc: Convert from DPRINTF() macro to trace events, Eduardo Habkost, 2018/10/18
- [Qemu-ppc] [PULL 11/45] hw/mips/gt64xxx_pci: Convert gt64120_reset() function into Device reset method, Eduardo Habkost, 2018/10/18
- [Qemu-ppc] [PULL 08/45] hw/ssi/xilinx_spi: Use DeviceState::realize rather than SysBusDevice::init, Eduardo Habkost, 2018/10/18
- [Qemu-ppc] [PULL 07/45] hw/timer/sun4v-rtc: Use DeviceState::realize rather than SysBusDevice::init, Eduardo Habkost, 2018/10/18