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 2185039 - [numatune][cputune] qemu-kvm: Setting CPU affinity failed: Invalid argument [rhel-9.2.0.z]
Summary: [numatune][cputune] qemu-kvm: Setting CPU affinity failed: Invalid argument [...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 9
Classification: Red Hat
Component: libvirt
Version: 9.2
Hardware: x86_64
OS: Linux
high
high
Target Milestone: rc
: ---
Assignee: Michal Privoznik
QA Contact: Luyao Huang
URL:
Whiteboard:
Depends On: 2154750
Blocks:
TreeView+ depends on / blocked
 
Reported: 2023-04-06 15:10 UTC by RHEL Program Management Team
Modified: 2023-07-26 08:40 UTC (History)
23 users (show)

Fixed In Version: libvirt-9.0.0-10.1.el9_2
Doc Type: Bug Fix
Doc Text:
When starting a misconfigured guest (such that the emulator thread is pinned onto NUMA node(s) distinct to NUMA node(s) of guest memory) AND using allocation threads (/domain/memoryBacking/allocation/@threads), the guest refuses to start with an error. This is because those allocation threads have their affinity set to those NUMA nodes of the guest memory, but are created from the context of the emulator thread (which itself is already restricted to given NUMA nodes). These patches prune inaccessible NUMA nodes by computing an intersection between two sets of NUMA nodes and setting affinity to only the intersecting ones. This allows guest to start again.
Clone Of: 2154750
Environment:
Last Closed: 2023-05-09 11:04:43 UTC
Type: ---
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker LIBVIRTAT-14221 0 None None None 2023-05-22 13:02:45 UTC
Red Hat Issue Tracker RHELPLAN-154190 0 None None None 2023-04-06 15:13:05 UTC
Red Hat Product Errata RHBA-2023:2632 0 None None None 2023-05-09 11:04:48 UTC

Comment 6 Luyao Huang 2023-04-18 08:09:34 UTC
Verify this bug on libvirt-9.0.0-10.1.el9_2.x86_64:

S1: bind emulatorpin to node0 cpus and memory to node1 with numatune + emulatorpin + hugepages

1. 

# lscpu
...
NUMA:                    
  NUMA node(s):          2
  NUMA node0 CPU(s):     0-15,32-47
  NUMA node1 CPU(s):     16-31,48-63
...

2. set guest emulatorpin to use node0 CPUs and numatune to node1:

# virsh dumpxml vm1

  <memoryBacking>
    <hugepages>
      <page size='2048' unit='KiB'/>
    </hugepages>
  </memoryBacking>
  <vcpu placement='static'>2</vcpu>
  <cputune>
    <emulatorpin cpuset='0-15'/>
  </cputune>
  <numatune>
    <memory mode='strict' nodeset='1'/>
    <memnode cellid='0' mode='strict' nodeset='1'/>
    <memnode cellid='1' mode='strict' nodeset='1'/>
  </numatune>
...
    <memory model='dimm'>
      <source>
        <pagesize unit='KiB'>2048</pagesize>
      </source>
      <target>
        <size unit='KiB'>524288</size>
        <node>1</node>
      </target>
      <address type='dimm' slot='0'/>
    </memory>

3. start guest
# virsh start vm1
Domain 'vm1' started

4. check qemu command line and verify that libvirt didn't use thread-context

-object {"qom-type":"memory-backend-file","id":"ram-node0","mem-path":"/dev/hugepages/libvirt/qemu/1-vm1","prealloc":true,"size":1073741824,"host-nodes":[1],"policy":"bind"} -numa node,nodeid=0,cpus=0,memdev=ram-node0 -object {"qom-type":"memory-backend-file","id":"ram-node1","mem-path":"/dev/hugepages/libvirt/qemu/1-vm1","prealloc":true,"size":1073741824,"host-nodes":[1],"policy":"bind"} -numa node,nodeid=1,cpus=1,memdev=ram-node1... -object {"qom-type":"memory-backend-file","id":"memdimm0","mem-path":"/dev/hugepages/libvirt/qemu/1-vm1","prealloc":true,"size":536870912,"host-nodes":[1],"policy":"bind"} -device {"driver":"pc-dimm","node":1,"memdev":"memdimm0","id":"dimm0","slot":0}

5. attach a new memory device:

# cat mem.xml 
    <memory model='dimm'>
      <source>
        <pagesize unit='KiB'>2048</pagesize>
      </source>
      <target>
        <size unit='KiB'>524288</size>
        <node>0</node>
      </target>
    </memory>

# virsh attach-device vm1 mem.xml 
Device attached successfully


S2: bind emulatorpin to node0 cpus and memory to node1 with numatune + emulatorpin

1. set guest emulatorpin to use node0 CPUs and numatune to node1:

  <cputune>
    <emulatorpin cpuset='0-15'/>
  </cputune>
  <numatune>
    <memory mode='strict' nodeset='1'/>
    <memnode cellid='0' mode='strict' nodeset='1'/>
    <memnode cellid='1' mode='strict' nodeset='1'/>
  </numatune>
...
    <memory model='dimm'>
      <source>
        <pagesize unit='KiB'>2048</pagesize>
      </source>
      <target>
        <size unit='KiB'>524288</size>
        <node>1</node>
      </target>
      <address type='dimm' slot='0'/>
    </memory>

2. start guest
# virsh start vm1
Domain 'vm1' started

3. check qemu command line and verify that libvirt didn't use thread-context

# ps aux|grep qemu

-object {"qom-type":"memory-backend-ram","id":"ram-node0","size":1073741824,"host-nodes":[1],"policy":"bind"} -numa node,nodeid=0,cpus=0,memdev=ram-node0 -object {"qom-type":"memory-backend-ram","id":"ram-node1","size":1073741824,"host-nodes":[1],"policy":"bind"} -numa node,nodeid=1,cpus=1,memdev=ram-node1...-object {"qom-type":"memory-backend-file","id":"memdimm0","mem-path":"/dev/hugepages/libvirt/qemu/3-vm1","prealloc":true,"size":536870912,"host-nodes":[1],"policy":"bind"} -device {"driver":"pc-dimm","node":1,"memdev":"memdimm0","id":"dimm0","slot":0}

4. 

# cat mem.xml 
    <memory model='dimm'>
      <source>
        <pagesize unit='KiB'>2048</pagesize>
      </source>
      <target>
        <size unit='KiB'>524288</size>
        <node>0</node>
      </target>
    </memory>

# virsh attach-device vm1 mem.xml 
Device attached successfully


S3: bind emulatorpin to node0 cpus and memory to node0-1 with numatune + emulatorpin + hugepages

1. guest xml like this:
  <memoryBacking>
    <hugepages>
      <page size='2048' unit='KiB'/>
    </hugepages>
  </memoryBacking>
  <vcpu placement='static'>2</vcpu>
  <cputune>
    <emulatorpin cpuset='0-15'/>
  </cputune>
  <numatune>
    <memory mode='strict' nodeset='0-1'/>
    <memnode cellid='0' mode='strict' nodeset='0-1'/>
    <memnode cellid='1' mode='strict' nodeset='1'/>
  </numatune>
...
    <memory model='dimm'>
      <source>
        <pagesize unit='KiB'>2048</pagesize>
      </source>
      <target>
        <size unit='KiB'>524288</size>
        <node>0</node>
      </target>
      <address type='dimm' slot='0'/>
    </memory>

2. start guest
# virsh start vm1
Domain 'vm1' started

3. check qemu command line and verify that libvirt use thread-context and "node-affinity" is node 0:

# ps aux|grep qemu
-object {"qom-type":"thread-context","id":"tc-ram-node0","node-affinity":[0]} -object {"qom-type":"memory-backend-file","id":"ram-node0","mem-path":"/dev/hugepages/libvirt/qemu/5-vm1","prealloc":true,"size":1073741824,"host-nodes":[0,1],"policy":"bind","prealloc-context":"tc-ram-node0"} -numa node,nodeid=0,cpus=0,memdev=ram-node0 -object {"qom-type":"memory-backend-file","id":"ram-node1","mem-path":"/dev/hugepages/libvirt/qemu/5-vm1","prealloc":true,"size":1073741824,"host-nodes":[1],"policy":"bind"} -numa node,nodeid=1,cpus=1,memdev=ram-node1...-object {"qom-type":"thread-context","id":"tc-memdimm0","node-affinity":[0]} -object {"qom-type":"memory-backend-file","id":"memdimm0","mem-path":"/dev/hugepages/libvirt/qemu/5-vm1","prealloc":true,"size":536870912,"host-nodes":[0,1],"policy":"bind","prealloc-context":"tc-memdimm0"} -device {"driver":"pc-dimm","node":0,"memdev":"memdimm0","id":"dimm0","slot":0}

4. 
# cat mem.xml 
    <memory model='dimm'>
      <source>
        <pagesize unit='KiB'>2048</pagesize>
      </source>
      <target>
        <size unit='KiB'>524288</size>
        <node>0</node>
      </target>
    </memory>

# virsh attach-device vm1 mem.xml 
Device attached successfully

S4: bind emulatorpin to node0 cpus and memory to node0-1 with numatune + emulatorpin

1. guest xml like this:

  <cputune>
    <emulatorpin cpuset='0-15'/>
  </cputune>
  <numatune>
    <memory mode='strict' nodeset='0-1'/>
    <memnode cellid='0' mode='strict' nodeset='0-1'/>
    <memnode cellid='1' mode='strict' nodeset='1'/>
  </numatune>
...
    <memory model='dimm'>
      <source>
        <pagesize unit='KiB'>2048</pagesize>
      </source>
      <target>
        <size unit='KiB'>524288</size>
        <node>0</node>
      </target>
      <address type='dimm' slot='0'/>
    </memory>

2. start guest
# virsh start vm1
Domain 'vm1' started

3. check qemu command line and verify that libvirt use thread-context and "node-affinity" is node 0:

# ps aux|grep qemu
-object {"qom-type":"memory-backend-ram","id":"ram-node0","size":1073741824,"host-nodes":[0,1],"policy":"bind"} -numa node,nodeid=0,cpus=0,memdev=ram-node0 -object {"qom-type":"memory-backend-ram","id":"ram-node1","size":1073741824,"host-nodes":[1],"policy":"bind"} -numa node,nodeid=1,cpus=1,memdev=ram-node1...-object {"qom-type":"memory-backend-file","id":"memdimm0","mem-path":"/dev/hugepages/libvirt/qemu/9-vm1","prealloc":true,"size":536870912,"host-nodes":[0,1],"policy":"bind","prealloc-context":"tc-memdimm0"} -device {"driver":"pc-dimm","node":0,"memdev":"memdimm0","id":"dimm0","slot":0}

4. 
# cat mem.xml 
    <memory model='dimm'>
      <source>
        <pagesize unit='KiB'>2048</pagesize>
      </source>
      <target>
        <size unit='KiB'>524288</size>
        <node>0</node>
      </target>
    </memory>

# virsh attach-device vm1 mem.xml 
Device attached successfully


S5: bind emulatorpin to node0-1 cpus and memory to node1 with numatune + emulatorpin + hugepages

1. guest xml like this:
  <memoryBacking>
    <hugepages>
      <page size='2048' unit='KiB'/>
    </hugepages>
  </memoryBacking>
  <vcpu placement='static'>2</vcpu>
  <cputune>
    <emulatorpin cpuset='0-31'/>
  </cputune>
  <numatune>
    <memory mode='strict' nodeset='1'/>
    <memnode cellid='0' mode='strict' nodeset='1'/>
    <memnode cellid='1' mode='strict' nodeset='1'/>
  </numatune>
...
    <memory model='dimm'>
      <source>
        <pagesize unit='KiB'>2048</pagesize>
      </source>
      <target>
        <size unit='KiB'>524288</size>
        <node>0</node>
      </target>
      <address type='dimm' slot='0'/>
    </memory>

2. start guest
# virsh start vm1
Domain 'vm1' started

3. check qemu command line and verify that libvirt use thread-context and "node-affinity" is node 1:

# ps aux|grep qemu
-object {"qom-type":"thread-context","id":"tc-ram-node0","node-affinity":[1]} -object {"qom-type":"memory-backend-file","id":"ram-node0","mem-path":"/dev/hugepages/libvirt/qemu/10-vm1","prealloc":true,"size":1073741824,"host-nodes":[1],"policy":"bind","prealloc-context":"tc-ram-node0"} -numa node,nodeid=0,cpus=0,memdev=ram-node0 -object {"qom-type":"thread-context","id":"tc-ram-node1","node-affinity":[1]} -object {"qom-type":"memory-backend-file","id":"ram-node1","mem-path":"/dev/hugepages/libvirt/qemu/10-vm1","prealloc":true,"size":1073741824,"host-nodes":[1],"policy":"bind","prealloc-context":"tc-ram-node1"} -numa node,nodeid=1,cpus=1,memdev=ram-node1

4. 
# cat mem.xml 
    <memory model='dimm'>
      <source>
        <pagesize unit='KiB'>2048</pagesize>
      </source>
      <target>
        <size unit='KiB'>524288</size>
        <node>0</node>
      </target>
    </memory>

# virsh attach-device vm1 mem.xml 
Device attached successfully


S6: bind emulatorpin to node0-1 cpus and memory to node1 with numatune + emulatorpin

1. guest xml like this:

  <cputune>
    <emulatorpin cpuset='0-31'/>
  </cputune>
  <numatune>
    <memory mode='strict' nodeset='1'/>
    <memnode cellid='0' mode='strict' nodeset='1'/>
    <memnode cellid='1' mode='strict' nodeset='1'/>
  </numatune>
...
    <memory model='dimm'>
      <source>
        <pagesize unit='KiB'>2048</pagesize>
      </source>
      <target>
        <size unit='KiB'>524288</size>
        <node>0</node>
      </target>
      <address type='dimm' slot='0'/>
    </memory>

2. start guest
# virsh start vm1
Domain 'vm1' started

3. check qemu command line and verify that libvirt use thread-context and "node-affinity" is node 1:

# ps aux|grep qemu
-object {"qom-type":"memory-backend-ram","id":"ram-node0","size":1073741824,"host-nodes":[1],"policy":"bind"} -numa node,nodeid=0,cpus=0,memdev=ram-node0 -object {"qom-type":"memory-backend-ram","id":"ram-node1","size":1073741824,"host-nodes":[1],"policy":"bind"} -numa node,nodeid=1,cpus=1,memdev=ram-node1...-object {"qom-type":"thread-context","id":"tc-memdimm0","node-affinity":[1]} -object {"qom-type":"memory-backend-file","id":"memdimm0","mem-path":"/dev/hugepages/libvirt/qemu/11-vm1","prealloc":true,"size":536870912,"host-nodes":[1],"policy":"bind","prealloc-context":"tc-memdimm0"} -device {"driver":"pc-dimm","node":0,"memdev":"memdimm0","id":"dimm0","slot":0}

4. 
# cat mem.xml 
    <memory model='dimm'>
      <source>
        <pagesize unit='KiB'>2048</pagesize>
      </source>
      <target>
        <size unit='KiB'>524288</size>
        <node>0</node>
      </target>
    </memory>

# virsh attach-device vm1 mem.xml 
Device attached successfully


Triggered numa, cpu and memory auto test jobs to test libvirt-9.0.0-10.1.el9_2.x86_64 and there is no failed cases.

Comment 10 errata-xmlrpc 2023-05-09 11:04:43 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 (libvirt bug fix 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-2023:2632


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