All of lore.kernel.org
 help / color / mirror / Atom feed
From: Like Xu <like.xu@linux.intel.com>
To: "Daniel P. Berrangé" <berrange@redhat.com>,
	"caodongli@kingsoft.com" <caodongli@kingsoft.com>
Cc: ehabkost <ehabkost@redhat.com>, mst <mst@redhat.com>,
	"richard.henderson" <richard.henderson@linaro.org>,
	qemu-devel <qemu-devel@nongnu.org>,
	pbonzini <pbonzini@redhat.com>,
	Igor Mammedov <imammedo@redhat.com>
Subject: Re: [PATCH v2] hw/i386: Expand the range of CPU topologies between smp and maxcpus
Date: Tue, 27 Apr 2021 10:13:01 +0800	[thread overview]
Message-ID: <378da49d-2d66-0d47-90cb-441a4e6f8ac7@linux.intel.com> (raw)
In-Reply-To: <YIbAYqpWBG5k8yp5@redhat.com>

On 2021/4/26 21:30, Daniel P. Berrangé wrote:
> On Mon, Apr 26, 2021 at 10:08:52AM +0800, caodongli@kingsoft.com wrote:
>> Change the criteria for the initial CPU topology and maxcpus, user can
>> have more settings
> 
> Can you provide a better explanation of why this is needed. What
> valid usage scenario is blocked by the current check ?
> 
> AFAICT, it partially reverts an intentional change done in several
> years ago in :
> 
> 
>    commit bc1fb850a31468ac4976f3895f01a6d981e06d0a
>    Author: Igor Mammedov <imammedo@redhat.com>
>    Date:   Thu Sep 13 13:06:01 2018 +0200
> 
>      vl.c deprecate incorrect CPUs topology
>      
>      -smp [cpus],sockets/cores/threads[,maxcpus] should describe topology
>      so that total number of logical CPUs [sockets * cores * threads]
>      would be equal to [maxcpus], however historically we didn't have
>      such check in QEMU and it is possible to start VM with an invalid
>      topology.
>      Deprecate invalid options combination so we can make sure that
>      the topology VM started with is always correct in the future.
>      Users with an invalid sockets/cores/threads/maxcpus values should
>      fix their CLI to make sure that
>         [sockets * cores * threads] == [maxcpus]
> 
> 

Another helpful commit would be:

commit c4332cd1dcf2964c23893ab4c0bf8d774e42a3cf
Author: Igor Mammedov <imammedo@redhat.com>
Date:   Fri Sep 11 09:32:02 2020 -0400

     smp: drop support for deprecated (invalid topologies)

     it's was deprecated since 3.1

     Support for invalid topologies is removed, the user must ensure
     that topologies described with -smp include all possible cpus,
     i.e. (sockets * cores * threads) == maxcpus or QEMU will
     exit with error.


So is the following statement correct:

When we explicitly set the topology, we must ensure that the combination 
(sockets/dies/cores/threads/maxcpus) is always valid. If we need hot plug 
testing, we can only use something like "-smp 1,maxcpus = 4" since 3.1.

?


> 
>>
>> Signed-off-by: Dongli Cao <caodongli@kingsoft.com>
>> ---
>> hw/i386/pc.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/hw/i386/pc.c b/hw/i386/pc.c
>> index 8a84b25..ef2e819 100644
>> --- a/hw/i386/pc.c
>> +++ b/hw/i386/pc.c
>> @@ -751,7 +751,7 @@ void pc_smp_parse(MachineState *ms, QemuOpts *opts)
>>               exit(1);
>>           }
>>
>> -        if (sockets * dies * cores * threads != ms->smp.max_cpus) {
>> +        if (sockets * dies * cores * threads > ms->smp.max_cpus) {
>>               error_report("Invalid CPU topology deprecated: "
>>                            "sockets (%u) * dies (%u) * cores (%u) * threads (%u) "
>>                            "!= maxcpus (%u)",
> 
> This is
> 
>> --
>> 1.8.3.1
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> caodongli@kingsoft.com
>>
>>
> 
> Regards,
> Daniel
> 



  reply	other threads:[~2021-04-27  2:14 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-26  2:08 [PATCH v2] hw/i386: Expand the range of CPU topologies between smp and maxcpus caodongli
2021-04-26 13:30 ` Daniel P. Berrangé
2021-04-27  2:13   ` Like Xu [this message]
2021-04-27  8:34     ` Daniel P. Berrangé

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=378da49d-2d66-0d47-90cb-441a4e6f8ac7@linux.intel.com \
    --to=like.xu@linux.intel.com \
    --cc=berrange@redhat.com \
    --cc=caodongli@kingsoft.com \
    --cc=ehabkost@redhat.com \
    --cc=imammedo@redhat.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.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.