Bug 681736

Summary: Guest->Host communication stops for other ports after one port is unplugged
Product: Red Hat Enterprise Linux 6 Reporter: juzhang <juzhang>
Component: qemu-kvmAssignee: Amit Shah <amit.shah>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: high Docs Contact:
Priority: medium    
Version: 6.1CC: amit.shah, bcao, chayang, michen, mkenneth, shu, tburke, virt-maint
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: qemu-kvm-0.12.1.2-2.162.el6 Doc Type: Bug Fix
Doc Text:
After a virtio-serial port unplug, all guest to host communication for all other ports on the same virtio-serial device used to stop. This happened due to incorrectly marking to NULL the backends of the ports on the device. The fix is to not reset to NULL the backends for the device, and instead check the backends per-port.
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-12-06 15:44:52 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 580954    

Description juzhang 2011-03-03 05:15:47 UTC
Description of problem:
The rest channels can't work if hot unplug virtserialport

Version-Release number of selected component (if applicable):
Host kernel version:
#uname -r
2.6.32-118.el6.x86_64
#qemu version
qemu-kvm-0.12.1.2-2.148.el6.x86_64
#guest
Rhel5.6
guest kernel:
2.6.18-245.el5


How reproducible:
2/2

Steps to Reproduce:
1.boot guest with completed virtio-serail  and two chardev configured
#/usr/libexec/qemu-kvm -m 2G -smp 4 -drive file=/root/zhangjunyi/rhel5.6-virtio-64.qcow2,if=none,id=test,cache=none,format=qcow2,werror=stop,rerror=stop -device virtio-blk-pci,drive=test -cpu qemu64,+sse2,+x2apic -boot c -netdev tap,id=hostnet0,vhost=on -device virtio-net-pci,netdev=hostnet0,id=net0,mac=22:11:22:45:66:94 -vnc :10  
/
-device virtio-serial-pci,id=virtio-serial0,max_ports=31
-chardev socket,id=channel0,path=/var/zhangjunyi0,server,nowait 
-device virtserialport,bus=virtio-serial0.0,chardev=channel0,name=org.port.0,id=port1 
/
-chardev socket,id=channel1,path=/var/hotaddport0,server,nowait 
/
-chardev socket,id=channel2,path=/var/hotaddport1,server,nowait -serial stdio 
-qmp tcp:0:4444,server,nowait
2.hot add two virtserialports spawn virtio-serial0 with two configured ports
#{"execute":"device_add","arguments":{"driver":"virtserialport","bus":"virtio-serial0.0","chardev":"channel1","name":"org.linux-kvm.port.10","id":"hotadd1"}}
{"return": {}}
#{"execute":"device_add","arguments":{"driver":"virtserialport","bus":"virtio-serial0.0","chardev":"channel2","name":"org.linux-kvm.port.11","id":"hotadd2"}}
{"return": {}}
3.In guest,I found three channel,tried,all these channel can communicate with host.
4.hot remove one of virtserialport,id port1
#{"execute":"device_del","arguments":{"id":"port1"}}
{"return": {}}
5.In guest,has two vport0p2
#ls | grep vp
vport0p2
vport0p3

6.tried to using the rest channel communicate with host.
in guest
#(for seq in $(seq 1 100); do echo "test $seq"; sleep 1; done)>/dev/vport0p2
#(for seq in $(seq 1 100); do echo "test $seq"; sleep 1; done)>/dev/vport0p3

in host
nc -U hotaddport0
nc -U hotaddport1


  
Actual results:
The result two channel doesn't work.


Expected results:
The result two channel  work fine,remove any other virtserialport can't affect the rest channel.

Additional info:

Comment 2 Amit Shah 2011-03-03 06:29:42 UTC
Reproduced:  guest->host comm. stops, host->guest continues fine.

This might be something in the guest kernel.  Investigating.

Comment 8 Amit Shah 2011-05-05 08:40:38 UTC
*** Bug 702264 has been marked as a duplicate of this bug. ***

Comment 10 Chao Yang 2011-06-16 08:51:04 UTC
I tried with qemu-kvm-0.12.1.2-2.160.el6.x86_64, easy to reproduce with following steps:

1. launch a rhel5.7 guest with two char devices configured.
 ... -chardev socket,id=channel0,path=/tmp/socket0,server,nowait -chardev socket,id=channel1,path=/tmp/socket1,server,nowait ...
2. load virtio_console and acpiphp
3. hot plug two virtio-serial-pci and virtserialport, then transfer data from guest to host
(qemu) device_add  virtio-serial-pci,id=virtio-serial0,max_ports=16,bus=pci.0
(qemu) device_add virtserialport,bus=virtio-serial0.0,nr=0,chardev=channel0,name=org.port0,id=port0
(qemu) device_add  virtio-serial-pci,id=virtio-serial1,max_ports=16,bus=pci.0
(qemu) device_add virtserialport,bus=virtio-serial1.0,nr=1,chardev=channel1,name=org.port1,id=port1
4. hot unplug port1
(qemu) device_del port1
(qemu) device_del virtio-serial1
5. transfer data from guest to host via port0, receive data via nc.
 echo "aaa" > /dev/vport0p0

Actual Result:
Cannot receive string "aaa" via netcat.


Tried same image & steps & CLI mentioned above with qemu-kvm-0.12.1.2-2.165.el6.x86_64, cause Port number 0 on virtio-serial devices reserved for virtconsole devices for backward compatibility, so when hot plug virtserialport, change nr to any number other than 0.

Actual Result:
After step 5, echo "aaa" > /dev/vport0p1 in guest, received "aaa" via nc in host. 

Based on above, this issue has been fixed.

Comment 11 Chao Yang 2011-06-16 08:53:33 UTC
Also tried transferring data from host to guest after step 5, it works well.

Comment 13 Shaolong Hu 2011-08-12 04:52:39 UTC
Reproduced on qemu-kvm-0.12.1.2-2.160.el6.x86_64 as following steps.

Reproduce Procedure:
--------------------------------
1. boot a guest.
#/usr/libexec/qemu-kvm -enable-kvm -smp 4 -m 4G -name rhel6.1-64 -uuid 3f2ea5cd-3d29-48ff-aab2-23df1b6ae213 -drive file=RHEL-Server-6.1-64-virtio.qcow2,cache=none,if=none,rerror=stop,werror=stop,id=drive-virtio-disk0,format=qcow2 -device virtio-blk-pci,drive=drive-virtio-disk0,id=device-virtio-disk0 -netdev tap,script=/etc/qemu-ifup,id=netdev0 -device virtio-net-pci,netdev=netdev0,id=device-net0 -boot order=cd,menu=on -usb -device usb-tablet,id=input0 -monitor stdio -chardev socket,id=channel0,path=/var/c0,server,nowait -chardev socket,id=channel1,path=/var/c1,server,nowait -spice disable-ticketing,port=5910

2. in qemu monitor:
(qemu) device_add  virtio-serial-pci,id=virtio-serial0,max_ports=16,bus=pci.0
(qemu) device_add virtserialport,bus=virtio-serial0.0,nr=1,chardev=channel0,name=org.port0,id=port0
(qemu) device_add  virtio-serial-pci,id=virtio-serial1,max_ports=16,bus=pci.0
(qemu) device_add virtserialport,bus=virtio-serial1.0,nr=1,chardev=channel1,name=org.port1,id=port1

3.in host:
#nc -U /var/c0

4.in guest:
#echo aaa > /dev/vport0p1

5.in qemu monitor:
(qemu) device_del port1

6.in guest:
#echo aaa > /dev/vport0p1


Actual results:
---------------------
After step 4, in host nc receives "aaa", after step 6, nc has no output.





Verify this bug on qemu-kvm-0.12.1.2-2.180.el6.x86_64 as same steps above.

Actual results:
--------------------
After step 6, in host nc receives "aaa".




Conclusion:
--------------------
According to result above, this bug has been fixed.

Comment 15 Amit Shah 2011-11-18 06:59:16 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
After a virtio-serial port unplug, all guest to host communication for all other ports on the same virtio-serial device used to stop.  This happened due to incorrectly marking to NULL the backends of the ports on the device.  The fix is to not reset to NULL the backends for the device, and instead check the backends per-port.

Comment 16 errata-xmlrpc 2011-12-06 15:44:52 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHSA-2011-1531.html