Bug 1598780

Summary: memballoon will not work when enable iommu
Product: Red Hat Enterprise Linux Advanced Virtualization Reporter: yalzhang <yalzhang>
Component: libvirtAssignee: Virtualization Maintenance <virt-maint>
Status: CLOSED DEFERRED QA Contact: Jing Qi <jinqi>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 8.0CC: dyuan, jinqi, lhuang, lmen, rbalakri, xuzhang
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-02-18 14:23:08 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 yalzhang@redhat.com 2018-07-06 12:45:25 UTC
Description of problem:
memballoon will not work when enable iommu

Version-Release number of selected component (if applicable):
libvirt-4.5.0-1.el7.x86_64
qemu-kvm-rhev-2.12.0-7.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
1. prepare host support VT-d, add "intel_iommu=on" to kernel line

2. Prepare a q35 guest and add the xml as below in the guest 
....
 <memory unit='KiB'>2097152</memory>
  <currentMemory unit='KiB'>2097152</currentMemory>
.....
  <features>
   <ioapic driver='qemu'/>
...
 </features>
 ...
  <iommu model='intel'>
     <driver intremap='on' iotlb='on'/>
  </iommu>
 <memballoon model='virtio'>
      <address type='pci' domain='0x0000' bus='0x06' slot='0x00' function='0x0'/>
      <driver iommu='on' ats='on'/>
    </memballoon>
...

3. Add "intel_iommu=on" to kernel line of q35  guest, then reboot the guest

4. check on guest for current memory size
[on guest] # cat /proc/meminfo | grep MemTotal
MemTotal:        1863840 kB

5. change the memory on host, then check, it do not work
[on host] # virsh setmem rhelq 1048576

[on host] # virsh dumpxml rhelq | grep -i mem
  <memory unit='KiB'>2097152</memory>
  <currentMemory unit='KiB'>2097152</currentMemory>

6. check on guest, there is no change
[on guest] # cat /proc/meminfo | grep MemTotal
MemTotal:        1863840 kB

Actual results:
in step 5, 6, after setmem, the guest memory do not change

Expected results:
guest memory should be set correctly

Additional info:
destroy the guest, edit the xml to delete the "<driver iommu='on' ats='on'/>", start the guest and redo all the steps.
1. check before the test
[on guest]#  cat /proc/meminfo | grep MemTotal
MemTotal:        1863840 kB
[on host] # virsh dumpxml rhelq | grep -i mem
  <memory unit='KiB'>2097152</memory>
  <currentMemory unit='KiB'>2097152</currentMemory>

2. change the memory size for guest, then check it works
[on host] #  virsh setmem rhelq 1048576
[on host] # virsh dumpxml rhelq | grep -i Mem
  <memory unit='KiB'>2097152</memory>
  <currentMemory unit='KiB'>1048576</currentMemory>

3. check on guest, it works
[on guest] #  cat /proc/meminfo | grep MemTotal
MemTotal:         815264 kB

Comment 2 Jaroslav Suchanek 2020-02-18 14:23:08 UTC
This bug was closed deferred as a result of bug triage.

Please reopen if you disagree and provide justification why this bug should
get enough priority. Most important would be information about impact on
customer or layered product. Please indicate requested target release.