Skip to contentSkip to conversation

limit guest cpus for kvm enabled builds

PATCH In review Bruce Rogers 3 participants 4 messages Apr 9, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 limit guest cpus for kvm enabled builds

The x86 kvm kernel module limits guest cpu count to 16, but the userspace pc definition says 255 still. When invoking qemu-kvm with -smp > 16, it prints some error messages, then segfaults. One of the mistakes is that the error code from kvm_create_vcpu is ignored in ap_main_loop.
This patch will enforce the limit at initialization time and avoid these problems from the get go.

Bruce

hw/pc.c +4 -0
@@ -1162,7 +1162,11 @@ QEMUMachine pc_machine = {
     .desc = "Standard PC",
     .init = pc_init_pci,
     .ram_require = VGA_RAM_SIZE + PC_MAX_BIOS_SIZE,
+#ifdef CONFIG_KVM
+    .max_cpus = 16,
+#else
     .max_cpus = 255,
+#endif
 };
#1 lore raw
Quoted 4 lines · Bruce Rogers

The x86 kvm kernel module limits guest cpu count to 16, but the userspace pc definition says 255 still. When invoking qemu-kvm with -smp > 16, it
prints some error messages, then segfaults. One of the mistakes is that
the error code from kvm_create_vcpu is ignored in ap_main_loop.

You should fix that bug then.

Quoted 2 lines

This patch will enforce the limit at initialization time and avoid these problems from the get go.

No. We still want to support a decent number of cpus when -no-kvm is specified.

Paul

#2 lore raw
Quoted 10 lines · Paul Brook
Quoted 5 lines · Bruce Rogers

The x86 kvm kernel module limits guest cpu count to 16, but the userspace pc definition says 255 still. When invoking qemu-kvm with -smp > 16, it
prints some error messages, then segfaults. One of the mistakes is that
the error code from kvm_create_vcpu is ignored in ap_main_loop.

You should fix that bug then.

I don't see the patch on the mailing list yet, but I'm pretty sure your patch is against kvm-userspace.git as ap_main_loop doesn't exist in upstream QEMU.

And FWIW, we do properly handle an unsupported -smp value in upstream QEMU when using KVM.

Regards,

Anthony Liguori

#3 lore raw
Quoted 16 lines · Anthony Liguori
Quoted 10 lines · Paul Brook
Quoted 5 lines · Bruce Rogers

The x86 kvm kernel module limits guest cpu count to 16, but the userspace pc definition says 255 still. When invoking qemu-kvm with -smp > 16, it
prints some error messages, then segfaults. One of the mistakes is that
the error code from kvm_create_vcpu is ignored in ap_main_loop.

You should fix that bug then.

I don't see the patch on the mailing list yet, but I'm pretty sure your patch is against kvm-userspace.git as ap_main_loop doesn't exist in upstream QEMU.

Quoted 6 lines

And FWIW, we do properly handle an unsupported -smp value in upstream QEMU when using KVM.

Regards,

Anthony Liguori

OK thanks.
I've submitted a different patch on kvm mailing list.
- Bruce