Bug 610787

Summary: [balloon]evict windows guest free memory does not work
Product: Red Hat Enterprise Linux 6 Reporter: Shirley Zhou <szhou>
Component: virtio-winAssignee: Vadim Rozenfeld <vrozenfe>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: high Docs Contact:
Priority: high    
Version: 6.0CC: lihuang, llim, mshao, qzhang, syeghiay, tburke, ykaul
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: virtio-win-1.1.15 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-05-19 14:31:16 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    
Attachments:
Description Flags
libvirt log none

Description Shirley Zhou 2010-07-02 13:01:00 UTC
Description of problem:
evict free memory with virtio balloon on windows guest does not work

Version-Release number of selected component (if applicable):
kernel-2.6.32-37.el6.x86_64
qemu-kvm-0.12.1.2-2.90.el6.x86_64
virtio-win-1.1.7-1 from http://download.lab.bos.redhat.com/devel/RHEV/virtio-win/1.1.7-1/  

How reproducible:
always

Steps to Reproduce:
1. Start windows guest
/usr/libexec/qemu-kvm -m 8G -smp 4 -cpu qemu64,+x2apic -usbdevice tablet -drive file=/home/win7-64.qcow2,format=qcow2,if=none,id=drive-ide0-0-0,format=qcow2,cache=none -device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0  -netdev tap,id=hostnet0,vhost=on,script=/etc/qemu-ifup -device virtio-net-pci,netdev=hostnet0,mac=0a:00:34:45:20:1A,bus=pci.0 -uuid 1234c27c-e6e3-4e67-95da-8dd0a8891cc4 -rtc-td-hack -no-kvm-pit-reinjection -monitor stdio -name win08r2 -device virtio-balloon-pci,bus=pci.0  -qmp tcp:0:4444,server,nowait -spice port=5930,disable-ticketing -vga qxl -boot c 
2.Install virtio balloon driver in guest and reboot guest
3.Check balloon info using qmp
{"execute":"query-balloon"}
{"return": {"actual": 8587837440}}
4.Do evict memory operation on qmp as following

{"execute":"balloon","arguments":{"value":6000000000}}
{"return": {}}
{"execute":"query-balloon"}
{"return": {"actual": 8583643136}}
{"execute":"balloon","arguments":{"value":1200000000}} 
{"return": {}}
{"execute":"query-balloon"}
{"return": {"actual": 8581545984}}
  
Actual results:

After execute {"execute":"balloon","arguments":{"value":6000000000}},memory do not change to value we set.

Expected results:
The memory should change to value we set immediately.

Additional info:

I tried with guest windows 7, windows 2008 R2 and win03 x64, all have this issue, and can not reproduce this issue on RHEL5.5 guest.

Comment 2 Shirley Zhou 2010-07-02 13:15:02 UTC
Additional info:
I tried with virtio-win-1.1.6-1, windows 2003 x64 does work, windows 7 and
windows 2008 R2 does not work.

Comment 5 Dor Laor 2010-07-04 13:08:35 UTC
Note that you need to run the window service in order to get statistics.
Vadim, please add the details

Comment 6 Vadim Rozenfeld 2010-07-04 15:29:54 UTC
"blnsvr.exe -i" to install the service
"blnsvr.exe -u" to uninstall the service

Comment 7 Shirley Zhou 2010-07-05 03:59:14 UTC
(In reply to comment #6)
> "blnsvr.exe -i" to install the service
> "blnsvr.exe -u" to uninstall the service    

Guest:windows 2008 R2

virtio-win-1.1.6-1:

{"execute":"query-balloon"}
{"return": {"actual": 4294967296, "mem_swapped_in": 0, "minor_page_faults": 0, "mem_swapped_out": 0, "free_mem": 3688632320, "major_page_faults": 0, "total_mem": 4294545408}}
{"execute":"balloon","arguments":{"value":3000000000}}
{"return": {}}
{"execute":"query-balloon"}
{"return": {"actual": 4288675840, "mem_swapped_in": 0, "minor_page_faults": 0, "mem_swapped_out": 0, "free_mem": 3603152896, "major_page_faults": 0, "total_mem": 4294545408}}

virtio-win-1.1.7-1:
{"execute":"query-balloon"}
{"return": {"actual": 4294967296, "mem_swapped_in": 1959}}
{"execute":"balloon","arguments":{"value":3000000000}}
{"return": {}}
{"execute":"query-balloon"}
{"return": {"actual": 4282384384, "mem_swapped_in": 0}}
{"execute":"query-balloon"}
{"return": {"actual": 4280287232, "mem_swapped_in": 0}}

Comment 8 Vadim Rozenfeld 2010-07-05 05:47:53 UTC
I don't see any problem here. You cannot inflate balloon as big as you wish. Ballooning is a non-paged memory allocation operation. Non-paged memory is a very limited resource and nobody can guarantee that you will get as much as you asked. After all, playing with balloon means playing against OS, its Memory Manager, and other drivers.
You can get a better picture when looking at Performance Monitor while inflating/deflating balloon.

Best regards,
Vadim.

Comment 9 Shirley Zhou 2010-07-05 10:07:10 UTC
Guest: windows 2008 R2
Driver:virtio-win-1.1.7-1:
kernel-2.6.32-37.el6.x86_64
qemu-kvm-0.12.1.2-2.90.el6.x86_64

CLI:
/usr/libexec/qemu-kvm -m 4G -smp 2 -cpu qemu64,+x2apic -usbdevice tablet -drive file=/home/win2008r2-64-virtio.qcow2,if=none,id=drive-ide0-0-0,format=qcow2,cache=none -device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0  -netdev tap,id=hostnet0,vhost=on,script=/etc/qemu-ifup -device virtio-net-pci,netdev=hostnet0,mac=0a:00:34:3F:20:1A,bus=pci.0 -uuid 1234c27c-e6e3-4e67-95da-8dd0a8891cc4 -rtc-td-hack -no-kvm-pit-reinjection -monitor stdio -name win08R2 -device virtio-balloon-pci,bus=pci.0  -qmp tcp:0:4444,server,nowait -vnc :1 -boot c

reproduce steps:

1.Check balloon info from qmp
{"execute":"query-balloon"}
{"return": {"actual": 4294967296, "mem_swapped_in": 0}}

2.Check top info
 PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND                                                                         
12795 root      20   0 4512m 4.0g 3044 S  5.9 52.9   0:58.00 qemu-kvm 

3.Check Performance tab in Task manager
Physical Memory(MB)
Total:4095
Cached:176
Available: 3576
Free:3404

4. Evict windows memory using qmp
{"execute":"balloon","arguments":{"value":2048000000}}
5.check balloon info twice
{"execute":"query-balloon"}
{"return": {"actual": 4263510016, "mem_swapped_in": 0}}
{"execute":"query-balloon"}
{"return": {"actual": 4261412864, "mem_swapped_in": 0}}

6.top info
 PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND                                                                         
12795 root      20   0 4512m 4.0g 3048 S  9.9 52.5   1:10.59 qemu-kvm 
7. Check Performance tab in Task manager
Physical Memory(MB)
Total:4095
Cached:190
Available: 3559
Free:3377

From above steps, we found there is no abvious difference on RES of top and Available item in Task manager after evict windows guest memory from "4294967296" to "2048000000".

You may compare test result of windows xp x86 from https://bugzilla.redhat.com/show_bug.cgi?id=582165#c8.

Comment 10 Shirley Zhou 2010-07-19 07:37:02 UTC
(In reply to comment #7)
> (In reply to comment #6)
> > "blnsvr.exe -i" to install the service
> > "blnsvr.exe -u" to uninstall the service    
> 
> Guest:windows 2008 R2
> 
> virtio-win-1.1.6-1:
> 
> {"execute":"query-balloon"}
> {"return": {"actual": 4294967296, "mem_swapped_in": 0, "minor_page_faults": 0,
> "mem_swapped_out": 0, "free_mem": 3688632320, "major_page_faults": 0,
> "total_mem": 4294545408}}
> {"execute":"balloon","arguments":{"value":3000000000}}
> {"return": {}}
> {"execute":"query-balloon"}
> {"return": {"actual": 4288675840, "mem_swapped_in": 0, "minor_page_faults": 0,
> "mem_swapped_out": 0, "free_mem": 3603152896, "major_page_faults": 0,
> "total_mem": 4294545408}}
> 
> virtio-win-1.1.7-1:
> {"execute":"query-balloon"}
> {"return": {"actual": 4294967296, "mem_swapped_in": 1959}}
> {"execute":"balloon","arguments":{"value":3000000000}}
> {"return": {}}
> {"execute":"query-balloon"}
> {"return": {"actual": 4282384384, "mem_swapped_in": 0}}
> {"execute":"query-balloon"}
> {"return": {"actual": 4280287232, "mem_swapped_in": 0}}    

Hi,Vadim
We can see the above two balloon drivers display info very different, info become shorter for virtio-win-1.1.7-1.
So is it by design or else?
Thanks,
Shirley

Comment 11 Vadim Rozenfeld 2010-07-19 07:46:27 UTC
Hi Shirley,
It must be the same. I will recheck it soon.
Regards,
Vadim.

Comment 12 Shirley Zhou 2010-07-19 08:37:19 UTC
For your info:

evict memory does not work on windows xp guest with driver virtio-win-1.1.8-0.

Comment 13 Shirley Zhou 2010-07-20 08:12:14 UTC
some additional info:
Memory reduce 2M on each query balloon, as following steps:

1.run win08 r2 guest, and install virtio balloon, install balloon service and reboot guest
/usr/libexec/qemu-kvm  -M rhel6.0.0 -enable-kvm -m 4096 ....  -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3
2.query balloon info
{"execute":"query-balloon"}
{"return": {"actual": 4294967296, "mem_swapped_in": 0}}
3.do evict memory 
{"execute":"balloon","arguments":{"value":2097152000}}
{"return": {}} 
4.query balloon info for 5 times
{"execute":"query-balloon"}
{"return": {"actual": 4286578688, "mem_swapped_in": 0}}
{"execute":"query-balloon"}
{"return": {"actual": 4284481536, "mem_swapped_in": 0}}
{"execute":"query-balloon"}
{"return": {"actual": 4282384384, "mem_swapped_in": 0}}
{"execute":"query-balloon"}
{"return": {"actual": 4280287232, "mem_swapped_in": 0}}
{"execute":"query-balloon"}
{"return": {"actual": 4278190080, "mem_swapped_in": 0}}
We can see memory reduce 2M on each query.
5. after 5 mins,query balloon info again
{"execute":"query-balloon"}
{"return": {"actual": 4276092928, "mem_swapped_in": 0}}
Memory reduce 2M again.
And we can see Available memory in guest change according to each query.

I run this win08r2 guest using virt-manager, install virtio balloon driver, install balloon service, and reboot guest, and then do memory evict using virsh, and I can see memory become value we set in about 10 secs.

Please refer to libvirt log for detail info.

Comment 14 Shirley Zhou 2010-07-20 08:20:14 UTC
Created attachment 433098 [details]
libvirt log

Comment 17 Shirley Zhou 2010-08-26 07:39:12 UTC
Virtio ballooning does not work at all on qemu-kvm-0.12.1.2-2.113.el6 as following:

(qemu) info balloon 
balloon: actual=4096
(qemu) balloon 2048 // do evict memory
(qemu) info balloon 
balloon: actual=4092
(qemu) info balloon 
balloon: actual=4092
(qemu) info balloon 
balloon: actual=4092
(qemu) info balloon 
balloon: actual=4092
(qemu) info balloon 
balloon: actual=4092 

This is no memory change during each query.

Comment 18 Vadim Rozenfeld 2010-09-09 19:43:59 UTC
Please check with the latest drivers from 
http://download.lab.bos.redhat.com/devel/RHEV/virtio-win/1.1.14-0/

Comment 19 Shirley Zhou 2010-09-13 05:44:00 UTC
Test this bug with driver in comment 18 as following steps:

1.start win2008 x64 guest with balloon option
2.install virtio balloon driver
3.reboot guest
4.install balloon server
5.do memory evict

(qemu) info balloon 
balloon: actual=4096
(qemu) balloon 2048
(qemu) info balloon 
balloon: actual=4040
(qemu) info balloon 
balloon: actual=4036
(qemu) info balloon 
balloon: actual=4036
(qemu) info balloon 
balloon: actual=4036

from above message, balloon does not work. so reassign this bug.

Comment 21 Vadim Rozenfeld 2010-09-16 19:49:44 UTC
Please check with the latest drivers from 
http://download.lab.bos.redhat.com/devel/RHEV/virtio-win/1.1.15/

Comment 27 errata-xmlrpc 2011-05-19 14:31:16 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/RHBA-2011-0782.html