[PATCH V3 9/9] vfio: cpr-exec mode

Steve Sistare posted 9 patches 3 months ago
Maintainers: Steve Sistare <steven.sistare@oracle.com>, Peter Xu <peterx@redhat.com>, Fabiano Rosas <farosas@suse.de>, "Dr. David Alan Gilbert" <dave@treblig.org>, Alex Williamson <alex.williamson@redhat.com>, "Cédric Le Goater" <clg@redhat.com>, Paolo Bonzini <pbonzini@redhat.com>, Eric Blake <eblake@redhat.com>, Markus Armbruster <armbru@redhat.com>, Stefan Weil <sw@weilnetz.de>
There is a newer version of this series
[PATCH V3 9/9] vfio: cpr-exec mode
Posted by Steve Sistare 3 months ago
All blockers and notifiers for cpr-transfer mode also apply to cpr-exec.

Signed-off-by: Steve Sistare <steven.sistare@oracle.com>
---
 hw/vfio/container.c   |  3 ++-
 hw/vfio/cpr-iommufd.c |  3 ++-
 hw/vfio/cpr-legacy.c  |  9 +++++----
 hw/vfio/cpr.c         | 13 +++++++------
 4 files changed, 16 insertions(+), 12 deletions(-)

diff --git a/hw/vfio/container.c b/hw/vfio/container.c
index 3e13fea..735b769 100644
--- a/hw/vfio/container.c
+++ b/hw/vfio/container.c
@@ -993,7 +993,8 @@ static bool vfio_legacy_attach_device(const char *name, VFIODevice *vbasedev,
         error_setg(&vbasedev->cpr.mdev_blocker,
                    "CPR does not support vfio mdev %s", vbasedev->name);
         if (migrate_add_blocker_modes(&vbasedev->cpr.mdev_blocker, errp,
-                                      MIG_MODE_CPR_TRANSFER, -1) < 0) {
+                                      MIG_MODE_CPR_TRANSFER, MIG_MODE_CPR_EXEC,
+                                      -1) < 0) {
             goto hiod_unref_exit;
         }
     }
diff --git a/hw/vfio/cpr-iommufd.c b/hw/vfio/cpr-iommufd.c
index 148a06d..e1f1854 100644
--- a/hw/vfio/cpr-iommufd.c
+++ b/hw/vfio/cpr-iommufd.c
@@ -159,7 +159,8 @@ bool vfio_iommufd_cpr_register_iommufd(IOMMUFDBackend *be, Error **errp)
 
     if (!vfio_cpr_supported(be, cpr_blocker)) {
         return migrate_add_blocker_modes(cpr_blocker, errp,
-                                         MIG_MODE_CPR_TRANSFER, -1) == 0;
+                                         MIG_MODE_CPR_TRANSFER,
+                                         MIG_MODE_CPR_EXEC, -1) == 0;
     }
 
     vmstate_register(NULL, -1, &iommufd_cpr_vmstate, be);
diff --git a/hw/vfio/cpr-legacy.c b/hw/vfio/cpr-legacy.c
index 553b203..7c73439 100644
--- a/hw/vfio/cpr-legacy.c
+++ b/hw/vfio/cpr-legacy.c
@@ -176,16 +176,17 @@ bool vfio_legacy_cpr_register_container(VFIOContainer *container, Error **errp)
 
     if (!vfio_cpr_supported(container, cpr_blocker)) {
         return migrate_add_blocker_modes(cpr_blocker, errp,
-                                         MIG_MODE_CPR_TRANSFER, -1) == 0;
+                                         MIG_MODE_CPR_TRANSFER,
+                                         MIG_MODE_CPR_EXEC, -1) == 0;
     }
 
     vfio_cpr_add_kvm_notifier();
 
     vmstate_register(NULL, -1, &vfio_container_vmstate, container);
 
-    migration_add_notifier_mode(&container->cpr.transfer_notifier,
-                                vfio_cpr_fail_notifier,
-                                MIG_MODE_CPR_TRANSFER);
+    migration_add_notifier_modes(&container->cpr.transfer_notifier,
+                                 vfio_cpr_fail_notifier,
+                                 MIG_MODE_CPR_TRANSFER, MIG_MODE_CPR_EXEC, -1);
     return true;
 }
 
diff --git a/hw/vfio/cpr.c b/hw/vfio/cpr.c
index a831243..a176971 100644
--- a/hw/vfio/cpr.c
+++ b/hw/vfio/cpr.c
@@ -195,9 +195,10 @@ static int vfio_cpr_kvm_close_notifier(NotifierWithReturn *notifier,
 void vfio_cpr_add_kvm_notifier(void)
 {
     if (!kvm_close_notifier.notify) {
-        migration_add_notifier_mode(&kvm_close_notifier,
-                                    vfio_cpr_kvm_close_notifier,
-                                    MIG_MODE_CPR_TRANSFER);
+        migration_add_notifier_modes(&kvm_close_notifier,
+                                     vfio_cpr_kvm_close_notifier,
+                                     MIG_MODE_CPR_TRANSFER, MIG_MODE_CPR_EXEC,
+                                     -1);
     }
 }
 
@@ -282,9 +283,9 @@ static int vfio_cpr_pci_notifier(NotifierWithReturn *notifier,
 
 void vfio_cpr_pci_register_device(VFIOPCIDevice *vdev)
 {
-    migration_add_notifier_mode(&vdev->cpr.transfer_notifier,
-                                vfio_cpr_pci_notifier,
-                                MIG_MODE_CPR_TRANSFER);
+    migration_add_notifier_modes(&vdev->cpr.transfer_notifier,
+                                 vfio_cpr_pci_notifier,
+                                 MIG_MODE_CPR_TRANSFER, MIG_MODE_CPR_EXEC, -1);
 }
 
 void vfio_cpr_pci_unregister_device(VFIOPCIDevice *vdev)
-- 
1.8.3.1
Re: [PATCH V3 9/9] vfio: cpr-exec mode
Posted by Steven Sistare 3 months ago
cc Cedric and Alex.

This is the only patch of the series "Live update: cpr-exec" that touches vfio.

- Steve

On 8/14/2025 1:17 PM, Steve Sistare wrote:
> All blockers and notifiers for cpr-transfer mode also apply to cpr-exec.
> 
> Signed-off-by: Steve Sistare <steven.sistare@oracle.com>
> ---
>   hw/vfio/container.c   |  3 ++-
>   hw/vfio/cpr-iommufd.c |  3 ++-
>   hw/vfio/cpr-legacy.c  |  9 +++++----
>   hw/vfio/cpr.c         | 13 +++++++------
>   4 files changed, 16 insertions(+), 12 deletions(-)
> 
> diff --git a/hw/vfio/container.c b/hw/vfio/container.c
> index 3e13fea..735b769 100644
> --- a/hw/vfio/container.c
> +++ b/hw/vfio/container.c
> @@ -993,7 +993,8 @@ static bool vfio_legacy_attach_device(const char *name, VFIODevice *vbasedev,
>           error_setg(&vbasedev->cpr.mdev_blocker,
>                      "CPR does not support vfio mdev %s", vbasedev->name);
>           if (migrate_add_blocker_modes(&vbasedev->cpr.mdev_blocker, errp,
> -                                      MIG_MODE_CPR_TRANSFER, -1) < 0) {
> +                                      MIG_MODE_CPR_TRANSFER, MIG_MODE_CPR_EXEC,
> +                                      -1) < 0) {
>               goto hiod_unref_exit;
>           }
>       }
> diff --git a/hw/vfio/cpr-iommufd.c b/hw/vfio/cpr-iommufd.c
> index 148a06d..e1f1854 100644
> --- a/hw/vfio/cpr-iommufd.c
> +++ b/hw/vfio/cpr-iommufd.c
> @@ -159,7 +159,8 @@ bool vfio_iommufd_cpr_register_iommufd(IOMMUFDBackend *be, Error **errp)
>   
>       if (!vfio_cpr_supported(be, cpr_blocker)) {
>           return migrate_add_blocker_modes(cpr_blocker, errp,
> -                                         MIG_MODE_CPR_TRANSFER, -1) == 0;
> +                                         MIG_MODE_CPR_TRANSFER,
> +                                         MIG_MODE_CPR_EXEC, -1) == 0;
>       }
>   
>       vmstate_register(NULL, -1, &iommufd_cpr_vmstate, be);
> diff --git a/hw/vfio/cpr-legacy.c b/hw/vfio/cpr-legacy.c
> index 553b203..7c73439 100644
> --- a/hw/vfio/cpr-legacy.c
> +++ b/hw/vfio/cpr-legacy.c
> @@ -176,16 +176,17 @@ bool vfio_legacy_cpr_register_container(VFIOContainer *container, Error **errp)
>   
>       if (!vfio_cpr_supported(container, cpr_blocker)) {
>           return migrate_add_blocker_modes(cpr_blocker, errp,
> -                                         MIG_MODE_CPR_TRANSFER, -1) == 0;
> +                                         MIG_MODE_CPR_TRANSFER,
> +                                         MIG_MODE_CPR_EXEC, -1) == 0;
>       }
>   
>       vfio_cpr_add_kvm_notifier();
>   
>       vmstate_register(NULL, -1, &vfio_container_vmstate, container);
>   
> -    migration_add_notifier_mode(&container->cpr.transfer_notifier,
> -                                vfio_cpr_fail_notifier,
> -                                MIG_MODE_CPR_TRANSFER);
> +    migration_add_notifier_modes(&container->cpr.transfer_notifier,
> +                                 vfio_cpr_fail_notifier,
> +                                 MIG_MODE_CPR_TRANSFER, MIG_MODE_CPR_EXEC, -1);
>       return true;
>   }
>   
> diff --git a/hw/vfio/cpr.c b/hw/vfio/cpr.c
> index a831243..a176971 100644
> --- a/hw/vfio/cpr.c
> +++ b/hw/vfio/cpr.c
> @@ -195,9 +195,10 @@ static int vfio_cpr_kvm_close_notifier(NotifierWithReturn *notifier,
>   void vfio_cpr_add_kvm_notifier(void)
>   {
>       if (!kvm_close_notifier.notify) {
> -        migration_add_notifier_mode(&kvm_close_notifier,
> -                                    vfio_cpr_kvm_close_notifier,
> -                                    MIG_MODE_CPR_TRANSFER);
> +        migration_add_notifier_modes(&kvm_close_notifier,
> +                                     vfio_cpr_kvm_close_notifier,
> +                                     MIG_MODE_CPR_TRANSFER, MIG_MODE_CPR_EXEC,
> +                                     -1);
>       }
>   }
>   
> @@ -282,9 +283,9 @@ static int vfio_cpr_pci_notifier(NotifierWithReturn *notifier,
>   
>   void vfio_cpr_pci_register_device(VFIOPCIDevice *vdev)
>   {
> -    migration_add_notifier_mode(&vdev->cpr.transfer_notifier,
> -                                vfio_cpr_pci_notifier,
> -                                MIG_MODE_CPR_TRANSFER);
> +    migration_add_notifier_modes(&vdev->cpr.transfer_notifier,
> +                                 vfio_cpr_pci_notifier,
> +                                 MIG_MODE_CPR_TRANSFER, MIG_MODE_CPR_EXEC, -1);
>   }
>   
>   void vfio_cpr_pci_unregister_device(VFIOPCIDevice *vdev)
Re: [PATCH V3 9/9] vfio: cpr-exec mode
Posted by Steven Sistare 1 month, 3 weeks ago
This still needs review - steve

On 8/14/2025 1:20 PM, Steven Sistare wrote:
> cc Cedric and Alex.
> 
> This is the only patch of the series "Live update: cpr-exec" that touches vfio.
> 
> - Steve
> 
> On 8/14/2025 1:17 PM, Steve Sistare wrote:
>> All blockers and notifiers for cpr-transfer mode also apply to cpr-exec.
>>
>> Signed-off-by: Steve Sistare <steven.sistare@oracle.com>
>> ---
>>   hw/vfio/container.c   |  3 ++-
>>   hw/vfio/cpr-iommufd.c |  3 ++-
>>   hw/vfio/cpr-legacy.c  |  9 +++++----
>>   hw/vfio/cpr.c         | 13 +++++++------
>>   4 files changed, 16 insertions(+), 12 deletions(-)
>>
>> diff --git a/hw/vfio/container.c b/hw/vfio/container.c
>> index 3e13fea..735b769 100644
>> --- a/hw/vfio/container.c
>> +++ b/hw/vfio/container.c
>> @@ -993,7 +993,8 @@ static bool vfio_legacy_attach_device(const char *name, VFIODevice *vbasedev,
>>           error_setg(&vbasedev->cpr.mdev_blocker,
>>                      "CPR does not support vfio mdev %s", vbasedev->name);
>>           if (migrate_add_blocker_modes(&vbasedev->cpr.mdev_blocker, errp,
>> -                                      MIG_MODE_CPR_TRANSFER, -1) < 0) {
>> +                                      MIG_MODE_CPR_TRANSFER, MIG_MODE_CPR_EXEC,
>> +                                      -1) < 0) {
>>               goto hiod_unref_exit;
>>           }
>>       }
>> diff --git a/hw/vfio/cpr-iommufd.c b/hw/vfio/cpr-iommufd.c
>> index 148a06d..e1f1854 100644
>> --- a/hw/vfio/cpr-iommufd.c
>> +++ b/hw/vfio/cpr-iommufd.c
>> @@ -159,7 +159,8 @@ bool vfio_iommufd_cpr_register_iommufd(IOMMUFDBackend *be, Error **errp)
>>       if (!vfio_cpr_supported(be, cpr_blocker)) {
>>           return migrate_add_blocker_modes(cpr_blocker, errp,
>> -                                         MIG_MODE_CPR_TRANSFER, -1) == 0;
>> +                                         MIG_MODE_CPR_TRANSFER,
>> +                                         MIG_MODE_CPR_EXEC, -1) == 0;
>>       }
>>       vmstate_register(NULL, -1, &iommufd_cpr_vmstate, be);
>> diff --git a/hw/vfio/cpr-legacy.c b/hw/vfio/cpr-legacy.c
>> index 553b203..7c73439 100644
>> --- a/hw/vfio/cpr-legacy.c
>> +++ b/hw/vfio/cpr-legacy.c
>> @@ -176,16 +176,17 @@ bool vfio_legacy_cpr_register_container(VFIOContainer *container, Error **errp)
>>       if (!vfio_cpr_supported(container, cpr_blocker)) {
>>           return migrate_add_blocker_modes(cpr_blocker, errp,
>> -                                         MIG_MODE_CPR_TRANSFER, -1) == 0;
>> +                                         MIG_MODE_CPR_TRANSFER,
>> +                                         MIG_MODE_CPR_EXEC, -1) == 0;
>>       }
>>       vfio_cpr_add_kvm_notifier();
>>       vmstate_register(NULL, -1, &vfio_container_vmstate, container);
>> -    migration_add_notifier_mode(&container->cpr.transfer_notifier,
>> -                                vfio_cpr_fail_notifier,
>> -                                MIG_MODE_CPR_TRANSFER);
>> +    migration_add_notifier_modes(&container->cpr.transfer_notifier,
>> +                                 vfio_cpr_fail_notifier,
>> +                                 MIG_MODE_CPR_TRANSFER, MIG_MODE_CPR_EXEC, -1);
>>       return true;
>>   }
>> diff --git a/hw/vfio/cpr.c b/hw/vfio/cpr.c
>> index a831243..a176971 100644
>> --- a/hw/vfio/cpr.c
>> +++ b/hw/vfio/cpr.c
>> @@ -195,9 +195,10 @@ static int vfio_cpr_kvm_close_notifier(NotifierWithReturn *notifier,
>>   void vfio_cpr_add_kvm_notifier(void)
>>   {
>>       if (!kvm_close_notifier.notify) {
>> -        migration_add_notifier_mode(&kvm_close_notifier,
>> -                                    vfio_cpr_kvm_close_notifier,
>> -                                    MIG_MODE_CPR_TRANSFER);
>> +        migration_add_notifier_modes(&kvm_close_notifier,
>> +                                     vfio_cpr_kvm_close_notifier,
>> +                                     MIG_MODE_CPR_TRANSFER, MIG_MODE_CPR_EXEC,
>> +                                     -1);
>>       }
>>   }
>> @@ -282,9 +283,9 @@ static int vfio_cpr_pci_notifier(NotifierWithReturn *notifier,
>>   void vfio_cpr_pci_register_device(VFIOPCIDevice *vdev)
>>   {
>> -    migration_add_notifier_mode(&vdev->cpr.transfer_notifier,
>> -                                vfio_cpr_pci_notifier,
>> -                                MIG_MODE_CPR_TRANSFER);
>> +    migration_add_notifier_modes(&vdev->cpr.transfer_notifier,
>> +                                 vfio_cpr_pci_notifier,
>> +                                 MIG_MODE_CPR_TRANSFER, MIG_MODE_CPR_EXEC, -1);
>>   }
>>   void vfio_cpr_pci_unregister_device(VFIOPCIDevice *vdev)
> 


Re: [PATCH V3 9/9] vfio: cpr-exec mode
Posted by Cédric Le Goater 1 month, 3 weeks ago
On 9/19/25 17:35, Steven Sistare wrote:
> This still needs review - steve

Steve,

please CC: us on the whole series next time. I will catch on the
emails next week. That said, I don't see any blocker.

Thanks,

C.



> 
> On 8/14/2025 1:20 PM, Steven Sistare wrote:
>> cc Cedric and Alex.
>>
>> This is the only patch of the series "Live update: cpr-exec" that touches vfio.
>>
>> - Steve
>>
>> On 8/14/2025 1:17 PM, Steve Sistare wrote:
>>> All blockers and notifiers for cpr-transfer mode also apply to cpr-exec.
>>>
>>> Signed-off-by: Steve Sistare <steven.sistare@oracle.com>
>>> ---
>>>   hw/vfio/container.c   |  3 ++-
>>>   hw/vfio/cpr-iommufd.c |  3 ++-
>>>   hw/vfio/cpr-legacy.c  |  9 +++++----
>>>   hw/vfio/cpr.c         | 13 +++++++------
>>>   4 files changed, 16 insertions(+), 12 deletions(-)
>>>
>>> diff --git a/hw/vfio/container.c b/hw/vfio/container.c
>>> index 3e13fea..735b769 100644
>>> --- a/hw/vfio/container.c
>>> +++ b/hw/vfio/container.c
>>> @@ -993,7 +993,8 @@ static bool vfio_legacy_attach_device(const char *name, VFIODevice *vbasedev,
>>>           error_setg(&vbasedev->cpr.mdev_blocker,
>>>                      "CPR does not support vfio mdev %s", vbasedev->name);
>>>           if (migrate_add_blocker_modes(&vbasedev->cpr.mdev_blocker, errp,
>>> -                                      MIG_MODE_CPR_TRANSFER, -1) < 0) {
>>> +                                      MIG_MODE_CPR_TRANSFER, MIG_MODE_CPR_EXEC,
>>> +                                      -1) < 0) {
>>>               goto hiod_unref_exit;
>>>           }
>>>       }
>>> diff --git a/hw/vfio/cpr-iommufd.c b/hw/vfio/cpr-iommufd.c
>>> index 148a06d..e1f1854 100644
>>> --- a/hw/vfio/cpr-iommufd.c
>>> +++ b/hw/vfio/cpr-iommufd.c
>>> @@ -159,7 +159,8 @@ bool vfio_iommufd_cpr_register_iommufd(IOMMUFDBackend *be, Error **errp)
>>>       if (!vfio_cpr_supported(be, cpr_blocker)) {
>>>           return migrate_add_blocker_modes(cpr_blocker, errp,
>>> -                                         MIG_MODE_CPR_TRANSFER, -1) == 0;
>>> +                                         MIG_MODE_CPR_TRANSFER,
>>> +                                         MIG_MODE_CPR_EXEC, -1) == 0;
>>>       }
>>>       vmstate_register(NULL, -1, &iommufd_cpr_vmstate, be);
>>> diff --git a/hw/vfio/cpr-legacy.c b/hw/vfio/cpr-legacy.c
>>> index 553b203..7c73439 100644
>>> --- a/hw/vfio/cpr-legacy.c
>>> +++ b/hw/vfio/cpr-legacy.c
>>> @@ -176,16 +176,17 @@ bool vfio_legacy_cpr_register_container(VFIOContainer *container, Error **errp)
>>>       if (!vfio_cpr_supported(container, cpr_blocker)) {
>>>           return migrate_add_blocker_modes(cpr_blocker, errp,
>>> -                                         MIG_MODE_CPR_TRANSFER, -1) == 0;
>>> +                                         MIG_MODE_CPR_TRANSFER,
>>> +                                         MIG_MODE_CPR_EXEC, -1) == 0;
>>>       }
>>>       vfio_cpr_add_kvm_notifier();
>>>       vmstate_register(NULL, -1, &vfio_container_vmstate, container);
>>> -    migration_add_notifier_mode(&container->cpr.transfer_notifier,
>>> -                                vfio_cpr_fail_notifier,
>>> -                                MIG_MODE_CPR_TRANSFER);
>>> +    migration_add_notifier_modes(&container->cpr.transfer_notifier,
>>> +                                 vfio_cpr_fail_notifier,
>>> +                                 MIG_MODE_CPR_TRANSFER, MIG_MODE_CPR_EXEC, -1);
>>>       return true;
>>>   }
>>> diff --git a/hw/vfio/cpr.c b/hw/vfio/cpr.c
>>> index a831243..a176971 100644
>>> --- a/hw/vfio/cpr.c
>>> +++ b/hw/vfio/cpr.c
>>> @@ -195,9 +195,10 @@ static int vfio_cpr_kvm_close_notifier(NotifierWithReturn *notifier,
>>>   void vfio_cpr_add_kvm_notifier(void)
>>>   {
>>>       if (!kvm_close_notifier.notify) {
>>> -        migration_add_notifier_mode(&kvm_close_notifier,
>>> -                                    vfio_cpr_kvm_close_notifier,
>>> -                                    MIG_MODE_CPR_TRANSFER);
>>> +        migration_add_notifier_modes(&kvm_close_notifier,
>>> +                                     vfio_cpr_kvm_close_notifier,
>>> +                                     MIG_MODE_CPR_TRANSFER, MIG_MODE_CPR_EXEC,
>>> +                                     -1);
>>>       }
>>>   }
>>> @@ -282,9 +283,9 @@ static int vfio_cpr_pci_notifier(NotifierWithReturn *notifier,
>>>   void vfio_cpr_pci_register_device(VFIOPCIDevice *vdev)
>>>   {
>>> -    migration_add_notifier_mode(&vdev->cpr.transfer_notifier,
>>> -                                vfio_cpr_pci_notifier,
>>> -                                MIG_MODE_CPR_TRANSFER);
>>> +    migration_add_notifier_modes(&vdev->cpr.transfer_notifier,
>>> +                                 vfio_cpr_pci_notifier,
>>> +                                 MIG_MODE_CPR_TRANSFER, MIG_MODE_CPR_EXEC, -1);
>>>   }
>>>   void vfio_cpr_pci_unregister_device(VFIOPCIDevice *vdev)
>>
>