Skip to contentSkip to conversation

Document MAX_CPUMASK_BITS and use it when limiting max_cpus

PATCH Applied Eduardo Habkost 3 participants 5 messages Mar 18, 2014 – Mar 19, 2014

lore
Share & tools
lore
#0 lore raw

cover Document MAX_CPUMASK_BITS and use it when limiting max_cpus

Small rework of patches 6/7 and 7/7 from the previous APIC-ID-limit series I sent (which broke the build and where reverted).

Instead of renaming MAX_CPUMASK_BITS like I did previously, just document it and use it on the (max_cpus > 255) check on vl.c.

Eduardo Habkost (2):
sysemu.h: Document what MAX_CPUMASK_BITS really limits vl.c: Use MAX_CPUMASK_BITS macro instead of hardcoded constant

 include/sysemu/sysemu.h | 7 +++++++
 vl.c                    | 2 +-
 2 files changed, 8 insertions(+), 1 deletion(-)
Signature · 1 line
1.8.5.3
#1 lore raw

PATCH 1/2 sysemu.h: Document what MAX_CPUMASK_BITS really limits

---
 include/sysemu/sysemu.h | 7 +++++++
 1 file changed, 7 insertions(+)
include/sysemu/sysemu.h +7 -0
index c01304d..865e5f0 100644
@@ -133,7 +133,14 @@ extern uint8_t qemu_extra_params_fw[2];
 extern QEMUClockType rtc_clock;
 
 #define MAX_NODES 64
+
+/* The following shall be true for all CPUs:
+ *   cpu->cpu_index < max_cpus <= MAX_CPUMASK_BITS
+ *
+ * Note that cpu->get_arch_id() may be larger than MAX_CPUMASK_BITS.
+ */
 #define MAX_CPUMASK_BITS 255
+
 extern int nb_numa_nodes;
 extern uint64_t node_mem[MAX_NODES];
 extern unsigned long *node_cpumask[MAX_NODES];
Signature · 1 line
1.8.5.3
#2 lore raw

PATCH 2/2 vl.c: Use MAX_CPUMASK_BITS macro instead of hardcoded constant

In reply to Eduardo Habkost
---
 vl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
vl.c +1 -1
index f0fe48b..337f340 100644
@@ -1418,7 +1418,7 @@ static void smp_parse(QemuOpts *opts)
         max_cpus = smp_cpus;
     }
 
-    if (max_cpus > 255) {
+    if (max_cpus > MAX_CPUMASK_BITS) {
         fprintf(stderr, "Unsupported number of maxcpus\n");
         exit(1);
     }
Signature · 1 line
1.8.5.3
Reviewed-by on the v1 series
#3 lore raw
In reply to Eduardo Habkost
Quoted 6 lines · Eduardo Habkost

Small rework of patches 6/7 and 7/7 from the previous APIC-ID-limit series I sent (which broke the build and where reverted).

Instead of renaming MAX_CPUMASK_BITS like I did previously, just document it and use it on the (max_cpus > 255) check on vl.c.

Quoted 8 lines

Eduardo Habkost (2):
sysemu.h: Document what MAX_CPUMASK_BITS really limits vl.c: Use MAX_CPUMASK_BITS macro instead of hardcoded constant

 include/sysemu/sysemu.h | 7 +++++++
 vl.c                    | 2 +-
 2 files changed, 8 insertions(+), 1 deletion(-)

series

#4 lore raw
In reply to Eduardo Habkost
Quoted 5 lines · Eduardo Habkost

Small rework of patches 6/7 and 7/7 from the previous APIC-ID-limit series I sent (which broke the build and where reverted).

Instead of renaming MAX_CPUMASK_BITS like I did previously, just document it and use it on the (max_cpus > 255) check on vl.c.

Applied, thanks!

Quoted 10 lines

Eduardo Habkost (2):
sysemu.h: Document what MAX_CPUMASK_BITS really limits vl.c: Use MAX_CPUMASK_BITS macro instead of hardcoded constant

 include/sysemu/sysemu.h | 7 +++++++
 vl.c                    | 2 +-
 2 files changed, 8 insertions(+), 1 deletion(-)
Signature · 1 line
1.8.5.3