Bug 2147518

Summary: [RFE][vDPA] VM with vdpa interface can start successfully with different settings from libvirt and vdpa tool
Product: Red Hat Enterprise Linux 9 Reporter: yalzhang <yalzhang>
Component: qemu-kvmAssignee: lulu <lulu>
qemu-kvm sub component: Networking QA Contact: Lei Yang <leiyang>
Status: CLOSED MIGRATED Docs Contact:
Severity: unspecified    
Priority: unspecified CC: jasowang, leiyang, lulu, lvivier, virt-maint, yama
Version: 9.2Keywords: FutureFeature, MigratedToJIRA, Triaged
Target Milestone: rcFlags: pm-rhel: mirror+
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-09-22 15:52:23 UTC Type: Story
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description yalzhang@redhat.com 2022-11-24 07:13:08 UTC
Description of problem:
VM with vdpa interface can start successfully with different settings from libvirt and vdpa tool

Version-Release number of selected component (if applicable):
libvirt-8.9.0-2.el9.x86_64
qemu-kvm-7.1.0-5.el9.x86_64

How reproducible:
100%

Steps to Reproduce:
Vdpa tool can set the mac and queue size for the vdpa device. But for vhost-vdpa, when we use libvirt to start the guest, libvirt can set mac and queue size as well. Only the values set by the vdpa tool will be honored in the guest’s os. If the two settings are different, it can be confusing:

1. Start a vm with vdpa interface set as below:
(the vdpa device initialized by vdpa tool was set by "vdpa dev add name vdpa0 mgmtdev pci/$pci_addr mac 00:11:22:33:44:00 max_vqp 8")

# virsh dumpxml vdpa | grep /interface -B7
    <interface type='vdpa'>
      <mac address='52:54:00:9a:aa:31'/>
      <source dev='/dev/vhost-vdpa-0'/>
      <model type='virtio'/>
      <driver queues='4'/>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x01' slot='0x00' function='0x0'/>
    </interface>
PS: libvirt will generate a random mac address if not it is not set

# virsh domiflist vdpa
 Interface   Type   Source              Model    MAC
--------------------------------------------------------------------
 -           vdpa   /dev/vhost-vdpa-0   virtio   52:54:00:9a:aa:31

Qemu cmd line:
-add-fd set=0,fd=24,opaque=net0-vdpa \
-netdev vhost-vdpa,vhostdev=/dev/fdset/0,queues=4,id=hostnet0 \
-device '{"driver":"virtio-net-pci","mq":true,"vectors":10,"netdev":"hostnet0","id":"net0","mac":"52:54:00:9a:aa:31","bus":"pci.1","addr":"0x0"}' \

# vdpa -jp dev config show
{
    "config": {
        "vdpa0": {
            "mac": "00:11:22:33:44:00",
            "link ": "up",
            "link_announce ": false,
            "max_vq_pairs": 8,
            "mtu": 1500,
            "negotiated_features": [ "CSUM","GUEST_CSUM","HOST_TSO4","HOST_TSO6","STATUS","CTRL_VQ","MQ","CTRL_MAC_ADDR","VERSION_1","ACCESS_PLATFORM" ]
        }
    }
}

2. Start the vm, and check on guest, the value set by vdpa tool will be honored 
# ip l show enp1s0
2: enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DEFAULT group default qlen 1000
    link/ether 00:11:22:33:44:00 brd ff:ff:ff:ff:ff:ff

# ethtool -l enp1s0
Channel parameters for enp1s0:
Pre-set maximums:
RX:		n/a
TX:		n/a
Other:		n/a
Combined:	8
Current hardware settings:
RX:		n/a
TX:		n/a
Other:		n/a
Combined:	8

Actual results:
If we set a different queue size or mac address with the vdpa tool for the vdpa interface, the vm can start successfully, but libvirt settings will not be honored. It can be confusing.

Expected results:
The vm fail to start if the settings from libvirt and vdpa tool are different

Additional info:

Comment 2 Lei Yang 2022-11-24 07:56:59 UTC
The setting of mac address also has the same problem. After communicating with Cindy, they belong to the same problem and will be fixed together, so add this comments as a supplementary explanation.

Comment 3 RHEL Program Management 2023-09-22 15:51:08 UTC
Issue migration from Bugzilla to Jira is in process at this time. This will be the last message in Jira copied from the Bugzilla bug.

Comment 4 RHEL Program Management 2023-09-22 15:52:23 UTC
This BZ has been automatically migrated to the issues.redhat.com Red Hat Issue Tracker. All future work related to this report will be managed there.

Due to differences in account names between systems, some fields were not replicated.  Be sure to add yourself to Jira issue's "Watchers" field to continue receiving updates and add others to the "Need Info From" field to continue requesting information.

To find the migrated issue, look in the "Links" section for a direct link to the new issue location. The issue key will have an icon of 2 footprints next to it, and begin with "RHEL-" followed by an integer.  You can also find this issue by visiting https://issues.redhat.com/issues/?jql= and searching the "Bugzilla Bug" field for this BZ's number, e.g. a search like:

"Bugzilla Bug" = 1234567

In the event you have trouble locating or viewing this issue, you can file an issue by sending mail to rh-issues. You can also visit https://access.redhat.com/articles/7032570 for general account information.