All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Andrew Jones <drjones@redhat.com>
Cc: peter.maydell@linaro.org, ehabkost@redhat.com, agraf@suse.de,
	qemu-devel@nongnu.org, qemu-arm@nongnu.org, qemu-ppc@nongnu.org,
	imammedo@redhat.com, dgibson@redhat.com,
	david@gibson.dropbear.id.au
Subject: Re: [Qemu-devel] [PATCH RFC 06/16] vl: move smp parsing to machine pre_init
Date: Tue, 14 Jun 2016 10:17:49 +0200	[thread overview]
Message-ID: <60ee196d-0292-3fb4-5d59-68c2d742eaa4@redhat.com> (raw)
In-Reply-To: <20160613203529.6ln7dlgnrcgda5x4@hawk.localdomain>



On 13/06/2016 22:35, Andrew Jones wrote:
> On Mon, Jun 13, 2016 at 07:04:01PM +0200, Paolo Bonzini wrote:
>> On 10/06/2016 19:40, Andrew Jones wrote:
>>> +    if (sockets == -1 || cores == -1 || threads == -1 ||
>>> +        maxcpus == -1 || cpus == -1) {
>>> +        error_report("cpu topology: "
>>> +                     "all machine properties must be specified");
>>> +        exit(1);
>>> +    }
>>> +
>>
>> I think it's sane to accept some defaults.  It must not be the DWIM
>> thing that -smp does (which is targeted to Windows's dislike of
>> multi-socket machine on consumer hardware).  It must be something that
>> makes sense, and my proposal is:
>>
>> - threads: 1
>> - cores: 1
>> - sockets:
>>   - maxcpus / (cores * threads) if maxcpus given
>>   - cpus / (cores * threads) if cpus given
>>   - else 1
>> - maxcpus: cores * threads * sockets
>> - cpus: maxcpus
> 
> I think some machines may prefer
> 
> - threads: 1
> - sockets: 1
> - cores:
>   - maxcpus / (sockets * threads) if maxcpus given
>   - cpus / (sockets * threads) if cpus given
>   - else 1

smp_cores is only used by pseries and x86 machines.  I expect machines
that must be single-socket to disregard smp_sockets altogether.

>> - any argument < 1
> 
> What if a user says threads=0, because they don't have HT, and assume
> that a value of zero will get them a non-HT system? Or what about
> machines that don't describe sockets, so a user inputs zero? In both
> those cases I agree we should just use 1, but from a user's perspective,
> it might seem weird.

They should just not specify it and get a default of 1. ;)

>> - any argument > some compile-time value (1024?) to avoid overflows
> 
> Agreed. We should do this regardless of this series.
> 
>> - cpus % (cores * threads) != 0
> 
> Hmm. This makes sense where cpus is the number of cpu packages,

I'm not sure I understand what you mean here.  The point is that the
machine starts with an integral number of sockets.

>> - cpus > sockets * cores * threads
>> - maxcpus != cores * threads * sockets
> 
> We check these two (the 2nd added with this series) already.

Yup, I was just making a complete list.

>> Alone the last relation shows that requiring all four of maxcpus, cores,
>> threads and sockets is unnecessary. :)
> 
> Not really. It depends on if you assume sockets, cores or threads to
> be the N in maxcpus=N. We could just require sockets, cores, and threads
> to be input, which allows us to easily calculate maxcpus, and then set
> cpus from that. In that case maxcpus would just be an available input
> for sanity checking.

Or you could just specify -machine cpus=16,maxcpus=32 and expect 1
core/socket, 1 thread/core, and 16 to 32 sockets.

>> -smp should do its legacy magic and assign all five values based on it.
>> If the results do not match the obvious s/smp/-machine/ command line it
>> should warn, and perhaps suggest the equivalent -machine command line.
>> It doesn't have to be a minimal command line, just equivalent.
> 
> This is a good idea. I'm just still not sure what the -machine command
> line should/should not assume.

It's okay.  Adding defaults can be done later, as long as strict checks
are in place from the beginning and there is a clean separation between
-smp defaults and -machine.

Relaxing checks can be done later, so I am much more interested in
having strict checks than in having defaults.

Though I think that we can at least agree on defaults for threads,
maxcpus and cpus.  The only sticky point is sockets vs. cores.  We can
make them both mandatory for now.  That is: cores and sockets are
mandatory until we decide which one to default to 1; threads is
optional; cpus is mandatory if you want hotplug, otherwise it's
redundant; maxcpus is optional and always redundant.

Paolo

  reply	other threads:[~2016-06-14  8:18 UTC|newest]

Thread overview: 74+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-10 17:40 [Qemu-devel] [PATCH RFC 00/16] Rework SMP parameters Andrew Jones
2016-06-10 17:40 ` [Qemu-devel] [PATCH RFC 01/16] vl: smp_parse: cleanups Andrew Jones
2016-06-14  1:15   ` David Gibson
2016-06-10 17:40 ` [Qemu-devel] [PATCH RFC 02/16] vl: smp: add checks for maxcpus based topologies Andrew Jones
2016-06-14  1:28   ` David Gibson
2016-06-14  6:43     ` Andrew Jones
2016-06-10 17:40 ` [Qemu-devel] [PATCH RFC 03/16] hw/smbios/smbios: fix number of sockets calculation Andrew Jones
2016-07-11 14:23   ` Igor Mammedov
2016-06-10 17:40 ` [Qemu-devel] [PATCH RFC 04/16] hw/core/machine: Introduce pre_init Andrew Jones
2016-06-14  1:30   ` David Gibson
2016-06-14  5:58     ` Andrew Jones
2016-07-14 20:10       ` Eduardo Habkost
2016-07-15  6:26         ` Andrew Jones
2016-06-10 17:40 ` [Qemu-devel] [PATCH RFC 05/16] hw/core/machine: add smp properites Andrew Jones
2016-06-14  2:00   ` David Gibson
2016-06-14  6:08     ` Andrew Jones
2016-06-15  0:37       ` David Gibson
2016-06-15  7:11         ` Andrew Jones
2016-07-14 20:18           ` Eduardo Habkost
2016-07-15  6:29             ` Andrew Jones
2016-06-10 17:40 ` [Qemu-devel] [PATCH RFC 06/16] vl: move smp parsing to machine pre_init Andrew Jones
2016-06-13 17:04   ` Paolo Bonzini
2016-06-13 20:35     ` Andrew Jones
2016-06-14  8:17       ` Paolo Bonzini [this message]
2016-06-14 11:39         ` Andrew Jones
2016-06-14 11:53           ` Paolo Bonzini
2016-06-14 14:03             ` Andrew Jones
2016-06-14 14:05               ` Paolo Bonzini
2016-06-15  0:51               ` David Gibson
2016-06-15  7:19                 ` Andrew Jones
2016-06-15  0:43         ` David Gibson
2016-06-10 17:40 ` [Qemu-devel] [PATCH RFC 07/16] qom/cpu: make nr-cores, nr-threads real properties Andrew Jones
2016-06-11  6:54   ` Thomas Huth
2016-06-12 13:48     ` Andrew Jones
2016-06-14  2:12       ` David Gibson
2016-06-14  6:19         ` Andrew Jones
2016-06-15  0:56           ` David Gibson
2016-07-14 20:07             ` Eduardo Habkost
2016-07-15  6:35               ` Andrew Jones
2016-07-15  9:11                 ` Igor Mammedov
2016-07-15 16:10                   ` [Qemu-devel] QOM: best way for parents to pass information to children? (was Re: [PATCH RFC 07/16] qom/cpu: make nr-cores, nr-threads real properties) Eduardo Habkost
2016-07-15 16:30                     ` Andreas Färber
2016-07-15 17:43                       ` Eduardo Habkost
2016-07-15 18:38                         ` Igor Mammedov
2016-07-15 21:33                           ` Eduardo Habkost
2016-07-16 15:30                             ` Andrew Jones
2016-07-19 11:54                               ` Eduardo Habkost
2016-07-18  7:23                             ` Igor Mammedov
2016-07-19 11:59                               ` Eduardo Habkost
2016-07-19 12:21                                 ` Paolo Bonzini
2016-07-19 13:29                                   ` Igor Mammedov
2016-07-19 13:39                                     ` Paolo Bonzini
2016-06-10 17:40 ` [Qemu-devel] [PATCH RFC 08/16] hw/core/machine: set cpu global nr_cores, nr_threads in pre_init Andrew Jones
2016-06-10 17:40 ` [Qemu-devel] [PATCH RFC 09/16] hw/i386/pc: don't use smp_cores, smp_threads Andrew Jones
2016-07-14 20:33   ` Eduardo Habkost
2016-06-10 17:40 ` [Qemu-devel] [PATCH RFC 10/16] hw/ppc/spapr: " Andrew Jones
2016-06-14  3:03   ` David Gibson
2016-06-14  6:23     ` Andrew Jones
2016-06-15  0:59       ` David Gibson
2016-06-15  7:34         ` Andrew Jones
2016-06-10 17:40 ` [Qemu-devel] [PATCH RFC 11/16] target-ppc: don't use smp_threads Andrew Jones
2016-06-10 17:40 ` [Qemu-devel] [PATCH RFC 12/16] hw/arm/virt: rename *.smp_cpus to *.cpus Andrew Jones
2016-06-10 17:40 ` [Qemu-devel] [PATCH RFC 13/16] hw/arm/virt: don't use smp_cpus, max_cpus Andrew Jones
2016-06-10 17:40 ` [Qemu-devel] [PATCH RFC 14/16] hw/arm/virt: stash cpu topo info in VirtGuestInfo Andrew Jones
2016-07-14 20:43   ` Eduardo Habkost
2016-07-15  6:40     ` Andrew Jones
2016-06-10 17:40 ` [Qemu-devel] [PATCH RFC 15/16] smbios: don't use smp_cores, smp_threads Andrew Jones
2016-07-14 20:51   ` Eduardo Habkost
2016-07-15  6:45     ` Andrew Jones
2016-06-10 17:40 ` [Qemu-devel] [PATCH RFC 16/16] sysemu/cpus: bye, bye " Andrew Jones
2016-06-11  6:42 ` [Qemu-devel] [PATCH RFC 00/16] Rework SMP parameters Thomas Huth
2016-06-12 13:58   ` Andrew Jones
2016-06-12 14:03 ` Andrew Jones
2016-07-14  9:16 ` Andrew Jones

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=60ee196d-0292-3fb4-5d59-68c2d742eaa4@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=agraf@suse.de \
    --cc=david@gibson.dropbear.id.au \
    --cc=dgibson@redhat.com \
    --cc=drjones@redhat.com \
    --cc=ehabkost@redhat.com \
    --cc=imammedo@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    /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 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.