Skip to contentSkip to conversation

smp-parse: smp-opt-cores for simple -smp X

Qemu-devel Adam Lackorzynski 1 participant 1 message Jul 8, 2011

lore
Share & tools
lore
#0 lore raw

Hi,

When just using a simple '-smp X', both the smp_cores and smp_threads variables are set to 1, which on x86 leads to CPUid-0x80000008-ecx returning 1 for the CPU count despite more CPUs are there. Docs say 'Missing values will be computed.', so my try on this is the following. Comments?

---
 vl.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
vl.c +2 -0
index fcd7395..1459bde 100644
@@ -886,6 +886,8 @@ static void smp_parse(const char *optarg)
         max_cpus = strtoull(option, NULL, 10);
 
     /* compute missing values, prefer sockets over cores over threads */
+    if (sockets + cores + threads == 0)
+        cores = smp;
     if (smp == 0 || sockets == 0) {
         sockets = sockets > 0 ? sockets : 1;
         cores = cores > 0 ? cores : 1;
Signature · 7 lines
1.7.5.3


Adam
-- 
Adam                 [email protected]
  Lackorzynski         http://os.inf.tu-dresden.de/~adam/