Bug 813227

Summary: Balloon value reported doesn't get updated after guest driver is removed and re-inserted.
Product: Red Hat Enterprise Linux 6 Reporter: Qunfang Zhang <qzhang>
Component: kernelAssignee: Amit Shah <amit.shah>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.3CC: acathrow, amit.shah, areis, bsarathy, dyasny, juzhang, mazhang, michen, mkenneth, virt-maint, ypu
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: kernel-2.6.32-288.el6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-02-21 06:08:05 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 Qunfang Zhang 2012-04-17 09:27:33 UTC
Description of problem:
Boot a guest with virtio balloon devices -> Then balloon mem from the default max value to a smaller one, for example from 2048m to 2000m -> Next remove balloon driver from inside guest with rmmod command -> check the balloon value and enlarge it back to 2048M (it will not work as the driver is removed) -> reload the balloon driver from guest with modprobe command -> check the balloon value and enlarge it to 2048M. 

Result: failed, the mem is still 2000m.

Version-Release number of selected component (if applicable):
Host:
kernel-2.6.32-262.el6.x86_64
qemu-kvm-0.12.1.2-2.275.el6.x86_64
seabios-0.6.1.2-18.el6.x86_64
Guest:
kernel-2.6.32-262.el6.x86_64

How reproducible:
100%

Steps to Reproduce:
1. Boot a guest with virtio balloon device.
/usr/libexec/qemu-kvm -M rhel6.3.0 -cpu Conroe -enable-kvm -m 2G -smp 2,sockets=1,cores=2,threads=1 -name rhel6.3 -uuid 4c84db67-faf8-4498-9829-19a3d6431d9d -rtc base=localtime,driftfix=slew -netdev tap,id=hostnet0,vhost=on,script=/etc/qemu-ifup -device virtio-net-pci,netdev=hostnet0,id=net0,mac=00:1a:2a:42:10:62,bus=pci.0,addr=0x3 -boot c -spice port=5930,disable-ticketing -vga qxl -global qxl-vga.vram_size=33554432 -qmp tcp:0:4444,server,nowait -bios /usr/share/seabios/bios-pm.bin  -chardev socket,path=/tmp/qzhang-test-lucky,server,nowait,id=isa1 -device isa-serial,chardev=isa1,id=isa-serial1  -drive file=/dev/vgtest-qzhang/lv-6.3,if=none,format=qcow2,id=scsi0 -device virtio-scsi-pci,id=scsi0 -device scsi-disk,bus=scsi0.0,drive=scsi0,scsi-id=0,lun=0 -drive if=none,id=cd -device scsi-cd,drive=cd -usb -device usb-tablet,id=input0  -monitor stdio -device virtio-balloon-pci,id=balloon0,bus=pci.0


2. (qemu) info balloon
balloon: actual=2048

3. (qemu) balloon 2000
(qemu)info balloon
balloon: actual=2000

4. Inside guest:
#rmmod virtio-balloon

5. (qemu)info balloon 
balloon: actual=2000

6. (qemu) balloon 2048
(qemu)info balloon
balloon: actual=2000

7. Inside guest:
#modprobe virtio-balloon

8. (qemu)info balloon 
balloon: actual=2000

9. (qemu) balloon 2048
(qemu) info balloon
balloon: actual=2000
  
Actual results:
After step 9, the balloon value is 2000 (M)

Expected results:
After step 9, the balloon value should be 2048 (M)

Additional info:
If skip step 6, everything works well.
If after step 9, do:
10. (qemu) balloon 2040
then (qemu) balloon 2048
everything works well.

Comment 2 Amit Shah 2012-04-17 09:56:16 UTC
What does the output of 'free' show within the guest after all these commands?

This could be a reporting issue rather than an actual bug in mem resizing.

Comment 3 Qunfang Zhang 2012-04-17 10:11:08 UTC
Oh, I just want to update some information related 'free' output:

1. Step 2:
[root@localhost ~]# free -m
             total       used       free     shared    buffers     cached
Mem:          1878        467       1410          0         16        143
-/+ buffers/cache:        308       1570
Swap:         2015          0       2015

2. step 3:
[root@localhost ~]# free -m
             total       used       free     shared    buffers     cached
Mem:          1830        467       1363          0         16        143
-/+ buffers/cache:        307       1523
Swap:         2015          0       2015


2.From step 4-9, "free -m" always show the largest value as setting in the
command line.
That's the same output as when I just boot up guest and do nothing:

[root@localhost ~]# free -m
             total       used       free     shared    buffers     cached
Mem:          1878        467       1410          0         16        143
-/+ buffers/cache:        308       1570
Swap:         2015          0       2015

Comment 4 Amit Shah 2012-04-17 11:09:33 UTC
OK, so this is as expected and the guest behaves normally.  If you try 'balloon 2000' as step 10, guest should update with new values.

This is a reporting problem, though.  No idea why qemu isn't querying the guest as to what the current balloon value is.

Comment 5 Ademar Reis 2012-04-17 15:42:25 UTC
This is a corner case and the guest behaves correctly, so not critical, deferring to 6.4.

Comment 6 Luiz Capitulino 2012-04-26 17:59:39 UTC
Doesn't seem to be a serious issue to me either. Will look into this soon to confirm it.

Comment 7 Amit Shah 2012-04-26 19:17:43 UTC
Turns out the kernel doesn't update stats on module removal.  Patches posted upstream.

Comment 8 RHEL Program Management 2012-07-09 21:50:27 UTC
This request was evaluated by Red Hat Product Management for
inclusion in a Red Hat Enterprise Linux release.  Product
Management has requested further review of this request by
Red Hat Engineering, for potential inclusion in a Red Hat
Enterprise Linux release for currently deployed products.
This request is not yet committed for inclusion in a release.

Comment 9 Jarod Wilson 2012-07-23 17:31:08 UTC
Patch(es) available on kernel-2.6.32-288.el6

Comment 12 mazhang 2012-12-17 09:44:56 UTC
Reproduce this bug on
host
kernel:2.6.32-279.9.1.el6.x86_64
qemu-kvm:qemu-kvm-0.12.1.2-2.265.el6.x86_64

guest
kernel:2.6.32-279.el6.x86_64

Steps to Reproduce:
1. Boot a guest with virtio balloon device.
/usr/libexec/qemu-kvm -M rhel6.3.0 -cpu host -enable-kvm -m 2G -smp 2,sockets=1,cores=2,threads=1 -name rhel6.3 -uuid 4c84db67-faf8-4498-9829-19a3d6431d9d -rtc base=localtime,driftfix=slew -boot c -spice port=5930,disable-ticketing -vga qxl -global qxl-vga.vram_size=33554432 -qmp tcp:0:4444,server,nowait -bios /usr/share/seabios/bios-pm.bin  -chardev socket,path=/tmp/qzhang-test-lucky,server,nowait,id=isa1 -device isa-serial,chardev=isa1,id=isa-serial1  -drive file=/root/RHEL-Server-6.3-64-virtio.qcow2,if=none,format=qcow2,id=scsi0 -device virtio-scsi-pci,id=scsi0 -device scsi-disk,bus=scsi0.0,drive=scsi0,scsi-id=0,lun=0 -drive if=none,id=cd -device scsi-cd,drive=cd -usb -device usb-tablet,id=input0  -monitor stdio -device virtio-balloon-pci,id=balloon0,bus=pci.0

2. (qemu) info balloon
balloon: actual=2048

3. (qemu) balloon 2000
(qemu)info balloon
balloon: actual=2000

4. Inside guest:
#rmmod virtio-balloon

5. (qemu)info balloon 
balloon: actual=2000

6. (qemu) balloon 2048
(qemu)info balloon
balloon: actual=2000

7. Inside guest:
#modprobe virtio-balloon

8. (qemu)info balloon 
balloon: actual=2000

9. (qemu) balloon 2048
(qemu) info balloon
balloon: actual=2000

Actual results:
After step 9, the balloon value is 2000 (M)

Expected results:
After step 9, the balloon value should be 2048 (M)


Verified this bug on
host
kernel:2.6.32-279.9.1.el6.x86_64
qemu-kvm:qemu-kvm-0.12.1.2-2.265.el6.x86_64

guest
kernel:2.6.32-347.el6.x86_64

Steps to Reproduce:
1. Boot a guest with virtio balloon device.
/usr/libexec/qemu-kvm -M rhel6.3.0 -cpu host -enable-kvm -m 2G -smp 2,sockets=1,cores=2,threads=1 -name rhel6.3 -uuid 4c84db67-faf8-4498-9829-19a3d6431d9d -rtc base=localtime,driftfix=slew -boot c -spice port=5930,disable-ticketing -vga qxl -global qxl-vga.vram_size=33554432 -qmp tcp:0:4444,server,nowait -bios /usr/share/seabios/bios-pm.bin  -chardev socket,path=/tmp/qzhang-test-lucky,server,nowait,id=isa1 -device isa-serial,chardev=isa1,id=isa-serial1  -drive file=/root/RHEL-Server-6.3-64-virtio.qcow2,if=none,format=qcow2,id=scsi0 -device virtio-scsi-pci,id=scsi0 -device scsi-disk,bus=scsi0.0,drive=scsi0,scsi-id=0,lun=0 -drive if=none,id=cd -device scsi-cd,drive=cd -usb -device usb-tablet,id=input0  -monitor stdio -device virtio-balloon-pci,id=balloon0,bus=pci.0

2. (qemu) info balloon
balloon: actual=2048

3. (qemu) balloon 2000
(qemu)info balloon
balloon: actual=2000


4. Inside guest:
#rmmod virtio-balloon

5. (qemu)info balloon 
balloon: actual=2048  --->the balloon value and enlarge it back to 2048M

6. (qemu) balloon 2048
(qemu)info balloon
balloon: actual=2048  

7. Inside guest:
#modprobe virtio-balloon

8. (qemu)info balloon 
balloon: actual=2048

9. (qemu) balloon 2048
(qemu) info balloon
balloon: actual=2048

Actual results:
After step 5 and 9, the balloon value is 2048 (M)
guest work well.

So this bug has been fixed.

Comment 13 juzhang 2012-12-18 03:21:55 UTC
According to comment12, set this issue as verified.

Comment 15 errata-xmlrpc 2013-02-21 06:08:05 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-2013-0496.html