Skip to contentSkip to conversation

hw/riscv: Fix topo field in error_report

PATCH Applied Zhao Liu 2 participants 3 messages Jul 18, 2023 – Jul 19, 2023 RISC-V

lore
Share & tools
lore

Zhao Liu

author
#0 lore raw

PATCH 1/1 hw/riscv: Fix topo field in error_report

From: Zhao Liu <[email protected]>

"smp.cpus" means the number of online CPUs and "smp.max_cpus" means the total number of CPUs.

riscv_numa_get_default_cpu_node_id() checks "smp.cpus" and the "available CPUs" description in the next error message also indicates online CPUs.

So report "smp.cpus" in error_report() instand of "smp.max_cpus".

Since "smp.cpus" is "unsigned int", use "%u".

---
 hw/riscv/numa.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
hw/riscv/numa.c +2 -2
index e0414d5b1b73..d319aefb4511 100644
@@ -209,8 +209,8 @@ int64_t riscv_numa_get_default_cpu_node_id(const MachineState *ms, int idx)
 
     if (ms->numa_state->num_nodes > ms->smp.cpus) {
         error_report("Number of NUMA nodes (%d)"
-                     " cannot exceed the number of available CPUs (%d).",
-                     ms->numa_state->num_nodes, ms->smp.max_cpus);
+                     " cannot exceed the number of available CPUs (%u).",
+                     ms->numa_state->num_nodes, ms->smp.cpus);
         exit(EXIT_FAILURE);
     }
     if (ms->numa_state->num_nodes) {
Signature · 1 line
2.34.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 10 lines · Zhao Liu

From: Zhao Liu <[email protected]>

"smp.cpus" means the number of online CPUs and "smp.max_cpus" means the total number of CPUs.

riscv_numa_get_default_cpu_node_id() checks "smp.cpus" and the "available CPUs" description in the next error message also indicates online CPUs.

Quoted 5 lines

So report "smp.cpus" in error_report() instand of "smp.max_cpus".

Since "smp.cpus" is "unsigned int", use "%u".

Alistair

Quoted 23 lines
---
 hw/riscv/numa.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
hw/riscv/numa.c +2 -3
index e0414d5b1b73..d319aefb4511 100644
@@ -209,8 +209,8 @@ int64_t riscv_numa_get_default_cpu_node_id(const MachineState *ms, int idx)
 
     if (ms->numa_state->num_nodes > ms->smp.cpus) {
         error_report("Number of NUMA nodes (%d)"
-                     " cannot exceed the number of available CPUs (%d).",
-                     ms->numa_state->num_nodes, ms->smp.max_cpus);
+                     " cannot exceed the number of available CPUs (%u).",
+                     ms->numa_state->num_nodes, ms->smp.cpus);
         exit(EXIT_FAILURE);
     }
     if (ms->numa_state->num_nodes) {
--

2.34.1

#2 lore raw
In reply to Zhao Liu
Quoted 10 lines · Zhao Liu

From: Zhao Liu <[email protected]>

"smp.cpus" means the number of online CPUs and "smp.max_cpus" means the total number of CPUs.

riscv_numa_get_default_cpu_node_id() checks "smp.cpus" and the "available CPUs" description in the next error message also indicates online CPUs.

Quoted 5 lines

So report "smp.cpus" in error_report() instand of "smp.max_cpus".

Since "smp.cpus" is "unsigned int", use "%u".

I fixed up the typo in the commit title

Thanks!

Applied to riscv-to-apply.next

Alistair

Quoted 23 lines
---
 hw/riscv/numa.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
hw/riscv/numa.c +2 -3
index e0414d5b1b73..d319aefb4511 100644
@@ -209,8 +209,8 @@ int64_t riscv_numa_get_default_cpu_node_id(const MachineState *ms, int idx)
 
     if (ms->numa_state->num_nodes > ms->smp.cpus) {
         error_report("Number of NUMA nodes (%d)"
-                     " cannot exceed the number of available CPUs (%d).",
-                     ms->numa_state->num_nodes, ms->smp.max_cpus);
+                     " cannot exceed the number of available CPUs (%u).",
+                     ms->numa_state->num_nodes, ms->smp.cpus);
         exit(EXIT_FAILURE);
     }
     if (ms->numa_state->num_nodes) {
--

2.34.1