Description of problem: virsh capabilities can't display the real-time number for hugepages Version-Release number of selected component (if applicable): libvirt-daemon-6.0.0-5.virtcov.el8.x86_64 qemu-kvm-common-4.2.0-10.module+el8.2.0+5740+c3dff59e.x86_64 How reproducible: Always Steps to Reproduce: 1.# virsh capabilities |grep 2048 <pages unit='KiB' size='2048'/> <pages unit='KiB' size='2048'>0</pages> 2.# virsh allocpages 2048 3 3. #virsh freepages --all Node 0: 4KiB: 3988186 2048KiB: 3 1048576KiB: 0 # virsh capabilities |grep 2048 <pages unit='KiB' size='2048'/> <pages unit='KiB' size='2048'>0</pages> Actual results: Virsh capabilities can't display the real-time number for the hugepages Expected results: Virsh capabilities can display the real-time number for the hugepages Additional info: The number can be displayed with libvirtd restarted. # systemctl restart libvirtd # virsh capabilities |grep 2048 <pages unit='KiB' size='2048'/> <pages unit='KiB' size='2048'>3</pages> The issue is not exist in rhel8.0.1: libvirt-daemon-5.0.0-12.module+el8.0.1+3755+6782b0ed.x86_64 qemu-kvm-3.1.0-30.module+el8.0.1+4607+7ea9baa9.2.x86_64
I think this is the regression caused by us caching host side capabilities (e.g. NUMA) since v6.0.0-rc1~439 and friends. Let me see if I can fix it.
Patch proposed upstream: https://www.redhat.com/archives/libvir-list/2020-December/msg00023.html
v2: https://www.redhat.com/archives/libvir-list/2020-December/msg00086.html
Merged upstream: 40a162f83e qemu: Don't cache NUMA caps v6.10.0-114-g40a162f83e
Verified with libvirt upstream version : v6.10.0-206-gbff2ad5d6b S1: steps: 1. Check the number of pages of size='2048'. # virsh capbilities Part of output is as following- <topology> <cells num='1'> <cell id='0'> <memory unit='KiB'>3832548</memory> <pages unit='KiB' size='4'>958137</pages> <pages unit='KiB' size='2048'>0</pages> <pages unit='KiB' size='1048576'>0</pages> <distances> <sibling id='0' value='10'/> </distances> <cpus num='2'> <cpu id='0' socket_id='0' die_id='0' core_id='0' siblings='0'/> <cpu id='1' socket_id='1' die_id='0' core_id='0' siblings='1'/> </cpus> </cell> </cells> </topology> 2. echo 200 > /sys/kernel/mm/hugepages/hugepages-2048kB/nr_hugepages 3. Check the number of pages of size='2048' again. # virsh capbilities The number of pages of size='2048' changed to "200". <topology> <cells num='1'> <cell id='0'> <memory unit='KiB'>3832548</memory> <pages unit='KiB' size='4'>855737</pages> <pages unit='KiB' size='2048'>200</pages> <pages unit='KiB' size='1048576'>0</pages> <distances> <sibling id='0' value='10'/> </distances> <cpus num='2'> <cpu id='0' socket_id='0' die_id='0' core_id='0' siblings='0'/> <cpu id='1' socket_id='1' die_id='0' core_id='0' siblings='1'/> </cpus> </cell> </cells> </topology> 4. # virsh freepages --all Node 0: 4KiB: 51359 2048KiB: 200 1048576KiB: 0
Verified with version: libvirt-daemon-7.0.0-1.module+el8.4.0+9464+3e71831a.x86_64 qemu-kvm-5.2.0-2.module+el8.4.0+9186+ec44380f.x86_64 S1. Check the pages number in the output of "virsh capabilities" can be changed at once steps: 1. Check the number of pages of size='2048'. # virsh capbilities Part of output is as following- <topology> <cells num='1'> <cell id='0'> <memory unit='KiB'>3832548</memory> <pages unit='KiB' size='4'>958137</pages> <pages unit='KiB' size='2048'>0</pages> <pages unit='KiB' size='1048576'>0</pages> <distances> <sibling id='0' value='10'/> </distances> <cpus num='2'> <cpu id='0' socket_id='0' die_id='0' core_id='0' siblings='0'/> <cpu id='1' socket_id='1' die_id='0' core_id='0' siblings='1'/> </cpus> </cell> </cells> </topology> 2. echo 200 > /sys/kernel/mm/hugepages/hugepages-2048kB/nr_hugepages 3. Check the number of pages of size='2048' again. # virsh capbilities The number of pages of size='2048' changed to "200". <topology> <cells num='1'> <cell id='0'> <memory unit='KiB'>3832548</memory> <pages unit='KiB' size='4'>855737</pages> <pages unit='KiB' size='2048'>200</pages> <pages unit='KiB' size='1048576'>0</pages> <distances> <sibling id='0' value='10'/> </distances> <cpus num='2'> <cpu id='0' socket_id='0' die_id='0' core_id='0' siblings='0'/> <cpu id='1' socket_id='1' die_id='0' core_id='0' siblings='1'/> </cpus> </cell> </cells> </topology> 4. # virsh freepages --all Node 0: 4KiB: 51359 2048KiB: 200 1048576KiB: 0
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 (virt:av bug fix and enhancement update), and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHBA-2021:2098