Bug 841176

Summary: cpu_set a new cpu online will cause QEMU core dump
Product: Red Hat Enterprise Linux 7 Reporter: Sibiao Luo <sluo>
Component: qemu-kvmAssignee: Igor Mammedov <imammedo>
Status: CLOSED WONTFIX QA Contact: Virtualization Bugs <virt-bugs>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.0CC: chayang, juzhang, knoel, michen, qzhang, shu, xfu
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-08-01 10:08:19 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Sibiao Luo 2012-07-18 10:42:18 UTC
Description of problem:
boot a rhel7 guest with "-smp 2,sockets=2,cores=1,threads=1,maxcpus=6", check the infos for each CPU after it boot up successfully, and then cpu_set a new cpu online via HMP monitor, QEMU core dump will occur.

Version-Release number of selected component (if applicable):
host info:
# uname -r && rpm -q qemu-kvm
3.3.0-0.20.el7.x86_64
qemu-kvm-1.0-17.1.el7.x86_64
guest info:
RHEL-7.0-x86_64

How reproducible:
100%

Steps to Reproduce:
1.boot rhel7 guest with "-smp 2,sockets=2,cores=1,threads=1,maxcpus=6".
eg:# /usr/bin/qemu-kvm -enable-kvm -smp 2,sockets=2,cores=1,threads=1,maxcpus=6 -m 2G -usb -device usb-tablet,id=input0 -name sluo-test -drive file=/home/RHEL-7.0-20120521.n.2_x86_64.qcow2,if=none,id=drive-virtio-disk-0,format=qcow2,cache=none,werror=stop,rerror=stop -device virtio-blk-pci,drive=drive-virtio-disk-0,id=virtio0,bootindex=1 -netdev tap,script=/etc/qemu-ifup,id=netdev0 -device virtio-net-pci,netdev=netdev0,id=device-net0 -vnc :1 -monitor stdio -boot menu=on
2.check the infos for each CPU.
(qemu) info cpus
* CPU #0: pc=0x00000000000fefc6 (halted) thread_id=24624
  CPU #1: pc=0x00000000000ff0a2 (halted) thread_id=24626
3.cpu_set a new cpu online.
(qemu) cpu_set 2 online
  
Actual results:
after the step 3, the QEMU core dump.
(qemu) cpu_set 2 online
qemu-kvm: /builddir/build/BUILD/qemu-kvm-1.0/hw/qdev.c:96: qdev_create_from_info: Assertion `bus->allow_hotplug' failed.

Program received signal SIGABRT, Aborted.
0x00007ffff2fcf965 in raise () from /lib64/libc.so.6

(gdb) bt
#0  0x00007ffff2fcf965 in raise () from /lib64/libc.so.6
#1  0x00007ffff2fd1118 in abort () from /lib64/libc.so.6
#2  0x00007ffff2fc86e2 in __assert_fail_base () from /lib64/libc.so.6
#3  0x00007ffff2fc8792 in __assert_fail () from /lib64/libc.so.6
#4  0x000055555569eca5 in qdev_create_from_info (bus=0x55555649a180, info=0x555555b8f300) at /usr/src/debug/qemu-kvm-1.0/hw/qdev.c:96
#5  0x000055555569fc39 in qdev_create (bus=bus@entry=0x0, name=name@entry=0x55555582babe "apic") at /usr/src/debug/qemu-kvm-1.0/hw/qdev.c:112
#6  0x0000555555782d72 in apic_init (apic_id=2 '\002', env=0x555556e1fcc0) at /usr/src/debug/qemu-kvm-1.0/hw/pc.c:886
#7  pc_new_cpu (cpu_model=<optimized out>) at /usr/src/debug/qemu-kvm-1.0/hw/pc.c:952
#8  0x00005555556f6937 in qemu_system_cpu_hot_add (cpu=2, state=<optimized out>) at /usr/src/debug/qemu-kvm-1.0/hw/acpi_piix4.c:592
#9  0x0000555555759779 in handle_user_command (mon=mon@entry=0x55555652ca20, cmdline=<optimized out>) at /usr/src/debug/qemu-kvm-1.0/monitor.c:4161
#10 0x0000555555759a9e in monitor_command_cb (mon=0x55555652ca20, cmdline=<optimized out>, opaque=<optimized out>) at /usr/src/debug/qemu-kvm-1.0/monitor.c:4777
#11 0x00005555556b138b in readline_handle_byte (rs=0x55555652ce90, ch=<optimized out>) at readline.c:370
#12 0x0000555555759847 in monitor_read (opaque=<optimized out>, buf=<optimized out>, size=<optimized out>) at /usr/src/debug/qemu-kvm-1.0/monitor.c:4763
#13 0x00005555556a3aba in qemu_chr_be_write (len=<optimized out>, buf=0x7fffffffcc70 "\r", s=0x5555563b37d0) at qemu-char.c:179
#14 fd_chr_read (opaque=0x5555563b37d0) at qemu-char.c:673
#15 0x000055555561d677 in qemu_iohandler_poll (readfds=readfds@entry=0x7fffffffdd20, writefds=writefds@entry=0x7fffffffdda0, xfds=xfds@entry=0x7fffffffde20, 
    ret=ret@entry=1) at iohandler.c:156
#16 0x0000555555686961 in main_loop_wait (nonblocking=<optimized out>) at main-loop.c:463
#17 0x00005555555c8e49 in main_loop () at /usr/src/debug/qemu-kvm-1.0/vl.c:1482
#18 main (argc=<optimized out>, argv=<optimized out>, envp=<optimized out>) at /usr/src/debug/qemu-kvm-1.0/vl.c:3528
(gdb) q

Expected results:
should cpu_set a new cpu online successfully without any problem and the guest can work well.

Additional info:
BTW, I also have tried the latest qemu-kvm version '1.1.50 (qemu-kvm-devel)' from upstream, still hit this issue.

Comment 2 Igor Mammedov 2012-08-01 10:08:19 UTC
upstream qemu (not qemu-kvm) doesn't/won't have cpu_set command and upstream qemu-kvm hotplug is known to be broken. My understanding is that rhel7 qemu will be based on upstream qemu (qemu-kvm) so all effort is directed there now and rhel7 should inherit CPU hotlug from there.
Interface to add/remove vCPU is not defined yet for sure, it might be device_add/del.