numa: check mem or memdev in numa configuration
PATCH 1/1 numa: check mem or memdev in numa configuration
If there is no mem or memdev in numa configuration, it always reports the error as the following:
total memory for NUMA nodes (0x0) should equal RAM size (0x100000000)
This error is confusing and the reason is that total memory of numa nodes is always 0 if there is no mem or memdev in numa configuration. So it's better to check mem or memdev in numa configuration.
--- hw/core/numa.c | 5 +++++ 1 file changed, 5 insertions(+)
hw/core/numa.c +5 -0
@@ -132,6 +132,11 @@ static void parse_numa_node(MachineState *ms, NumaNodeOptions *node, have_memdevs = have_memdevs ? : node->has_memdev; have_mem = have_mem ? : node->has_mem; +if (!node->has_memdev && !node->has_mem) { +error_setg (errp,"numa configuration should use mem= or memdev= " ); +return ; + } +if ((node->has_mem && have_memdevs) || (node->has_memdev && have_mem)) {error_setg (errp,"numa configuration should use either mem= or memdev=," "mixing both is not allowed" );
Signature · 1 line
2.31.1
Quoted 19 lines · On Wed, 16 Feb 2022 17:36:13 +0100 Li Zhang <[email protected]> wrote:
If there is no mem or memdev in numa configuration, it always reports the error as the following:
total memory for NUMA nodes (
0x0) should equal RAM size (0x100000000)This error is confusing and the reason is that total memory of numa nodes is always 0 if there is no mem or memdev in numa configuration. So it's better to check mem or memdev in numa configuration.
Signed-off-by Li Zhang <[email protected]>--- hw/core/numa.c | 5 +++++ 1 file changed, 5 insertions(+)hw/core/numa.c +0
-0
hw/core/numa.c static void parse_numa_node(MachineState *ms, NumaNodeOptions *node, · line 138
Quoted 7 lines
hw/core/numa.c +4
-0@@ -132,6 +132,11 @@ static void parse_numa_node(MachineState *ms, NumaNodeOptions *node, have_memdevs = have_memdevs ? : node->has_memdev; have_mem = have_mem ? : node->has_mem; +if (!node->has_memdev && !node->has_mem) { +error_setg (errp,"numa configuration should use mem= or memdev= " ); +return ; + }
Wouldn't this breaks memory less numa nodes?
I'd rather add/rephrase to original error message that memory should be specified explicitly for desired numa nodes.
And I'd not mention 'mem=' since
docs/about/removed-features.rst:``-numa node,mem=...`` (removed in 5.1)
Quoted 4 lines
hw/core/numa.c +1
-0+if ((node->has_mem && have_memdevs) || (node->has_memdev && have_mem)) {error_setg (errp,"numa configuration should use either mem= or memdev=," "mixing both is not allowed" );
Quoted 23 lines · Igor Mammedov
Quoted 20 lines · On Wed, 16 Feb 2022 17:36:13 +0100 Li Zhang <[email protected]> wrote:
If there is no mem or memdev in numa configuration, it always reports the error as the following:
total memory for NUMA nodes (
0x0) should equal RAM size (0x100000000)This error is confusing and the reason is that total memory of numa nodes is always 0 if there is no mem or memdev in numa configuration. So it's better to check mem or memdev in numa configuration.
Signed-off-by Li Zhang <[email protected]>--- hw/core/numa.c | 5 +++++ 1 file changed, 5 insertions(+)hw/core/numa.c +0
-0@@ -132,6 +132,11 @@ static void parse_numa_node(MachineState *ms, NumaNodeOptions *node,
Quoted 8 lines
hw/core/numa.c static void parse_numa_node(MachineState *ms, NumaNodeOptions *node, · line 138
Quoted 6 lines
hw/core/numa.c +4
-0have_memdevs = have_memdevs ? : node->has_memdev; have_mem = have_mem ? : node->has_mem; +if (!node->has_memdev && !node->has_mem) { +error_setg (errp,"numa configuration should use mem= or memdev= " ); +return ; + }Wouldn't this breaks memory less numa nodes?
Yes, you are right. It will break it if there more numa nodes than memory, and the numa nodes have no memory backends specified.
Is it allowed for users to specify more numa nodes than memory?
Quoted 5 lines
I'd rather add/rephrase to original error message that memory should be specified explicitly for desired numa nodes.
And I'd not mention 'mem=' since
docs/about/removed-features.rst:``-numa node,mem=...`` (removed in 5.1)
Thanks for your suggestions, I will rephrase it.
Quoted 6 lines
Quoted 5 lines
hw/core/numa.c +1
-0+if ((node->has_mem && have_memdevs) || (node->has_memdev && have_mem)) {error_setg (errp,"numa configuration should use either mem= or memdev=," "mixing both is not allowed" );
Quoted 33 lines · On Thu, 17 Feb 2022 10:38:32 +0100 Li Zhang <[email protected]> wrote:
Quoted 23 lines · Igor Mammedov
Quoted 20 lines · On Wed, 16 Feb 2022 17:36:13 +0100 Li Zhang <[email protected]> wrote:
If there is no mem or memdev in numa configuration, it always reports the error as the following:
total memory for NUMA nodes (
0x0) should equal RAM size (0x100000000)This error is confusing and the reason is that total memory of numa nodes is always 0 if there is no mem or memdev in numa configuration. So it's better to check mem or memdev in numa configuration.
Signed-off-by Li Zhang <[email protected]>--- hw/core/numa.c | 5 +++++ 1 file changed, 5 insertions(+)hw/core/numa.c +0
-0@@ -132,6 +132,11 @@ static void parse_numa_node(MachineState *ms, NumaNodeOptions *node,Quoted 8 lines
hw/core/numa.c static void parse_numa_node(MachineState *ms, NumaNodeOptions *node, · line 138
Quoted 6 lines
hw/core/numa.c +4
-0have_memdevs = have_memdevs ? : node->has_memdev; have_mem = have_mem ? : node->has_mem; +if (!node->has_memdev && !node->has_mem) { +error_setg (errp,"numa configuration should use mem= or memdev= " ); +return ; + }Wouldn't this breaks memory less numa nodes?
Quoted 4 lines
Yes, you are right. It will break it if there more numa nodes than memory, and the numa nodes have no memory backends specified.
Is it allowed for users to specify more numa nodes than memory?
yep, I think we support it at least for one of the targets (but I don't remember which one(s))
Quoted 16 lines
Quoted 6 lines
I'd rather add/rephrase to original error message that memory should be specified explicitly for desired numa nodes.
And I'd not mention 'mem=' since
docs/about/removed-features.rst:``-numa node,mem=...`` (removed in 5.1)Thanks for your suggestions, I will rephrase it.
Quoted 6 lines
Quoted 5 lines
hw/core/numa.c +1
-0+if ((node->has_mem && have_memdevs) || (node->has_memdev && have_mem)) {error_setg (errp,"numa configuration should use either mem= or memdev=," "mixing both is not allowed" );
Quoted 36 lines · Igor Mammedov
Quoted 33 lines · On Thu, 17 Feb 2022 10:38:32 +0100 Li Zhang <[email protected]> wrote:
Quoted 31 lines · Igor Mammedov
Quoted 19 lines · On Wed, 16 Feb 2022 17:36:13 +0100 Li Zhang <[email protected]> wrote:
If there is no mem or memdev in numa configuration, it always reports the error as the following:
total memory for NUMA nodes (
0x0) should equal RAM size (0x100000000)This error is confusing and the reason is that total memory of numa nodes is always 0 if there is no mem or memdev in numa configuration. So it's better to check mem or memdev in numa configuration.
Signed-off-by Li Zhang <[email protected]>--- hw/core/numa.c | 5 +++++ 1 file changed, 5 insertions(+)hw/core/numa.c +0
-0hw/core/numa.c static void parse_numa_node(MachineState *ms, NumaNodeOptions *node, · line 138
Quoted 7 lines
hw/core/numa.c +4
-0@@ -132,6 +132,11 @@ static void parse_numa_node(MachineState *ms, NumaNodeOptions *node, have_memdevs = have_memdevs ? : node->has_memdev; have_mem = have_mem ? : node->has_mem; +if (!node->has_memdev && !node->has_mem) { +error_setg (errp,"numa configuration should use mem= or memdev= " ); +return ; + }Wouldn't this breaks memory less numa nodes?
Quoted 7 lines
Quoted 4 lines
Yes, you are right. It will break it if there more numa nodes than memory, and the numa nodes have no memory backends specified.
Is it allowed for users to specify more numa nodes than memory?
yep, I think we support it at least for one of the targets (but I don't remember which one(s))
Ah, I see. Thanks.
Quoted 18 lines
Quoted 16 lines
Quoted 6 lines
I'd rather add/rephrase to original error message that memory should be specified explicitly for desired numa nodes. And I'd not mention 'mem=' since
docs/about/removed-features.rst:``-numa node,mem=...`` (removed in 5.1)Thanks for your suggestions, I will rephrase it.
Quoted 6 lines
Quoted 5 lines
hw/core/numa.c +1
-0+if ((node->has_mem && have_memdevs) || (node->has_memdev && have_mem)) {error_setg (errp,"numa configuration should use either mem= or memdev=," "mixing both is not allowed" );
Quoted 36 lines · Igor Mammedov
Quoted 33 lines · On Thu, 17 Feb 2022 10:38:32 +0100 Li Zhang <[email protected]> wrote:
Quoted 31 lines · Igor Mammedov
Quoted 19 lines · On Wed, 16 Feb 2022 17:36:13 +0100 Li Zhang <[email protected]> wrote:
If there is no mem or memdev in numa configuration, it always reports the error as the following:
total memory for NUMA nodes (
0x0) should equal RAM size (0x100000000)This error is confusing and the reason is that total memory of numa nodes is always 0 if there is no mem or memdev in numa configuration. So it's better to check mem or memdev in numa configuration.
Signed-off-by Li Zhang <[email protected]>--- hw/core/numa.c | 5 +++++ 1 file changed, 5 insertions(+)hw/core/numa.c +0
-0hw/core/numa.c static void parse_numa_node(MachineState *ms, NumaNodeOptions *node, · line 138
Quoted 7 lines
hw/core/numa.c +4
-0@@ -132,6 +132,11 @@ static void parse_numa_node(MachineState *ms, NumaNodeOptions *node, have_memdevs = have_memdevs ? : node->has_memdev; have_mem = have_mem ? : node->has_mem; +if (!node->has_memdev && !node->has_mem) { +error_setg (errp,"numa configuration should use mem= or memdev= " ); +return ; + }Wouldn't this breaks memory less numa nodes?
Quoted 7 lines
Quoted 4 lines
Yes, you are right. It will break it if there more numa nodes than memory, and the numa nodes have no memory backends specified.
Is it allowed for users to specify more numa nodes than memory?
yep, I think we support it at least for one of the targets (but I don't remember which one(s))
Is it okay if I put a warning here, instead of an error and return? It won't break the special case. I wonder if it is annoying to get the warning.
Thanks
Li
Quoted 17 lines
Quoted 16 lines
Quoted 6 lines
I'd rather add/rephrase to original error message that memory should be specified explicitly for desired numa nodes. And I'd not mention 'mem=' since
docs/about/removed-features.rst:``-numa node,mem=...`` (removed in 5.1)Thanks for your suggestions, I will rephrase it.
Quoted 6 lines
Quoted 5 lines
hw/core/numa.c +1
-0+if ((node->has_mem && have_memdevs) || (node->has_memdev && have_mem)) {error_setg (errp,"numa configuration should use either mem= or memdev=," "mixing both is not allowed" );
Quoted 40 lines · On Thu, 17 Feb 2022 13:24:08 +0100 Li Zhang <[email protected]> wrote:
Quoted 39 lines · Igor Mammedov
Quoted 36 lines · On Thu, 17 Feb 2022 10:38:32 +0100 Li Zhang <[email protected]> wrote:
Quoted 23 lines · Igor Mammedov
Quoted 20 lines · On Wed, 16 Feb 2022 17:36:13 +0100 Li Zhang <[email protected]> wrote:
If there is no mem or memdev in numa configuration, it always reports the error as the following:
total memory for NUMA nodes (
0x0) should equal RAM size (0x100000000)This error is confusing and the reason is that total memory of numa nodes is always 0 if there is no mem or memdev in numa configuration. So it's better to check mem or memdev in numa configuration.
Signed-off-by Li Zhang <[email protected]>--- hw/core/numa.c | 5 +++++ 1 file changed, 5 insertions(+)hw/core/numa.c +0
-0@@ -132,6 +132,11 @@ static void parse_numa_node(MachineState *ms, NumaNodeOptions *node,Quoted 8 lines
hw/core/numa.c static void parse_numa_node(MachineState *ms, NumaNodeOptions *node, · line 138
Quoted 6 lines
hw/core/numa.c +4
-0have_memdevs = have_memdevs ? : node->has_memdev; have_mem = have_mem ? : node->has_mem; +if (!node->has_memdev && !node->has_mem) { +error_setg (errp,"numa configuration should use mem= or memdev= " ); +return ; + }Wouldn't this breaks memory less numa nodes?
Yes, you are right. It will break it if there more numa nodes than memory, and the numa nodes have no memory backends specified.
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
Is it allowed for users to specify more numa nodes than memory?
yep, I think we support it at least for one of the targets (but I don't remember which one(s))
Is it okay if I put a warning here, instead of an error and return? It won't break the special case. I wonder if it is annoying to get the warning.
issuing warning in perfectly valid case (memory-less node) doesn't look like a good thing to do.
there is already a error message,
"total memory for NUMA nodes (0x0) should equal RAM size (0x100000000)"
I'd suggest to just fix this error message to be less confusing instead of adding dubious warning elsewhere.
Quoted 22 lines
Thanks
LiQuoted 17 lines
Quoted 16 lines
Quoted 6 lines
I'd rather add/rephrase to original error message that memory should be specified explicitly for desired numa nodes. And I'd not mention 'mem=' since
docs/about/removed-features.rst:``-numa node,mem=...`` (removed in 5.1)Thanks for your suggestions, I will rephrase it.
Quoted 6 lines
Quoted 5 lines
hw/core/numa.c +1
-0+if ((node->has_mem && have_memdevs) || (node->has_memdev && have_mem)) {error_setg (errp,"numa configuration should use either mem= or memdev=," "mixing both is not allowed" );
Quoted 54 lines · Igor Mammedov
Quoted 40 lines · On Thu, 17 Feb 2022 13:24:08 +0100 Li Zhang <[email protected]> wrote:
Quoted 39 lines · Igor Mammedov
Quoted 36 lines · On Thu, 17 Feb 2022 10:38:32 +0100 Li Zhang <[email protected]> wrote:
Quoted 23 lines · Igor Mammedov
Quoted 20 lines · On Wed, 16 Feb 2022 17:36:13 +0100 Li Zhang <[email protected]> wrote:
If there is no mem or memdev in numa configuration, it always reports the error as the following:
total memory for NUMA nodes (
0x0) should equal RAM size (0x100000000)This error is confusing and the reason is that total memory of numa nodes is always 0 if there is no mem or memdev in numa configuration. So it's better to check mem or memdev in numa configuration.
Signed-off-by Li Zhang <[email protected]>--- hw/core/numa.c | 5 +++++ 1 file changed, 5 insertions(+)hw/core/numa.c +0
-0@@ -132,6 +132,11 @@ static void parse_numa_node(MachineState *ms, NumaNodeOptions *node,Quoted 8 lines
hw/core/numa.c static void parse_numa_node(MachineState *ms, NumaNodeOptions *node, · line 138
Quoted 6 lines
hw/core/numa.c +4
-0have_memdevs = have_memdevs ? : node->has_memdev; have_mem = have_mem ? : node->has_mem; +if (!node->has_memdev && !node->has_mem) { +error_setg (errp,"numa configuration should use mem= or memdev= " ); +return ; + }Wouldn't this breaks memory less numa nodes?
Yes, you are right. It will break it if there more numa nodes than memory, and the numa nodes have no memory backends specified.
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
Is it allowed for users to specify more numa nodes than memory?
yep, I think we support it at least for one of the targets (but I don't remember which one(s))
Is it okay if I put a warning here, instead of an error and return? It won't break the special case. I wonder if it is annoying to get the warning.
issuing warning in perfectly valid case (memory-less node) doesn't look like a good thing to do.
Quoted 7 lines
there is already a error message,
"total memory for NUMA nodes (
0x0) should equal RAM size (0x100000000)"I'd suggest to just fix this error message to be less confusing instead of adding dubious warning elsewhere.
OK, thanks for your suggestion.
Quoted 24 lines
Quoted 22 lines
Thanks
LiQuoted 17 lines
Quoted 16 lines
Quoted 6 lines
I'd rather add/rephrase to original error message that memory should be specified explicitly for desired numa nodes. And I'd not mention 'mem=' since
docs/about/removed-features.rst:``-numa node,mem=...`` (removed in 5.1)Thanks for your suggestions, I will rephrase it.
Quoted 6 lines
Quoted 5 lines
hw/core/numa.c +1
-0+if ((node->has_mem && have_memdevs) || (node->has_memdev && have_mem)) {error_setg (errp,"numa configuration should use either mem= or memdev=," "mixing both is not allowed" );