[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: |
Philippe Mathieu-Daudé |
Subject: |
Re: [PATCH v11 14/14] machine: Put all sanity-check in the generic SMP parser |
Date: |
Tue, 28 Sep 2021 13:01:07 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.1.0 |
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): "
> + "CPU topology parameters must be greater than zero");
> + }
- [PATCH v11 10/14] machine: Tweak the order of topology members in struct CpuTopology, (continued)
- [PATCH v11 10/14] machine: Tweak the order of topology members in struct CpuTopology, Yanan Wang, 2021/09/27
- [PATCH v11 13/14] machine: Move smp_prefer_sockets to struct SMPCompatProps, Yanan Wang, 2021/09/27
- [PATCH v11 12/14] machine: Remove smp_parse callback from MachineClass, Yanan Wang, 2021/09/27
- [PATCH v11 14/14] machine: Put all sanity-check in the generic SMP parser, Yanan Wang, 2021/09/27
- [PATCH v11 04/14] machine: Set the value of cpus to match maxcpus if it's omitted, Yanan Wang, 2021/09/27