Bug 2092833

Summary: [RFE] Support vDPA live migration in libvirt
Product: Red Hat Enterprise Linux 9 Reporter: yalzhang <yalzhang>
Component: libvirtAssignee: Eugenio Pérez Martín <eperezma>
libvirt sub component: Networking QA Contact: yalzhang <yalzhang>
Status: CLOSED ERRATA Docs Contact:
Severity: unspecified    
Priority: high CC: aadam, chaoyang, chayang, eperezma, jasowang, jdenemar, jjongsma, jsuchane, lmen, lvivier, virt-maint, xuzhang
Version: 9.1Keywords: AutomationTriaged, FutureFeature, Triaged
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: libvirt-8.5.0-3.el9 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-11-15 10:04:39 UTC Type: Feature Request
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-06-02 10:33:34 UTC
Description of problem: 
Support vDPA live migration

Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1. Current libvirt do not support vDPA live migration:
# virsh dumpxml rhel | grep /interface -B6
<interface type='vdpa'>
      <mac address='00:11:22:33:44:00'/>
      <source dev='/dev/vhost-vdpa-0'/>
      <model type='virtio'/>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x04' slot='0x00' function='0x0'/>
    </interface>
# virsh save rhel rhel.save
error: Failed to save domain 'rhel' to rhel.save
error: Requested operation is not valid: vDPA devices cannot be migrated

Comment 13 yalzhang@redhat.com 2022-07-28 06:24:26 UTC
With downstream packages below, test 2 scenarios includeing: 
1)try to migrate with vdpa interface(vdpa_sim) -> fail with reasonable error msg
2)try to migrate with vhost-net -> pass
The result is as expected.

1)current downstream kernel and qemu do not support vdpa yet, so the result is as expected:
# rpm -q libvirt qemu-kvm kernel
libvirt-8.5.0-3.el9.x86_64
qemu-kvm-7.0.0-9.el9.x86_64
kernel-5.14.0-136.el9.x86_64

# modprobe vdpa
# modprobe vhost_vdpa
# modprobe vdpa_sim
# modprobe vdpa_sim_net
#  vdpa mgmtdev show
vdpasim_net: 
  supported_classes net
  max_supported_vqs 2
  dev_features MAC ANY_LAYOUT VERSION_1 ACCESS_PLATFORM
# vdpa dev add name vdpa0 mgmtdev vdpasim_net mac 00:11:22:33:44:00
# virsh dumpxml rhel --xpath //interface 
<interface type="vdpa">
  <mac address="00:11:22:33:44:00"/>
  <source dev="/dev/vhost-vdpa-0"/>
  <model type="virtio"/>
  <alias name="net0"/>
  <address type="pci" domain="0x0000" bus="0x01" slot="0x00" function="0x0"/>
</interface>

# virsh migrate rhel qemu+ssh://xxx/system --live --verbose 
root@xxx's password: 
error: Requested operation is not valid: cannot migrate domain: Migration disabled: vhost lacks VHOST_F_LOG_ALL feature.

2) vhost-net can be migrated:
# virsh dumpxml rhel --xpath //interface  
<interface type="network">
  <mac address="52:54:00:df:28:e5"/>
  <source network="default" portid="4569e614-8f12-4787-8831-14b442cc91c4" bridge="virbr0"/>
  <target dev="vnet0"/>
  <model type="virtio"/>
  <alias name="net0"/>
  <address type="pci" domain="0x0000" bus="0x01" slot="0x00" function="0x0"/>
</interface>
# virsh migrate rhel qemu+ssh://xxx/system --live --verbose 
root@xxx's password: 
Migration: [100 %]

Comment 19 yalzhang@redhat.com 2022-08-04 03:20:00 UTC
Test with latest libvirt-8.5.0-4.el9.x86_64 with vdpa interface:

1) Run save for 2 times:
# virsh save rhel rhel.save
error: Failed to save domain 'rhel' to rhel.save
error: Requested operation is not valid: cannot migrate domain: Migration disabled: vhost lacks VHOST_F_LOG_ALL feature.

# virsh save rhel rhel.save
error: Failed to save domain 'rhel' to rhel.save
error: Requested operation is not valid: cannot migrate domain: Migration disabled: vhost lacks VHOST_F_LOG_ALL feature.

2) migrate:
with vdpa interface
# virsh migrate rhel  qemu+ssh://10.66.146.xx/system --live --verbose 
root.146.xx's password: 
error: Requested operation is not valid: cannot migrate domain: Migration disabled: vhost lacks VHOST_F_LOG_ALL feature.

with vhost-net:
# virsh migrate rhel  qemu+ssh://10.66.146.xx/system --live --verbose  
root.146.xx's password: 
Migration: [100 %]

Comment 20 yalzhang@redhat.com 2022-08-04 03:49:55 UTC
Hi Eugenio, when I tried to migrate with mlx vdpa, the error msg is like below.
It is different from the error msg with vdpa_sim, additional text "; Migration disabled: vhost lacks VHOST_F_LOG_ALL feature."
Is that expected? Please help to confirm, Thank you!

# virsh migrate test qemu+ssh://xxx.redhat.com/system --live --verbose 
root.com's password: 
error: Requested operation is not valid: cannot migrate domain: Migration disabled: vhost lacks VHOST_F_LOG_ALL feature.; Migration disabled: vhost lacks VHOST_F_LOG_ALL feature.

Comment 21 Eugenio Pérez Martín 2022-08-04 06:18:16 UTC
(In reply to yalzhang from comment #20)
> Hi Eugenio, when I tried to migrate with mlx vdpa, the error msg is like
> below.
> It is different from the error msg with vdpa_sim, additional text ";
> Migration disabled: vhost lacks VHOST_F_LOG_ALL feature."
> Is that expected? Please help to confirm, Thank you!
> 
> # virsh migrate test qemu+ssh://xxx.redhat.com/system --live --verbose 
> root.com's password: 
> error: Requested operation is not valid: cannot migrate domain: Migration
> disabled: vhost lacks VHOST_F_LOG_ALL feature.; Migration disabled: vhost
> lacks VHOST_F_LOG_ALL feature.

Hi!

This is expected, you'll find one message per data virtqueue pair + one
message if the guest enabled CVQ on that vdpa device.

In the vhost-kernel or vhost-user devices there is no control vq message.

Thanks!

Comment 23 errata-xmlrpc 2022-11-15 10:04:39 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 (Low: libvirt security, bug fix, and enhancement 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/RHSA-2022:8003