Bug 759019

Summary: [virtio-win][serial]Qemu-kvm quit with "Guest move used index from 0 to 256" after hot unplug/plug virtio-serial-port while it is in use
Product: Red Hat Enterprise Linux 6 Reporter: Mike Cao <bcao>
Component: virtio-winAssignee: Gal Hammer <ghammer>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: high Docs Contact:
Priority: urgent    
Version: 6.3CC: acathrow, amit.shah, bcao, bsarathy, juzhang, mdeng, michen, mst, rhod, tburke, virt-maint, yvugenfi
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: virtio-win-prewhql-0.1-51 Doc Type: Bug Fix
Doc Text:
This was noticed by hot-unplugging a virtio console port and then plugging in a new one on the same number (re-using the vqs which were just 'disowned'). qemu reported 'Guest moved used index from 0 to 256' when any IO was attempted on the new port. When detaching a buffer from a vq, the avail.idx value should be decremented as well.
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-11-21 23:55:48 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:

Description Mike Cao 2011-12-01 09:11:42 UTC
Version-Release number of selected component (if applicable):
# uname -r
2.6.32-220.el6.x86_64
[root@test mnt]# rpm -q qemu-kvm
qemu-kvm-0.12.1.2-2.209.el6.x86_64
virtio-win-prewhql-0.1.19

How reproducible:
1 times ,other time hit Bug 759011

Steps to Reproduce:
1.start *windows* guest with virtio-serial-pci and virtio-serial-port.
CLI:/usr/libexec/qemu-kvm -M rhel6.2.0 -enable-kvm -m 2048 -smp
2,sockets=2,cores=1,threads=1 -name 2k8_r2_prewhql_19 -uuid
e051abc5-c1aa-1bc6-10ab-037881c036c5 -monitor stdio -rtc
base=localtime,driftfix=slew -drive
file=/home/backup/test/winxp_prewhql_19,if=none,id=drive-virtio-disk0,format=raw,cache=none
-device
virtio-blk-pci,bus=pci.0,addr=0x6,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1
-drive if=none,media=cdrom,id=drive-ide0-1-0,readonly=on,format=raw -device
ide-drive,bus=ide.1,unit=0,drive=drive-ide0-1-0,id=ide0-1-0 -netdev
tap,id=hostnet0,vhost=on -device
virtio-net-pci,netdev=hostnet0,id=net0,mac=f2:54:00:b5:df:19,bus=pci.0,addr=0x3
-chardev pty,id=charserial0 -device isa-serial,chardev=charserial0,id=serial
-usb -device usb-tablet,id=input0 -spice
port=5902,addr=0.0.0.0,disable-ticketing -vga qxl -global
qxl-vga.vram_size=67108864 -device intel-hda,id=sound0,bus=pci.0,addr=0x4
-device hda-duplex,id=sound0-codec0,bus=sound0.0,cad=0 -balloon none -device
virtio-serial-pci,id=virtio-serial0,max_ports=16 -chardev
socket,id=charchannel0,path=/tmp/tt1,server,nowait -device
virtserialport,bus=virtio-serial0.0,nr=1,chardev=charchannel0,id=channel0,name=com.redhat.rhevm.vdsm
-chardev spicevmc,id=charchannel1,name=vdagent -device
virtserialport,bus=virtio-serial0.0,nr=2,chardev=charchannel1,id=channel1,name=com.redhat.spice.0
2.use script to transfer data from guest to guest (will attach the scripts)
for ((;;))
do
  python VirtioChannel.py 
done
3.listen the virtio-serial-port socket on the host
nc -U /tmp/tt1
4.Remove virtio-serial-port
(qemu)device_del channel0
5.host add the virito-serial-port
(qemu)device_add virtserialport,bus=virtio-serial0.0,nr=1,chardev=charchannel0,id=channel0,name=com.redhat.rhevm.vdsm

Actual results:
Guest quit with "Guest move used index from 0 to 256"

Additional info:
windows_support.py in the guest referring to 
https://bugzilla.redhat.com/attachment.cgi?id=539002

VirtIoChannel.py  in the guest referring to 
https://bugzilla.redhat.com/attachment.cgi?id=539003

Comment 1 Mike Cao 2011-12-12 03:09:46 UTC
(In reply to comment #0)

> 
> How reproducible:
> 1 times ,other time hit Bug 759011
> 
Retried ,very easy to reproduce .

Comment 2 Ronen Hod 2012-01-23 22:48:44 UTC
Seems to be identical to https://bugzilla.redhat.com/show_bug.cgi?id=781292.
The other bug is pure Linux, maybe better to close this one.

mst, any comments?

Comment 3 Vadim Rozenfeld 2012-01-24 08:06:36 UTC
Seems like a different problem to me. 
Let me check this issue, before we 
move forward.

best,
Vadim.

Comment 5 Mike Cao 2012-03-19 08:50:26 UTC
Raise the priority because half of the functional test cases for virtio serial is related to pci hot plug/unplug.

Comment 6 Dor Laor 2012-03-19 11:03:09 UTC
(In reply to comment #5)
> Raise the priority because half of the functional test cases for virtio serial
> is related to pci hot plug/unplug.

It's not urgent since hotplug of virtio-serial is not common so I deferred it to the next release. Please add technical notes to the issue

Comment 7 Mike Cao 2012-03-19 15:28:09 UTC
(In reply to comment #6)
> (In reply to comment #5)
> > Raise the priority because half of the functional test cases for virtio serial
> > is related to pci hot plug/unplug.
> 
> It's not urgent since hotplug of virtio-serial is not common so I deferred it
> to the next release. Please add technical notes to the issue

Ok. Will do it tmr .

and FYI ,there is a similar  Bug 681122 for RHEL guest which has already been fixed in RHEL6.2

Comment 8 Mike Cao 2012-03-19 15:42:43 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:
This was noticed by hot-unplugging a virtio console port and then plugging in a new one on the same number (re-using the vqs which were just 'disowned').  qemu reported    'Guest moved used index from 0 to 256' when any IO was attempted on the new port.

When detaching a buffer from a vq, the avail.idx value should be decremented as well.

Comment 10 Ronen Hod 2012-07-10 09:04:39 UTC
In work- need to test with the next version - in 2-3 weeks

Comment 11 Min Deng 2012-09-27 02:43:31 UTC
I still can reproduce the issue on virtio-win-prewhql-35 on win7-32 OS.

Comment 12 Ronen Hod 2012-10-16 14:32:55 UTC
Too late for such issue in RHEL6.4. Deferring to 6.5.

Comment 13 Ronen Hod 2012-10-16 14:39:23 UTC
Maybe worth checking again since it seems since a related bug 801423 is fixed.

Comment 14 dawu 2012-10-17 10:01:43 UTC
Checking latest build virtio-win-prewhql-41 on win7-32, still hit the issue.

Comment 16 dawu 2013-01-18 08:23:03 UTC
Reproduce this bug with virtio-win-prewhql-41 on win7-32,verified this bug with virtio-win-prewhql-51 with steps as comment #0

Actually Results:
on version virtio-win-prewhql-41,qemu-kvm quit with "Guest move used index from 0 to 256"
on version virtio-win-prewhql-51, guest works well without any error.

Based on above, this issue has been fixed.

Thanks!

Best Regards,
Dawn

Comment 17 Mike Cao 2013-01-21 03:20:36 UTC
Based on comment#16 

This issue has been fixed already .Since build49 will be shipped out ,move status to VERIFIED and keep product flag to rhel6.5.0

Comment 21 errata-xmlrpc 2013-11-21 23:55:48 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/RHBA-2013-1729.html