Bug 2157060

Summary: 100g ice card: the guest start failed with Setting CPU affinity failed: Invalid argument when running sriov dpdk pvp case on rhel9.2
Product: Red Hat Enterprise Linux 9 Reporter: liting <tli>
Component: libvirtAssignee: Virtualization Maintenance <virt-maint>
libvirt sub component: General QA Contact: yalzhang <yalzhang>
Status: CLOSED DUPLICATE Docs Contact:
Severity: unspecified    
Priority: unspecified CC: hewang, lhuang, lmen, virt-maint, yalzhang
Version: 9.2   
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: 2023-01-06 06:10:45 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 liting 2022-12-30 11:28:27 UTC
Description of problem:
100g ice card: the guest start failed with Setting CPU affinity failed: Invalid argument when running sriov dpdk pvp case on rhel9.2

Version-Release number of selected component (if applicable):
[root@wsfd-advnetlab153 ~]# uname -r
5.14.0-226.el9.x86_64
[root@wsfd-advnetlab153 perf]# rpm -qa|grep libvi
libvirt-libs-8.10.0-2.el9.x86_64
libvirt-client-8.10.0-2.el9.x86_64
libvirt-daemon-8.10.0-2.el9.x86_64
libvirt-daemon-driver-qemu-8.10.0-2.el9.x86_64
libvirt-daemon-driver-secret-8.10.0-2.el9.x86_64
libvirt-daemon-driver-storage-core-8.10.0-2.el9.x86_64
libvirt-daemon-driver-network-8.10.0-2.el9.x86_64
libvirt-daemon-config-network-8.10.0-2.el9.x86_64
libvirt-daemon-driver-nwfilter-8.10.0-2.el9.x86_64
libvirt-daemon-config-nwfilter-8.10.0-2.el9.x86_64
libvirt-daemon-driver-storage-iscsi-8.10.0-2.el9.x86_64
libvirt-daemon-driver-nodedev-8.10.0-2.el9.x86_64
libvirt-daemon-driver-storage-scsi-8.10.0-2.el9.x86_64
libvirt-daemon-driver-storage-mpath-8.10.0-2.el9.x86_64
libvirt-daemon-driver-storage-logical-8.10.0-2.el9.x86_64
libvirt-daemon-driver-storage-disk-8.10.0-2.el9.x86_64
libvirt-daemon-driver-interface-8.10.0-2.el9.x86_64
libvirt-daemon-driver-storage-rbd-8.10.0-2.el9.x86_64
libvirt-daemon-driver-storage-8.10.0-2.el9.x86_64
libvirt-8.10.0-2.el9.x86_64
python3-libvirt-8.10.0-1.el9.x86_64

How reproducible:


Steps to Reproduce:
1. create one vf for 2 pfs
2. bind the vf to dpdk vfio-pci driver
3. start guest with following xml
<domain type='kvm'>
  <name>g1</name>
  <memory unit='KiB'>8388608</memory>
  <currentMemory unit='KiB'>8388608</currentMemory>
  <memoryBacking>
    <hugepages>
      <page size='1048576' unit='KiB'/>
    </hugepages>
    <locked/>
    <access mode='shared'/>
  </memoryBacking>
  <vcpu placement='static'>3</vcpu>
  <cputune>
    <vcpupin vcpu='0' cpuset='5'/>
    <vcpupin vcpu='1' cpuset='59'/>
    <vcpupin vcpu='2' cpuset='3'/>
    <emulatorpin cpuset='1,57'/>
  </cputune>
  <numatune>
    <memory mode='strict' nodeset='0'/>
  </numatune>
  <resource>
    <partition>/machine</partition>
  </resource>
  <os>
    <type arch='x86_64' machine='q35'>hvm</type>
    <boot dev='hd'/>
  </os>
  <features>
    <acpi/>
    <apic/>
    <pmu state='off'/>
    <vmport state='off'/>
    <ioapic driver='qemu'/>
  </features>
  <cpu mode='host-passthrough' check='none'>
    <feature policy='require' name='tsc-deadline'/>
    <numa>
      <cell id='0' cpus='0-2' memory='8388608' unit='KiB' memAccess='shared'/>
    </numa>
  </cpu>
  <clock offset='utc'>
    <timer name='rtc' tickpolicy='catchup'/>
    <timer name='pit' tickpolicy='delay'/>
    <timer name='hpet' present='no'/>
  </clock>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>restart</on_crash>
  <pm>
    <suspend-to-mem enabled='no'/>
    <suspend-to-disk enabled='no'/>
  </pm>
  <devices>
    <emulator>/usr/libexec/qemu-kvm</emulator>
    <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source file='/var/lib/libvirt/images/g1.qcow2'/>
      <backingStore/>
      <target dev='vda' bus='virtio'/>
      <alias name='virtio-disk0'/>
      <address type='pci' domain='0x0000' bus='0x01' slot='0x00' function='0x0'/>
    </disk>
    <controller type='usb' index='0' model='none'>
      <alias name='usb'/>
    </controller>
    <controller type='pci' index='0' model='pcie-root'>
      <alias name='pcie.0'/>
    </controller>
    <controller type='pci' index='1' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='1' port='0x10'/>
      <alias name='pci.1'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
    </controller>
    <controller type='pci' index='2' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='2' port='0x11'/>
      <alias name='pci.2'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </controller>
    <controller type='pci' index='3' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='3' port='0x8'/>
      <alias name='pci.3'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
    </controller>
    <controller type='pci' index='4' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='4' port='0x9'/>
      <alias name='pci.4'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
    </controller>
    <controller type='pci' index='5' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='5' port='0xa'/>
      <alias name='pci.5'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
    </controller>
    <controller type='pci' index='6' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='6' port='0xb'/>
      <alias name='pci.6'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
    </controller>
    <controller type='sata' index='0'>
      <alias name='ide'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x1f' function='0x2'/>
    </controller>
    <interface type='bridge'>
      <mac address='52:54:00:01:02:03'/>
      <source bridge='virbr0'/>
      <model type='virtio'/>
    </interface>
<hostdev mode='subsystem' type='pci' managed='yes'>
  <source>
    <address type='pci' domain='0x0000' bus='0xca' slot='0x01' function='0x0'/>
  </source>
  <mac address='00:de:ad:01:01:01'/>
</hostdev>
<hostdev mode='subsystem' type='pci' managed='yes'>
  <source>
    <address type='pci' domain='0x0000' bus='0xcd' slot='0x01' function='0x0'/>
  </source>
  <mac address='00:de:ad:02:02:02'/>
</hostdev>
    <serial type='pty'>
      <source path='/dev/pts/1'/>
      <target type='isa-serial' port='0'>
        <model name='isa-serial'/>
      </target>
      <alias name='serial0'/>
    </serial>
    <console type='pty' tty='/dev/pts/1'>
      <source path='/dev/pts/1'/>
      <target type='serial' port='0'/>
      <alias name='serial0'/>
    </console>
    <input type='mouse' bus='ps2'>
      <alias name='input0'/>
    </input>
    <input type='keyboard' bus='ps2'>
      <alias name='input1'/>
    </input>
    <graphics type='vnc' port='5900' autoport='yes' listen='0.0.0.0'>
      <listen type='address' address='0.0.0.0'/>
    </graphics>
    <video>
      <model type='cirrus' vram='16384' heads='1' primary='yes'/>
      <alias name='video0'/>
      <address type='pci' domain='0x0000' bus='0x05' slot='0x00' function='0x0'/>
    </video>
    <memballoon model='virtio'>
      <alias name='balloon0'/>
      <address type='pci' domain='0x0000' bus='0x06' slot='0x00' function='0x0'/>
    </memballoon>
    <iommu model='intel'>
      <driver intremap='on' caching_mode='on' iotlb='on'/>
    </iommu>
  </devices>
  <seclabel type='dynamic' model='selinux' relabel='yes'/>
</domain>

Actual results:
virsh start guest failed.
The issue start from RHEL-9.2.0-20221226.0. The RHEL-9.2.0-20221227.0 and RHEL-9.2.0-20221228.0 also has this issue.
[root@wsfd-advnetlab153 perf]# virsh start g1
error: Failed to start domain 'g1'
error: internal error: process exited while connecting to monitor: 2022-12-29T09:04:05.260067Z qemu-kvm: Setting CPU affinity failed: Invalid argument

RHEL-9.2.0-20221226.0 job:
https://beaker.engineering.redhat.com/jobs/7381987
RHEL-9.2.0-20221227.0 job:
https://beaker.engineering.redhat.com/jobs/7381105
RHEL-9.2.0-20221228.0 job:
https://beaker.engineering.redhat.com/jobs/7381027

The issue is not exist with RHEL-9.2.0-20221220.0.
https://beaker.engineering.redhat.com/jobs/7380993

Expected results:
virsh start guest successfully.

Additional info:

Comment 1 yalzhang@redhat.com 2023-01-05 02:18:10 UTC
It should be the same issue with bug 2154750.

Comment 2 liting 2023-01-06 03:30:02 UTC
RHEL-9.2.0-20221224.0 also has this issue
https://beaker.engineering.redhat.com/jobs/7382376

Comment 3 yalzhang@redhat.com 2023-01-06 06:10:45 UTC
Actually, this issue occurs since qemu-kvm-7.2.0-1.el9.x86_64

1. test on qemu-kvm-7.1.0:
# rpm -q qemu-kvm libvirt
qemu-kvm-7.1.0-7.el9.x86_64
libvirt-8.10.0-2.el9.x86_64

Set vm with xml includes:
<cputune>
    <emulatorpin cpuset='1'/>
  </cputune>
  <numatune>
    <memory mode='strict' nodeset='0'/>
  </numatune>
(host cpu 1 belongs to host node 1, not host node 0)

the related qemu cmdline:
-object '{"qom-type":"memory-backend-ram","id":"pc.ram","size":2147483648,"host-nodes":[0],"policy":"bind"}' \

2. Update to qemu-kvm-7.2.0-1.el9.x86_64, vm start failed with the same setting
# rpm -q libvirt  qemu-kvm
libvirt-8.10.0-2.el9.x86_64
qemu-kvm-7.2.0-1.el9.x86_64

# virsh start rhel 
error: Failed to start domain 'rhel'
error: internal error: process exited while connecting to monitor: 2023-01-06T06:05:25.568613Z qemu-kvm: Setting CPU affinity failed: Invalid argument

3. Update the setting to be:
<cputune>
    <emulatorpin cpuset='2'/>
  </cputune>
  <numatune>
    <memory mode='strict' nodeset='0'/>
  </numatune>
(host cpu 2 belongs to host node 0)

# virsh start rhel 
Domain 'rhel' started

related qemu cmdline:
-object '{"qom-type":"thread-context","id":"tc-pc.ram","node-affinity":[0]}' \
-object '{"qom-type":"memory-backend-ram","id":"pc.ram","size":2147483648,"host-nodes":[0],"policy":"bind","prealloc-context":"tc-pc.ram"}' \

*** This bug has been marked as a duplicate of bug 2154750 ***

Comment 4 liting 2023-01-30 04:55:05 UTC
rhel9.2 ctc2 still has this issue
https://beaker.engineering.redhat.com/jobs/7476912