Bug 949211

Summary: 'An undefined error has occurred' when hot unplug the unsupport hotplugging usb-ehci in rhel7
Product: Red Hat Enterprise Linux 7 Reporter: Sibiao Luo <sluo>
Component: qemu-kvmAssignee: Amnon Ilan <ailan>
Status: CLOSED WONTFIX QA Contact: Virtualization Bugs <virt-bugs>
Severity: low Docs Contact:
Priority: low    
Version: 7.0CC: chayang, hhuang, jasowang, juli, juzhang, knoel, kraxel, michen, qzhang, rbalakri, virt-maint, xfu
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-06-28 11:50:34 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 2013-04-07 03:40:38 UTC
Description of problem:
bug 879096 that disable the device 'usb-ehci' which does not support hotplugging in rhel6. I check it in rhel7 that qemu has disble the unsupport hotplugging usb-ehci, and there is a 'An undefined error has occurred' qemu prompt in HMP monitor, but it did not appear in QMP monitor.

Version-Release number of selected component (if applicable):
hostinfo:
kernel-3.9.0-0.rc4.45.el7.x86_64
qemu-kvm-1.4.0-1.el7.x86_64
seabios-1.7.2-0.2.gita810e4e7.el7.x86_64
guest info:
win2012 64bit

How reproducible:
100%

Steps to Reproduce:
1.boot guest with 'usb-ehci' controller under pc-i440fx-1.4.
# /usr/libexec/qemu-kvm -S -M pc-i440fx-1.4 -cpu SandyBridge -enable-kvm -m 4096 -smp 2,sockets=2,cores=1,threads=1 -no-kvm-pit-reinjection -name sluo-test -uuid ed09fa10-6ffe-4811-a42f-0294afcb5a42 -rtc base=localtime,clock=host,driftfix=slew -device virtio-serial-pci,id=virtio-serial0,max_ports=16,vectors=0,bus=pci.0,addr=0x3 -chardev socket,id=channel1,path=/tmp/helloworld1,server,nowait -device virtserialport,chardev=channel1,name=com.redhat.rhevm.vdsm,bus=virtio-serial0.0,id=port1 -chardev socket,id=channel2,path=/tmp/helloworld2,server,nowait -device virtserialport,chardev=channel2,name=com.redhat.rhevm.vdsm,bus=virtio-serial0.0,id=port2 -drive file=/home/windows_server_2012_x64.qcow2,if=none,id=drive-system-disk,format=qcow2,cache=none,aio=native,werror=stop,rerror=stop,serial=QEMU-DISK1 -device virtio-scsi-pci,bus=pci.0,addr=0x4,id=scsi0 -device scsi-hd,bus=scsi0.0,drive=drive-system-disk,id=system-disk,bootindex=1 -netdev tap,id=hostnet0,vhost=off,script=/etc/qemu-ifup -device virtio-net-pci,netdev=hostnet0,id=virtio-net-pci0,mac=08:2e:5f:0a:0d:b1,bus=pci.0,addr=0x5,bootindex=2 -device virtio-balloon-pci,id=ballooning,bus=pci.0,addr=0x6 -drive file=/home/my-data-disk.raw,if=none,id=drive-data-disk,format=raw,cache=none,aio=native,werror=stop,rerror=stop,serial=QEMU-DISK2 -device virtio-scsi-pci,bus=pci.0,addr=0x7,id=scsi1 -device scsi-hd,bus=scsi1.0,drive=drive-data-disk,id=data-disk -device usb-ehci,id=ehci,bus=pci.0,addr=0x8 -global PIIX4_PM.disable_s3=0 -global PIIX4_PM.disable_s4=0 -serial unix:/tmp/ttyS0,server,nowait -qmp tcp:0:4444,server,nowait -k en-us -boot menu=on -vnc :1 -spice disable-ticketing,port=5931 -monitor stdio
2.do hot-unplug/plug 'usb-ehci' controller in HMP monitor.
(qemu) device_del ehci

(qemu) device_add usb-ehci,id=ehci1,bus=pci.0,addr=0x9
  
Actual results:
after step 2, the qemu prompt as following:
(qemu) device_del ehci
Device 'usb-ehci' does not support hotplugging
An undefined error has occurred               <-----------here
(qemu) 
(qemu) device_add usb-ehci,id=ehci1,bus=pci.0,addr=0x9
Device 'usb-ehci' does not support hotplugging
Device 'usb-ehci' could not be initialized

Expected results:
there should no 'An undefined error has occurred' when do hot-unplug usb-ehci. 

Additional info:
I tried it var QMP monitor that did have such issue, it prompt correctly.
{"execute":"device_del","arguments":{"id":"ehci"}}
{"error": {"class": "GenericError", "desc": "Device 'usb-ehci' does not support hotplugging"}}
{"execute":"device_add","arguments":{"driver":"usb-ehci","id":"ehci1","bus":"pci.0","addr":"0x9"}}
{"error": {"class": "GenericError", "desc": "Device 'usb-ehci' does not support hotplugging"}}

Comment 1 Michael S. Tsirkin 2013-11-06 13:13:12 UTC
ok so this is a minor bug.
it's expected that unplug fails.
the fact that is prints 'undefined error has occured' is wrong.

only hmp has this issue so cosmetic, low priority

Comment 5 Amos Kong 2014-12-15 08:52:17 UTC
There is some refactor, the problem doesn't exist in qemu-upstrean and qemu-kvm-rhev.

This problem only exists in qemu-kvm, we need a internal fix.


hw/core/qdev.c:
void qdev_unplug(DeviceState *dev, Error **errp)
{
    ......
    if (dc->unplug(dev) < 0) {
        error_set(errp, QERR_UNDEFINED_ERROR);
        return;
    }
}

hw/pci/pci.c:
static int pci_unplug_device(DeviceState *qdev)
{
    ......                                  
    if (pc->no_hotplug) {
        qerror_report(QERR_DEVICE_NO_HOTPLUG,
                      object_get_typename(OBJECT(dev)));
-        return -1;
+        return 0;
    }
    ......
}

Comment 12 jason wang 2015-06-02 06:13:50 UTC
According to Amos:

The patch lies to qdev_unplug()'s caller to suppress one error,
the fix causes some incoordination between downstream and upstream.

The problem only effects HMP, which isn't supported. So it's better to close
it as WONTFIX as suggested by Markus.

The trivial problem can be fixed by future rebasing.

Looks like we can just close this as WONTFIX.