Bug 2067126 - Allow memory prealloc from multiple threads
Summary: Allow memory prealloc from multiple threads
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: libvirt
Version: 8.6
Hardware: Unspecified
OS: Unspecified
medium
high
Target Milestone: rc
: ---
Assignee: Michal Privoznik
QA Contact: liang cong
Jiri Herrmann
URL:
Whiteboard:
Depends On: 2064194
Blocks: 2075569
TreeView+ depends on / blocked
 
Reported: 2022-03-23 11:21 UTC by Nils Koenig
Modified: 2022-11-08 15:38 UTC (History)
14 users (show)

Fixed In Version: libvirt-8.0.0-6.module+el8.7.0+15026+c30823f5
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 allocating memory pages when starting a VM. As a result, VMs with multiple allocation threads configured start significantly faster, especially if the VMs has large amounts of RAM assigned and backed by hugepages.
Clone Of:
: 2075569 (view as bug list)
Environment:
Last Closed: 2022-11-08 09:19:55 UTC
Type: Feature Request
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker LIBVIRTAT-12934 0 None None None 2022-07-15 08:05:17 UTC
Red Hat Issue Tracker RHELPLAN-116473 0 None None None 2022-03-23 11:28:19 UTC
Red Hat Product Errata RHSA-2022:7472 0 None None None 2022-11-08 09:20:49 UTC

Comment 7 Michal Privoznik 2022-04-04 12:35:35 UTC
I've just merged patches upstream:

b8d6ecc70c (origin/master, origin/HEAD, prealloc_threads, master) qemu_command: Generate prealloc-threads property
75a4e0165e qemu_validate: Validate prealloc threads against qemuCpas
a30dac15dc qemu_capabilities: Detect memory-backend-*.prealloc-threads property
ba7f98126f conf: Introduce memory allocation threads

v8.1.0-212-gb8d6ecc70c

Comment 12 liang cong 2022-04-21 09:21:39 UTC
Preverified with scratch build on rhel8.7:
libvirt-8.0.0-6.el8_rc.af6ccc6655.x86_64
qemu-kvm-6.2.0-9.module+el8.7.0+14737+6552dcb8.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/3-vm1","x-use-canonical-path-for-ramblock-id":false,"prealloc":true,"prealloc-threads":8,"size":2147483648}

6. Also checked 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, null
6.6 working with big thread number
6.7 virsh define --validate

Comment 15 liang cong 2022-04-29 09:46:26 UTC
verified with:
libvirt-8.0.0-6.module+el8.7.0+15026+c30823f5.x86_64
qemu-kvm-6.2.0-9.module+el8.7.0+14737+6552dcb8.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='4'/>
  </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/17-vm1","x-use-canonical-path-for-ramblock-id":false,"prealloc":true,"prealloc-threads":4,"size":2147483648}

6. Also checked 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, null
6.6 working with big thread number
6.7 virsh define --validate

Comment 19 errata-xmlrpc 2022-11-08 09:19:55 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 (Low: 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:7472


Note You need to log in before you can comment on or make changes to this bug.