Bug 2212770

Summary: mlx5_core driver: the guest start failed the first time when running ovs kernel case with tap port
Product: Red Hat Enterprise Linux Fast Datapath Reporter: liting <tli>
Component: openvswitchAssignee: Timothy Redaelli <tredaelli>
openvswitch sub component: other QA Contact: qding
Status: NEW --- Docs Contact:
Severity: unspecified    
Priority: unspecified CC: ctrautma, qding
Version: FDP 23.E   
Target Milestone: ---   
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: 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 2023-06-06 10:06:04 UTC
Description of problem:


Version-Release number of selected component (if applicable):
[root@dell-per730-56 perf]# rpm -qa|grep openvs
kernel-kernel-networking-openvswitch-perf-1.0-412.noarch
openvswitch-selinux-extra-policy-1.0-30.el8fdp.noarch
kernel-kernel-networking-openvswitch-common-3.0-61.noarch
openvswitch3.1-3.1.0-17.el8fdp.x86_64
[root@dell-per730-56 perf]# uname -r
4.18.0-372.56.1.el8_6.x86_64


How reproducible:


Steps to Reproduce:
1.build ovs pvp topo
ip tuntap add tap1 mode tap
ip tuntap add tap2 mode tap
ovs-vsctl add-br ovsbr0
ip link set ovsbr0 up
ovs-vsctl add-port ovsbr0 enp4s0f0
ovs-vsctl add-port ovsbr0 enp4s0f1
ovs-vsctl add-port ovsbr0 tap1
ovs-vsctl add-port ovsbr0 tap2
2. define guest as following
virsh define g1.xml
g1.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'>5</vcpu>
  <cputune>
    <vcpupin vcpu='0' cpuset='2'/>
    <vcpupin vcpu='1' cpuset='26'/>
    <vcpupin vcpu='2' cpuset='4'/>
    <vcpupin vcpu='3' cpuset='28'/>
    <vcpupin vcpu='4' cpuset='6'/>
  </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-4' 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>
<interface type='ethernet'>
  <mac address='00:de:ad:00:00:01'/>
  <target dev='tap1'/>
  <source bridge='ovsbr0'/>
  <model type='virtio'/>
  <driver name='vhost' queues='2' iommu='on' ats='on'/>
  <address type='pci' domain='0x0000' bus='0x03' slot='0x00' function='0x0'/>
</interface>
<interface type='ethernet'>
  <mac address='00:de:ad:00:00:02'/>
  <target dev='tap2'/>
  <source bridge='ovsbr0'/>
  <model type='virtio'/>
  <driver name='vhost' queues='2' iommu='on' ats='on'/>
  <address type='pci' domain='0x0000' bus='0x04' slot='0x00' function='0x0'/>
</interface>
    <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>

3.start guest
virsh start g1

Actual results:
start guest failed with the first time, and check there is no tap port with "ip a" command.
[root@dell-per730-56 perf]# ovs-vsctl show
773966f2-62d1-456c-9248-8cafdd8bafcc
    Bridge ovsbr0
        Port tap2
            Interface tap2
        Port ovsbr0
            Interface ovsbr0
                type: internal
        Port enp4s0f0
            Interface enp4s0f0
        Port tap1
            Interface tap1
        Port enp4s0f1
            Interface enp4s0f1
    ovs_version: "3.1.1"

[root@dell-per730-56 perf]# virsh define g1.xml 
Domain 'g1' defined from g1.xml

[root@dell-per730-56 perf]# virsh start g1
error: Failed to start domain 'g1'
error: Unable to create tap device tap1: Invalid argument


[root@dell-per730-56 perf]# ovs-vsctl show
773966f2-62d1-456c-9248-8cafdd8bafcc
    Bridge ovsbr0
        Port ovsbr0
            Interface ovsbr0
                type: internal
        Port enp4s0f0
            Interface enp4s0f0
        Port tap2
            Interface tap2
                error: "could not open network device tap2 (No such device)"
        Port enp4s0f1
            Interface enp4s0f1
        Port tap1
            Interface tap1
                error: "could not open network device tap1 (No such device)"
    ovs_version: "3.1.1"

#And start guest successfully the second time and check the there are the tap ports.
[root@dell-per730-56 perf]# virsh start g1
Domain 'g1' started

[root@dell-per730-56 perf]# ip a
..
68: tap1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq master ovs-system state UNKNOWN group default qlen 1000
    link/ether fe:de:ad:00:00:01 brd ff:ff:ff:ff:ff:ff
    inet6 fe80::fcde:adff:fe00:1/64 scope link 
       valid_lft forever preferred_lft forever
69: tap2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq master ovs-system state UNKNOWN group default qlen 1000
    link/ether fe:de:ad:00:00:02 brd ff:ff:ff:ff:ff:ff
    inet6 fe80::fcde:adff:fe00:2/64 scope link 
       valid_lft forever preferred_lft forever



Expected results:
Start guest successfully the first time and there are the tap1 and tap2 port.

Additional info: