Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 2075569

Summary: Allow memory prealloc from multiple threads [rhel-8.6.0.z]
Product: Red Hat Enterprise Linux 8 Reporter: RHEL Program Management Team <pgm-rhel-tools>
Component: libvirtAssignee: Michal Privoznik <mprivozn>
Status: CLOSED ERRATA QA Contact: liang cong <lcong>
Severity: high Docs Contact: Jiri Herrmann <jherrman>
Priority: medium    
Version: 8.6CC: jdenemar, jherrman, jmario, jsuchane, lmen, mprivozn, mtessun, toneata, virt-maint, xuzhang, yafu, yalzhang, ymankad, yuhuang
Target Milestone: rcKeywords: AutomationBackLog, FutureFeature, Triaged, Upstream, ZStream
Target Release: ---Flags: pm-rhel: mirror+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: libvirt-8.0.0-5.1.el8 Doc Type: Enhancement
Doc Text:
.VM memory preallocation using multiple threads You can now define multiple CPU threads for virtual machine (VM) memory allocation in the domain XML configuration, for example as follows: <memoryBacking> <allocation threads='8'/> </memoryBacking> This ensures that more than one thread is used for loading memory pages when starting a VM. As a consequence, VMs with multiple allocation threads configured start significantly faster, especially if the VMs has large amounts of RAM assigned and backed by hugepages.
Story Points: ---
Clone Of: 2067126 Environment:
Last Closed: 2022-08-02 10:01:20 UTC Type: Feature Request
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: 2067126    
Bug Blocks:    

Comment 2 liang cong 2022-04-20 07:37:46 UTC
Preverified with scratch build on rhel8.6:
libvirt-8.0.0-6.el8_rc.5b05e15dc0.x86_64
qemu-kvm-6.2.0-11.module+el8.6.0+14707+5aa4b42d.x86_64

Test steps:
1. Setup host hugepages
sysctl vm.nr_hugepages=1024

2. Define domain xml with memorybacking with below:
  <memoryBacking>
    <hugepages>
      <page size='2048' unit='KiB'/>
    </hugepages>
    <allocation threads='8'/>
  </memoryBacking>



3. Start the guest vm

4. Check the guest vm can boot up and works well.

5. Check the qemu cmdline, that multithread pass through libvirt layer to qemu:
-object {"qom-type":"memory-backend-file","id":"pc.ram","mem-path":"/dev/hugepages/libvirt/qemu/2-vm1","x-use-canonical-path-for-ramblock-id":false,"prealloc":true,"prealloc-threads":8,"size":2147483648}

6. Also check the other scenarios, and did not find issue:
6.1 no huge page
6.2 no multi-thread setting
6.3 working with memfd,anonymous,file source
6.4 working with immdiate, ondemand mode
6.5 negative thread setting with minus, zero, not number, too big number
6.6 working with big thread number
6.7 virsh define --validate

Comment 3 liang cong 2022-05-12 06:08:59 UTC
Verified with:
libvirt-8.0.0-5.1.module+el8.6.0+15027+c62943ab.x86_64
qemu-kvm-6.2.0-11.module+el8.6.0+14707+5aa4b42d.x86_64

Test steps:
1. Setup host hugepages
sysctl vm.nr_hugepages=1024

2. Define domain xml with memorybacking with below:
  <memoryBacking>
    <hugepages/>
    <allocation threads='8'/>
  </memoryBacking>



3. Start the guest vm

4. Check the guest vm can boot up and works well.

5. Check the qemu cmdline, that multithread pass through libvirt layer to qemu:
-object {"qom-type":"memory-backend-file","id":"pc.ram","mem-path":"/dev/hugepages/libvirt/qemu/18-vm1","x-use-canonical-path-for-ramblock-id":false,"prealloc":true,"prealloc-threads":8,"size":2147483648}

6. Also check the other scenarios, and did not find issue:
6.1 no huge page
6.2 no multi-thread setting
6.3 working with memfd,anonymous,file source
6.4 working with immdiate, ondemand mode
6.5 negative thread setting with minus, zero, not number, too big number
6.6 working with big thread number
6.7 virsh define --validate
6.8 working with dimm memory devices

Comment 7 liang cong 2022-05-12 08:30:06 UTC
per comment3, mark it verified

Comment 16 errata-xmlrpc 2022-08-02 10:01:20 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 (Moderate: virt:rhel and virt-devel:rhel security, 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/RHSA-2022:5821