Bug 725625

Summary: Hot unplug one virtio balloon device cause another balloon device unavailable
Product: Red Hat Enterprise Linux 6 Reporter: Qunfang Zhang <qzhang>
Component: qemu-kvmAssignee: Amit Shah <amit.shah>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.2CC: amit.shah, flang, juzhang, michen, mkenneth, tburke, virt-maint, vrozenfe, xfu
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: qemu-kvm-0.12.1.2-2.179.el6 Doc Type: Bug Fix
Doc Text:
It was possible to expose multiple balloon devices to the guest. This could cause undefined behaviour when the various balloon devices were given different commands. The fix is to not allow more than one balloon device.
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-12-06 15:54:36 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 Qunfang Zhang 2011-07-26 06:30:27 UTC
Description of problem:
Boot guest with 2 virtio balloon devices, and then balloon the memory to a smaller value, it works. Then hot unplug one virtio balloon device, something unexpected happens:
(1) For windows guest, balloon value will change to the original as configured in qemu command line. Then ballooning the memory to another value, nothing changes.
(2) For RHEL guest, balloon the memory from 2048 to 2000 for example. And then hot unplug one virtio balloon device and leave another one. Checked the memory, it is still 2000M. Then ballooning the memory to a new one, such as 1900(M), nothing happens.

Version-Release number of selected component (if applicable):
kernel-2.6.32-171.el6.x86_64
qemu-kvm-0.12.1.2-2.171.el6.x86_64

How reproducible:
Always

Steps to Reproduce:
1.Boot a guest with two virtio balloon devices:
/usr/libexec/qemu-kvm -m 16G -smp 4 -cpu cpu64-rhel6,+x2apic -usbdevice tablet -drive file=win7-64-virtio.qcow2,format=qcow2,if=none,id=drive-ide0-0-0,werror=stop,rerror=stop,cache=none -device virtio-blk-pci,drive=drive-ide0-0-0,id=ide0-0-0 -netdev tap,id=hostnet0,script=/etc/qemu-ifup -device e1000,netdev=hostnet0,mac=00:10:1a:20:06:28,bus=pci.0,addr=0x6 -boot dc -uuid bea9c85e-0a47-4030-979d-5d94bb3d6161 -rtc-td-hack -no-kvm-pit-reinjection -monitor stdio -qmp tcp:0:4444,server,nowait -name win7-64-balloon -spice disable-ticketing,port=5931 -vga qxl -device virtio-balloon-pci,bus=pci.0,id=balloon0 -device virtio-balloon-pci,bus=pci.0,id=balloon1

2.{"execute":"query-balloon"}
{"return": {"actual": 17179869184}}

{"execute":"balloon","arguments":{"value":16106127360}}
{"return": {}}

{"execute":"query-balloon"}
{"return": {"actual": 16552820736}}

{"execute":"query-balloon"}
{"return": {"actual": 16106127360}}


3. Hot unplug one virtio balloon device.

{"execute":"device_del","arguments":{"id":"balloon1"}}
{"return": {}}

4. Check the memory
{"execute":"query-balloon"}
{"return": {"actual": 17179869184}}

{"execute":"query-balloon"}
{"return": {"actual": 17179869184}}

5. {"execute":"balloon","arguments":{"value":16106127360}}
{"return": {}}

{"execute":"query-balloon"}
{"return": {"actual": 17179869184}}

  
Actual results:
Hot unplug one virtio balloon device cause another balloon device unavailable

Expected results:
Another virtio balloon device should work after hot unplug the first one.

Additional info:

Comment 2 Amit Shah 2011-08-01 11:44:25 UTC
Multiple balloon devices don't make sense.  This will be fixed by making sure we cannot hot-plug more than one balloon device.

Comment 7 FuXiangChun 2011-08-18 09:30:37 UTC
verify on qemu-kvm-0.12.1.2-2.182.el6.x86_64
kernel 2.6.32-189.el6.x86_64

steps to verification
1.# /usr/libexec/qemu-kvm -enable-kvm -m 6G -smp 4 -name rhel6 -uuid ddcbfb49-3411-1701-3c36-6bdbc00bedb9 -rtc base=utc,clock=host,drdev/migrate/data3,if=none,id=drive-ide0-0-0,boot=on,format=qcow2,cache=none -device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0,physical_block_size=4096,logical_block_size=4096 -netdev tap,id=hostnet0 -device virtio-net-pci,netdev=hostnet0,id=net0,mac=52:54:50:a4:c2:c2 -chardev pty,id=serial0 -device isa-serial,chardev=serial0 -usb -device usb-tablet,id=input0 -spice id=on,disable-ticketing,port=5911 -monitor stdio -device virtio-balloon-pci,bus=pci.0,id=balloon0 -device virtio-balloon-pci,bus=pci.0,id=balloon1

actual result:
qemu-kvm: -device virtio-balloon-pci,bus=pci.0,id=balloon1: Another balloon device already registered
qemu-kvm: -device virtio-balloon-pci,bus=pci.0,id=balloon1: Device 'virtio-balloon-pci' could not be initialized

2./usr/libexec/qemu-kvm -enable-kvm -m 6G -smp 4 -name rhel6 -uuid ddcbfb49-3411-1701-3c36-6bdbc00bedb9 -rtc base=utc,clock=host,drdev/migrate/data3,if=none,id=drive-ide0-0-0,boot=on,format=qcow2,cache=none -device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0,physical_block_size=4096,logical_block_size=4096 -netdev tap,id=hostnet0 -device virtio-net-pci,netdev=hostnet0,id=net0,mac=52:54:50:a4:c2:c2 -chardev pty,id=serial0 -device isa-serial,chardev=serial0 -usb -device usb-tablet,id=input0 -spice id=on,disable-ticketing,port=5911 -monitor stdio -device virtio-balloon-pci,bus=pci.0,id=balloon0 

3.(qemu) device_del balloon0

actual result:

can not delete balloon device from monitor

base on above result.  this bug has been fixed.

Comment 8 langfang 2011-09-01 03:04:44 UTC
Reproduced this issue with qemu-kvm-0.12.1.2-2.178.el6.x86_64,kernel
2.6.32-171.el6.x86_64:
Steps:
1)boot guest with two balloons
-device virtio-balloon-pci,bus=pci.0,id=balloon0 -device
virtio-balloon-pci,bus=pci.0,id=balloon1
2)(qemu)info balloon
balloon: actual=3000
3)Hot unplug one virtio balloon device:
(qemu)device_del balloon1
4)(qemu) balloon 2900
5)(qemu) info balloon
   balloon: actual=3000

Result: The balloon device does not function well after hot unplug
another balloon.


Verified pass on qemu-kvm-0.12.1.2-2.184.el6.x86_64,kernel
2.6.32-191.el6.x86_64:
I test 3 scenarios:

1)boot guest with two balloons
Result: QEMU gives the friendly prompts:
qemu-kvm: -device virtio-balloon-pci,bus=pci.0,id=balloon1: Another
balloon device already registered
qemu-kvm: -device virtio-balloon-pci,bus=pci.0,id=balloon1: Device
'virtio-balloon-pci' could not be initialized


2)boot guest with one balloon, and then hot plug the second one:
(qemu)device_add driver=virtio-balloon-pci,id=balloon2

Result: QEMU gives the friendly tip:
Another balloon device already registered
Device 'virtio-balloon-pci' could not be initialized
(qemu)

3)Boot guest with none balloon and then hot plug 2 balloon devices:

(qemu)device_add driver=virtio-balloon-pci,id=balloon1
(qemu)device_add driver=virtio-balloon-pci,id=balloon2

Results: Can not hot plug the 2nd balloon, QEMU gives the friendly tip:
Another balloon device already registered
Device 'virtio-balloon-pci' could not be initialized


So, According to Amit's patch, don't allow multiple balloon handler
registrations.
this bug is verified pass.

Comment 10 Amit Shah 2011-11-18 12:08:32 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:
It was possible to expose multiple balloon devices to the guest.  This could cause undefined behaviour when the various balloon devices were given different commands.  The fix is to not allow more than one balloon device.

Comment 11 errata-xmlrpc 2011-12-06 15:54:36 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