[Bug 217558] New: In KVM guest with VF of X710 NIC passthrough, the mac address of VF is inconsistent with it in host

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



https://bugzilla.kernel.org/show_bug.cgi?id=217558

            Bug ID: 217558
           Summary: In KVM guest with VF of X710 NIC passthrough, the mac
                    address of VF is inconsistent with it in host
           Product: Virtualization
           Version: unspecified
          Hardware: Intel
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P3
         Component: kvm
          Assignee: virtualization_kvm@xxxxxxxxxxxxxxxxxxxx
          Reporter: farrah.chen@xxxxxxxxx
        Regression: No

Environment:

kernel: https://git.kernel.org/pub/scm/virt/kvm/kvm.git branch: next commit:
39428f6e kernel version:6.4.0-rc2
Qemu: https://gitlab.com/qemu-project/qemu.git branch: master commit: 7efd6542
Host OS: CentOS stream 9
Guest OS: CentOS stream 9
CPU:
Architecture:            x86_64
Vendor ID:               GenuineIntel
  BIOS Vendor ID:        Intel(R) Corporation
  Model name:            Intel(R) Xeon(R) Platinum

Bug detail description: 

Create VF of X710 NIC on host, create VM with VF passthrough, there is a
probability that the mac of VF in guest is inconsistent with it in host, the VF
in guest gets a random mac. 

Reproduce steps: 

1.Create two VFs of NIC X710:

[root@spr-2s2 ~]# lspci -k -s 98:00.0
98:00.0 Ethernet controller: Intel Corporation Ethernet Controller X710 for
10GbE SFP+ (rev 01)
        Subsystem: Intel Corporation Ethernet Converged Network Adapter X710-2
        Kernel driver in use: i40e
        Kernel modules: i40e
[root@spr-2s2 ~]# echo 2 > /sys/bus/pci/devices/0000:98:00.0/sriov_numvfs

2. Check mac and driver of the 2 VFs

[root@spr-2s2 xf]# ip address

14: ens28f0v0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP
group default qlen 1000
    link/ether 32:40:f7:6a:dc:8a brd ff:ff:ff:ff:ff:ff
    altname enp152s0f0v0
15: ens28f0v1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP
group default qlen 1000
    link/ether 6e:bd:a8:ee:83:c4 brd ff:ff:ff:ff:ff:ff
    altname enp152s0f0v1

[root@spr-2s2 xf]# ethtool -i ens28f0v0
driver: iavf
version: 6.4.0-rc2
bus-info: 0000:98:02.0
[root@spr-2s2 xf]# ethtool -i ens28f0v1
driver: iavf
version: 6.4.0-rc2
bus-info: 0000:98:02.1

[root@spr-2s2 xf]# lspci -k -s 98:02.0
98:02.0 Ethernet controller: Intel Corporation Ethernet Virtual Function 700
Series (rev 01)
        Subsystem: Intel Corporation Device 0000
        Kernel driver in use: iavf
        Kernel modules: iavf
[root@spr-2s2 xf]# lspci -k -s 98:02.1
98:02.1 Ethernet controller: Intel Corporation Ethernet Virtual Function 700
Series (rev 01)
        Subsystem: Intel Corporation Device 0000
        Kernel driver in use: iavf
        Kernel modules: iavf

3. Unbind the VFs from iavf driver and bind them to vfio-pci

[root@spr-2s2 xf]# echo 0000:98:02.0 >
/sys/bus/pci/devices/0000\:98\:02.0/driver/unbind
[root@spr-2s2 xf]# echo 0000:98:02.1 >
/sys/bus/pci/devices/0000\:98\:02.1/driver/unbind

[root@spr-2s2 xf]# modprobe vfio-pci
[root@spr-2s2 xf]# lspci -n -s 98:02.0
98:02.0 0200: 8086:154c (rev 01)
[root@spr-2s2 xf]# echo 8086 154c > /sys/bus/pci/drivers/vfio-pci/new_id
[root@spr-2s2 xf]# lspci -k -s 98:02.0
98:02.0 Ethernet controller: Intel Corporation Ethernet Virtual Function 700
Series (rev 01)
        Subsystem: Intel Corporation Device 0000
        Kernel driver in use: vfio-pci
        Kernel modules: iavf
[root@spr-2s2 xf]# lspci -k -s 98:02.1
98:02.1 Ethernet controller: Intel Corporation Ethernet Virtual Function 700
Series (rev 01)
        Subsystem: Intel Corporation Device 0000
        Kernel driver in use: vfio-pci
        Kernel modules: iavf

4.Create guest with these 2 VFs passthrough

qemu-system-x86_64 -accel kvm -m 4096 -cpu host -drive
file=centos9.qcow2,if=none,id=virtio-disk0 -device
virtio-blk-pci,drive=virtio-disk0,bootindex=0 -smp 4 -device
vfio-pci,host=98:02.0 -net none -device vfio-pci,host=98:02.1 -net none
-daemonize -vnc :5

5. Check the mac and ip address of the these 2 VFs in guest

[root@localhost ~]# ip ad
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group
default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: ens4: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group
default qlen 1000
    link/ether c2:4e:37:99:fc:ff brd ff:ff:ff:ff:ff:ff
    altname enp0s4
    inet 192.168.111.27/20 brd 192.168.111.255 scope global dynamic
noprefixroute ens4
       valid_lft 278sec preferred_lft 278sec
    inet6 fe80::ac6c:bd39:6513:d29/64 scope link noprefixroute
       valid_lft forever preferred_lft forever
3: ens5: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group
default qlen 1000
    link/ether 6e:bd:a8:ee:83:c4 brd ff:ff:ff:ff:ff:ff
    altname enp0s5
    inet 192.168.111.26/20 brd 192.168.111.255 scope global dynamic
noprefixroute ens5
       valid_lft 276sec preferred_lft 276sec
    inet6 fe80::7a32:aa2c:c2ee:8d5d/64 scope link noprefixroute
       valid_lft forever preferred_lft forever

The mac of VF1 in host is 32:40:f7:6a:dc:8a, but it in guest is
c2:4e:37:99:fc:ff, VF2 gets the same mac 6e:bd:a8:ee:83:c4

The guest dmesg about iavf:

[    3.516623] iavf: Intel(R) Ethernet Adaptive Virtual Function Network Driver
[    3.517302] Copyright (c) 2013 - 2018 Intel Corporation.
[    3.588858] ppdev: user-space parallel port driver
[    3.590703] iavf 0000:00:04.0: Invalid MAC address 00:00:00:00:00:00, using
random
[    3.592382] iavf 0000:00:04.0: Multiqueue Enabled: Queue pair count = 4
[    3.593697] iavf 0000:00:05.0: Multiqueue Enabled: Queue pair count = 4
[    3.594086] iavf 0000:00:04.0: MAC address: c2:4e:37:99:fc:ff
[    3.595297] iavf 0000:00:04.0: GRO is enabled
[    3.595932] iavf 0000:00:05.0: MAC address: 6e:bd:a8:ee:83:c4
[    3.596503] iavf 0000:00:05.0: GRO is enabled
[    3.598333] iavf 0000:00:04.0 ens4: renamed from eth0
[    3.606666] XFS (vda2): Mounting V5 Filesystem
8736b23e-ddde-4cca-9166-2623d2e57e5a
[    3.606987] iavf 0000:00:05.0 ens5: renamed from eth1
[    3.614474] XFS (vda2): Ending clean mount
[    3.692511] RPC: Registered named UNIX socket transport module.
[    3.693055] RPC: Registered udp transport module.
[    3.693665] RPC: Registered tcp transport module.
[    3.694243] RPC: Registered tcp NFSv4.1 backchannel transport module.
[    4.125995] iavf 0000:00:04.0 ens4: NIC Link is Up Speed is 10 Gbps Full
Duplex
[    4.126628] IPv6: ADDRCONF(NETDEV_CHANGE): ens4: link becomes ready
[    4.158025] iavf 0000:00:05.0 ens5: NIC Link is Up Speed is 10 Gbps Full
Duplex
[    4.158648] IPv6: ADDRCONF(NETDEV_CHANGE): ens5: link becomes ready

Currect Result:

There is a probability that the mac of VF in guest is inconsistent with it in
host

Expected Result

When passthrough NIC VF to guest, the VF in guest should always get the same
mac as it in host.

-- 
You may reply to this email to add a comment.

You are receiving this mail because:
You are watching the assignee of the bug.



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux