All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Jones <drjones@redhat.com>
To: Yanan Wang <wangyanan55@huawei.com>
Cc: "Daniel P . Berrangé" <berrange@redhat.com>,
	"Eduardo Habkost" <ehabkost@redhat.com>,
	"Michael S . Tsirkin" <mst@redhat.com>,
	wanghaibin.wang@huawei.com, qemu-devel@nongnu.org,
	"Igor Mammedov" <imammedo@redhat.com>,
	yuzenghui@huawei.com, "Paolo Bonzini" <pbonzini@redhat.com>
Subject: Re: [RFC PATCH 3/6] pc/machine: Perform zero-check for the value of -smp dies
Date: Mon, 12 Jul 2021 17:04:01 +0200	[thread overview]
Message-ID: <20210712150401.is7nxfwewf7taexa@gator> (raw)
In-Reply-To: <20210702100739.13672-4-wangyanan55@huawei.com>

On Fri, Jul 02, 2021 at 06:07:36PM +0800, Yanan Wang wrote:
> It's possible that dies parameter is explicitly specified as "dies=0"
> in the cmdline, if so we will wrongly calculate the other ommited
> parameters such as "sockets = maxcpus / (dies * cores * threads);"
> with a zeroed dies value.
> 
> So perform zero-check (default the value to 1 if zeroed) for -smp dies
> before using it to calculate other parameters.

OK, dies=0 may make some sense for a user that doesn't want to describe
dies.

Reviewed-by: Andrew Jones <drjones@redhat.com>

> 
> Fixes: 1b45842203540 (vl.c: Add -smp, dies=* command line support and update doc)
> Signed-off-by: Yanan Wang <wangyanan55@huawei.com>
> ---
>  hw/i386/pc.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/hw/i386/pc.c b/hw/i386/pc.c
> index a44511c937..93d1f12a49 100644
> --- a/hw/i386/pc.c
> +++ b/hw/i386/pc.c
> @@ -714,12 +714,14 @@ static void pc_smp_parse(MachineState *ms, SMPConfiguration *config, Error **err
>  {
>      unsigned cpus    = config->has_cpus ? config->cpus : 0;
>      unsigned sockets = config->has_sockets ? config->sockets : 0;
> -    unsigned dies    = config->has_dies ? config->dies : 1;
> +    unsigned dies    = config->has_dies ? config->dies : 0;
>      unsigned cores   = config->has_cores ? config->cores : 0;
>      unsigned threads = config->has_threads ? config->threads : 0;
>      unsigned maxcpus = config->has_maxcpus ? config->maxcpus : 0;
>  
>      /* compute missing values, prefer sockets over cores over threads */
> +    dies = dies > 0 ? dies : 1;
> +
>      if (cpus == 0 || sockets == 0) {
>          cores = cores > 0 ? cores : 1;
>          threads = threads > 0 ? threads : 1;
> -- 
> 2.19.1
> 



  reply	other threads:[~2021-07-12 15:06 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-02 10:07 [RFC PATCH 0/6] machine: smp parsing fixes and improvement Yanan Wang
2021-07-02 10:07 ` [RFC PATCH 1/6] machine: Set the value of maxcpus to match cpus if specified as zero Yanan Wang
2021-07-12 14:57   ` Andrew Jones
2021-07-12 15:27     ` Daniel P. Berrangé
2021-07-02 10:07 ` [RFC PATCH 2/6] machine: Perform zero-check for the computed value of sockets Yanan Wang
2021-07-12 15:00   ` Andrew Jones
2021-07-12 15:30     ` Daniel P. Berrangé
2021-07-13  6:56       ` wangyanan (Y)
2021-07-02 10:07 ` [RFC PATCH 3/6] pc/machine: Perform zero-check for the value of -smp dies Yanan Wang
2021-07-12 15:04   ` Andrew Jones [this message]
2021-07-12 15:05     ` Andrew Jones
2021-07-12 15:27       ` Andrew Jones
2021-07-13  6:46         ` wangyanan (Y)
2021-07-02 10:07 ` [RFC PATCH 4/6] machine: Uniformly use maxcpus to calculate the missing values Yanan Wang
2021-07-12 15:25   ` Andrew Jones
2021-07-13  7:25     ` wangyanan (Y)
2021-07-13  7:49   ` wangyanan (Y)
2021-07-02 10:07 ` [RFC PATCH 5/6] pc/machine: Disallow any configuration of dies for non-PC machines Yanan Wang
2021-07-02 10:18   ` Daniel P. Berrangé
2021-07-05  9:03     ` wangyanan (Y)
2021-07-02 10:07 ` [RFC PATCH 6/6] machine: Tweak the order of topology members in struct CpuTopology Yanan Wang
2021-07-12 15:29   ` Andrew Jones
2021-07-12 19:46   ` Pankaj Gupta

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=20210712150401.is7nxfwewf7taexa@gator \
    --to=drjones@redhat.com \
    --cc=berrange@redhat.com \
    --cc=ehabkost@redhat.com \
    --cc=imammedo@redhat.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=wanghaibin.wang@huawei.com \
    --cc=wangyanan55@huawei.com \
    --cc=yuzenghui@huawei.com \
    /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.