qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v11 14/14] machine: Put all sanity-check in the generic SMP p


From: wangyanan (Y)
Subject: Re: [PATCH v11 14/14] machine: Put all sanity-check in the generic SMP parser
Date: Tue, 28 Sep 2021 19:20:43 +0800
User-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.4.0


On 2021/9/28 19:01, Philippe Mathieu-Daudé wrote:
On 9/28/21 05:57, Yanan Wang wrote:
Put both sanity-check of the input SMP configuration and sanity-check
of the output SMP configuration uniformly in the generic parser. Then
machine_set_smp() will become cleaner, also all the invalid scenarios
can be tested only by calling the parser.

Signed-off-by: Yanan Wang <wangyanan55@huawei.com>
Reviewed-by: Andrew Jones <drjones@redhat.com>
Reviewed-by: Pankaj Gupta <pankaj.gupta@ionos.com>
---
  hw/core/machine.c | 63 +++++++++++++++++++++++------------------------
  1 file changed, 31 insertions(+), 32 deletions(-)

diff --git a/hw/core/machine.c b/hw/core/machine.c
index e2a48aa18c..637acd8d42 100644
--- a/hw/core/machine.c
+++ b/hw/core/machine.c
@@ -798,6 +798,20 @@ static void smp_parse(MachineState *ms, SMPConfiguration 
*config, Error **errp)
      unsigned threads = config->has_threads ? config->threads : 0;
      unsigned maxcpus = config->has_maxcpus ? config->maxcpus : 0;
+ /*
+     * Specified CPU topology parameters must be greater than zero,
+     * explicit configuration like "cpus=0" is not allowed.
+     */
+    if ((config->has_cpus && config->cpus == 0) ||
+        (config->has_sockets && config->sockets == 0) ||
+        (config->has_dies && config->dies == 0) ||
+        (config->has_cores && config->cores == 0) ||
+        (config->has_threads && config->threads == 0) ||
+        (config->has_maxcpus && config->maxcpus == 0)) {
+        warn_report("Invalid CPU topology deprecated: "
Maybe:

    "Deprecated CPU topology: "
or

    "Deprecated CPU topology (considered invalid): "
Ok, I will chose the second one which I think is clearer.

Thanks,
Yanan
+                    "CPU topology parameters must be greater than zero");
+    }
.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]