open-power-host-os / qemu

OpenPOWER Host OS qemu repository
Other
2 stars 3 forks source link

qemu crashes with trap when negative number used for maxcpus #16

Closed nasastry closed 6 years ago

nasastry commented 7 years ago
Mirrored with LTC bug https://bugzilla.linux.ibm.com/show_bug.cgi?id=159921 Run qemu with maxcpus with negative number. \# /usr/bin/qemu-system-ppc64 --nographic -vga none -machine pseries,accel=kvm,kvm-type=HV -m 2G,slots=32,maxmem=16G -device virtio-blk-pci,drive=rootdisk -drive file=/home/nasastry/hostos-3.0-ppc64le.qcow2,if=none,cache=none,id=rootdisk,format=qcow2 -net nic,model=virtio -smp 8,cores=1,threads=1,maxcpus=-12 (process:26151): GLib-ERROR **: gmem.c:130: failed to allocate 18446744073709550568 bytes Trace/breakpoint trap Though issue #15 and this looks similar by error message. Code changes needed in different places.
sathnaga commented 7 years ago

This hits in upstream qemu aswell, https://github.com/qemu/qemu/commit/530049bc1dcc24c1178a29d99ca08b6dd08413e0

 ./ppc64-softmmu/qemu-system-ppc64 -M pseries,max-cpu-compat=power9  -smp 8,threads=1,cores=1,maxcpus=-1 -m 8192 -nographic -enable-kvm /home/sath/hostos-3.0-ppc64le.qcow2 -monitor stdio -serial /dev/pts/3
QEMU 2.10.50 monitor - type 'help' for more information
(qemu) 
(process:38588): GLib-ERROR **: gmem.c:130: failed to allocate 18446744073709551536 bytes
Trace/breakpoint trap
sathnaga commented 7 years ago

0001-Fixup-Add-check-for-negative-vcpu-values.txt

Tried fixing it , let me know if approach is fine, will send it upstream, Thanks in advance

cdeadmin commented 7 years ago

Tried fixing it in qemu, let me know if approach is fine, will send it upstream, Thanks in advance

cdeadmin commented 6 years ago

------- Comment From alexey@au1.ibm.com 2018-02-01 22:34:15 EDT------- Fixed by upstream, "-smp 8,cores=1,threads=1,maxcpus=-12 " produces qemu-system-ppc64: Invalid SMP CPUs -12. The max CPUs supported by machine 'pseries-2.12' is 1024

and does not crash any more.

cdeadmin commented 6 years ago

------- Comment From nasastry@in.ibm.com 2018-02-15 04:00:52 EDT------- With qemu-system-ppc-2.11.0-1.rel.gite7153e0.el7.centos.ppc64le

qemu process quits with a proper error. This bugzilla can be closed.

/usr/bin/qemu-system-ppc64 --nographic -vga none -machine pseries,accel=kvm,kvm-type=HV -m 2G,slots=32,maxmem=16G -device virtio-blk-pci,drive=rootdisk -drive file=/home/nasastry/hostos-3.0-ppc64le.qcow2,if=none,cache=none,id=rootdisk,format=qcow2 -net nic,model=virtio -smp 8,cores=1,threads=1,maxcpus=-12

qemu-system-ppc64: Invalid SMP CPUs -12. The max CPUs supported by machine 'pseries-2.11' is 1024