Bug 596610

Summary: "Guest moved used index from 0 to 61440" if remove virtio serial device before virtserialport
Product: Red Hat Enterprise Linux 6 Reporter: lihuang <lihuang>
Component: qemu-kvmAssignee: Amit Shah <amit.shah>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.0CC: amit.shah, gyue, llim, michen, snagar, syeghiay, tburke, virt-maint
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: qemu-kvm-0.12.1.2-2.114.el6 Doc Type: Bug Fix
Doc Text:
Removing a virtio-serial port or device before a guest has booted and initialised the device would cause QEMU to exit with an error message. This happened due to the exit routines which were called when a port gets unplugged tried to free any unused data the guest may have sent. However, since the guest had not initalised the virtio device, the virtio layer exited with an assert indicating the guest and host virtio state are not in sync. The fix is to not check for any unused data on the host if the guest side virtio state is not yet initialised.
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-05-19 11:28:19 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: 580953    

Description lihuang 2010-05-27 06:39:04 UTC
Description of problem:


Version-Release number of selected component (if applicable):
qemu-kvm-0.12.1.2-2.52.el6.x86_64

How reproducible:
always

Steps to Reproduce:
1. start guest with:
-device virtio-serial-pci,id=virtio-serial0,vectors=4,bus=pci.0,addr=0x4 \
-device virtserialport,bus=virtio-serial0.0,chardev=channel0,name=org.linux-kvm.port.0,id=channel0 \
-chardev socket,path=/tmp/channel0,server,nowait,id=channel0

2. in qemu monitor 
(qemu) device_del virtio-serial0

3.
  
Actual results:
Guest moved used index from 0 to 61440

Expected results:
handle the abnormal request

Additional info:
remove devices in correct order work fine.
(qemu) device_del channel0
(qemu) device_del virtio-serial0

Comment 1 Amit Shah 2010-06-08 06:23:32 UTC
I can't reproduce this; though I see that this really can happen.

Can you tell me exactly when you see this:
1) Does this happen if you start the guest and immediately remove the port, even before the guest has had a chance to boot up?

2) Does this happen after you do some activity on the virtio ports or does that not matter?

3) You are using rhel6 host as well as guest, right?

Comment 2 Amit Shah 2010-07-01 08:54:55 UTC
I just saw the exactly opposite behaviour:

Unplugging the *port* before unplugging the device gives me the 'Guest moved used index from 0 to 61440' message.

Comment 3 Amit Shah 2010-07-01 09:36:23 UTC
Patch submitted upstream:

http://news.gmane.org/find-root.php?message_id=%3c1c5b20f693ebc3882d01d8f2f9e807878251cd42.1277976486.git.amit.shah%40redhat.com%3e

This crash happens only if the virtserialport is removed before the guest boots and initialises the virtqueue structures.

Comment 9 Golita Yue 2011-01-19 09:53:31 UTC
Reproduced in qemu-img-0.12.1.2-2.90.el6.x86_64 with #Description steps

Verified in qemu-img-0.12.1.2-2.120.el6.x86_64

The guest running normally after hot-unplug virtio-serial device directly.

Comment 11 Miya Chen 2011-03-09 03:17:56 UTC
move to verified based on comment#9.

Comment 12 Amit Shah 2011-05-04 10:52:44 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:
Removing a virtio-serial port or device before a guest has booted and initialised the device would cause QEMU to exit with an error message.  This happened due to the exit routines which were called when a port gets unplugged tried to free any unused data the guest may have sent.  However, since the guest had not initalised the virtio device, the virtio layer exited with an assert indicating the guest and host virtio state are not in sync.  The fix is to not check for any unused data on the host if the guest side virtio state is not yet initialised.

Comment 13 errata-xmlrpc 2011-05-19 11:28:19 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

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

Comment 14 errata-xmlrpc 2011-05-19 12:45:27 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

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