[PATCH] vfio-user: do not register vfio-user container with cpr

Mark Cave-Ayland posted 1 patch 7 months, 1 week ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20250702120043.267634-1-mark.caveayland@nutanix.com
Maintainers: John Levon <john.levon@nutanix.com>, Thanos Makatos <thanos.makatos@nutanix.com>
hw/vfio-user/container.c | 10 +---------
1 file changed, 1 insertion(+), 9 deletions(-)
[PATCH] vfio-user: do not register vfio-user container with cpr
Posted by Mark Cave-Ayland 7 months, 1 week ago
As the full cpr implementation is yet to be merged upstream, do not register
the vfio-user container with cpr. Full vfio-user support for cpr can be
merged later as a follow-up series.

Signed-off-by: Mark Cave-Ayland <mark.caveayland@nutanix.com>
---
 hw/vfio-user/container.c | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)

diff --git a/hw/vfio-user/container.c b/hw/vfio-user/container.c
index 3133fef177..4ee99fc2cc 100644
--- a/hw/vfio-user/container.c
+++ b/hw/vfio-user/container.c
@@ -225,14 +225,10 @@ vfio_user_container_connect(AddressSpace *as, VFIODevice *vbasedev,
 
     bcontainer = &container->bcontainer;
 
-    if (!vfio_cpr_register_container(bcontainer, errp)) {
-        goto free_container_exit;
-    }
-
     ret = ram_block_uncoordinated_discard_disable(true);
     if (ret) {
         error_setg_errno(errp, -ret, "Cannot set discarding of RAM broken");
-        goto unregister_container_exit;
+        goto free_container_exit;
     }
 
     vioc = VFIO_IOMMU_GET_CLASS(bcontainer);
@@ -261,9 +257,6 @@ listener_release_exit:
 enable_discards_exit:
     ram_block_uncoordinated_discard_disable(false);
 
-unregister_container_exit:
-    vfio_cpr_unregister_container(bcontainer);
-
 free_container_exit:
     object_unref(container);
 
@@ -286,7 +279,6 @@ static void vfio_user_container_disconnect(VFIOUserContainer *container)
         vioc->release(bcontainer);
     }
 
-    vfio_cpr_unregister_container(bcontainer);
     object_unref(container);
 
     vfio_address_space_put(space);
-- 
2.43.0
Re: [PATCH] vfio-user: do not register vfio-user container with cpr
Posted by Cédric Le Goater 7 months, 1 week ago
On 7/2/25 13:59, Mark Cave-Ayland wrote:
> As the full cpr implementation is yet to be merged upstream, do not register
> the vfio-user container with cpr. Full vfio-user support for cpr can be
> merged later as a follow-up series.
> 
> Signed-off-by: Mark Cave-Ayland <mark.caveayland@nutanix.com>
> ---
>   hw/vfio-user/container.c | 10 +---------
>   1 file changed, 1 insertion(+), 9 deletions(-)
> 
> diff --git a/hw/vfio-user/container.c b/hw/vfio-user/container.c
> index 3133fef177..4ee99fc2cc 100644
> --- a/hw/vfio-user/container.c
> +++ b/hw/vfio-user/container.c
> @@ -225,14 +225,10 @@ vfio_user_container_connect(AddressSpace *as, VFIODevice *vbasedev,
>   
>       bcontainer = &container->bcontainer;
>   
> -    if (!vfio_cpr_register_container(bcontainer, errp)) {
> -        goto free_container_exit;
> -    }
> -
>       ret = ram_block_uncoordinated_discard_disable(true);
>       if (ret) {
>           error_setg_errno(errp, -ret, "Cannot set discarding of RAM broken");
> -        goto unregister_container_exit;
> +        goto free_container_exit;
>       }
>   
>       vioc = VFIO_IOMMU_GET_CLASS(bcontainer);
> @@ -261,9 +257,6 @@ listener_release_exit:
>   enable_discards_exit:
>       ram_block_uncoordinated_discard_disable(false);
>   
> -unregister_container_exit:
> -    vfio_cpr_unregister_container(bcontainer);
> -
>   free_container_exit:
>       object_unref(container);
>   
> @@ -286,7 +279,6 @@ static void vfio_user_container_disconnect(VFIOUserContainer *container)
>           vioc->release(bcontainer);
>       }
>   
> -    vfio_cpr_unregister_container(bcontainer);
>       object_unref(container);
>   
>       vfio_address_space_put(space);


Applied to vfio-next.

Thanks,

C.
Re: [PATCH] vfio-user: do not register vfio-user container with cpr
Posted by Steven Sistare 7 months, 1 week ago
On 7/2/2025 7:59 AM, Mark Cave-Ayland wrote:
> As the full cpr implementation is yet to be merged upstream, do not register
> the vfio-user container with cpr. Full vfio-user support for cpr can be
> merged later as a follow-up series.
> 
> Signed-off-by: Mark Cave-Ayland <mark.caveayland@nutanix.com>

This is fine, or I could drop my pending patch "vfio/container: delete old cpr register".
Thus the vfio-user container would be registered for cpr-reboot mode, which is fine
at this time.

- Steve

> ---
>   hw/vfio-user/container.c | 10 +---------
>   1 file changed, 1 insertion(+), 9 deletions(-)
> 
> diff --git a/hw/vfio-user/container.c b/hw/vfio-user/container.c
> index 3133fef177..4ee99fc2cc 100644
> --- a/hw/vfio-user/container.c
> +++ b/hw/vfio-user/container.c
> @@ -225,14 +225,10 @@ vfio_user_container_connect(AddressSpace *as, VFIODevice *vbasedev,
>   
>       bcontainer = &container->bcontainer;
>   
> -    if (!vfio_cpr_register_container(bcontainer, errp)) {
> -        goto free_container_exit;
> -    }
> -
>       ret = ram_block_uncoordinated_discard_disable(true);
>       if (ret) {
>           error_setg_errno(errp, -ret, "Cannot set discarding of RAM broken");
> -        goto unregister_container_exit;
> +        goto free_container_exit;
>       }
>   
>       vioc = VFIO_IOMMU_GET_CLASS(bcontainer);
> @@ -261,9 +257,6 @@ listener_release_exit:
>   enable_discards_exit:
>       ram_block_uncoordinated_discard_disable(false);
>   
> -unregister_container_exit:
> -    vfio_cpr_unregister_container(bcontainer);
> -
>   free_container_exit:
>       object_unref(container);
>   
> @@ -286,7 +279,6 @@ static void vfio_user_container_disconnect(VFIOUserContainer *container)
>           vioc->release(bcontainer);
>       }
>   
> -    vfio_cpr_unregister_container(bcontainer);
>       object_unref(container);
>   
>       vfio_address_space_put(space);
Re: [PATCH] vfio-user: do not register vfio-user container with cpr
Posted by Mark Cave-Ayland 7 months, 1 week ago
On 02/07/2025 13:07, Steven Sistare wrote:

> On 7/2/2025 7:59 AM, Mark Cave-Ayland wrote:
>> As the full cpr implementation is yet to be merged upstream, do not 
>> register
>> the vfio-user container with cpr. Full vfio-user support for cpr can be
>> merged later as a follow-up series.
>>
>> Signed-off-by: Mark Cave-Ayland <mark.caveayland@nutanix.com>
> 
> This is fine, or I could drop my pending patch "vfio/container: delete 
> old cpr register".
> Thus the vfio-user container would be registered for cpr-reboot mode, 
> which is fine
> at this time.

Have you got a pointer to a commit showing how the registration should 
be done without using the old register/unregister functions? We are 
certainly interested in looking at cpr here at Nutanix, but since any 
work is in its early stages I don't think it matters too much if the old 
functions were to disappear.


ATB,

Mark.
Re: [PATCH] vfio-user: do not register vfio-user container with cpr
Posted by Steven Sistare 7 months, 1 week ago
On 7/2/2025 9:21 AM, Mark Cave-Ayland wrote:
> On 02/07/2025 13:07, Steven Sistare wrote:
> 
>> On 7/2/2025 7:59 AM, Mark Cave-Ayland wrote:
>>> As the full cpr implementation is yet to be merged upstream, do not register
>>> the vfio-user container with cpr. Full vfio-user support for cpr can be
>>> merged later as a follow-up series.
>>>
>>> Signed-off-by: Mark Cave-Ayland <mark.caveayland@nutanix.com>
>>
>> This is fine, or I could drop my pending patch "vfio/container: delete old cpr register".
>> Thus the vfio-user container would be registered for cpr-reboot mode, which is fine
>> at this time.
> 
> Have you got a pointer to a commit showing how the registration should be done without using the old register/unregister functions? We are certainly interested in looking at cpr here at Nutanix, but since any work is in its early stages I don't think it matters too much if the old functions were to disappear.

No.  cpr-transfer for vfio-user is going to be a bit tricky because of the external process,
and the existing registrations will not cover it.

- Steve
Re: [PATCH] vfio-user: do not register vfio-user container with cpr
Posted by Mark Cave-Ayland 7 months, 1 week ago
On 02/07/2025 14:24, Steven Sistare wrote:

> On 7/2/2025 9:21 AM, Mark Cave-Ayland wrote:
>> On 02/07/2025 13:07, Steven Sistare wrote:
>>
>>> On 7/2/2025 7:59 AM, Mark Cave-Ayland wrote:
>>>> As the full cpr implementation is yet to be merged upstream, do not 
>>>> register
>>>> the vfio-user container with cpr. Full vfio-user support for cpr can be
>>>> merged later as a follow-up series.
>>>>
>>>> Signed-off-by: Mark Cave-Ayland <mark.caveayland@nutanix.com>
>>>
>>> This is fine, or I could drop my pending patch "vfio/container: 
>>> delete old cpr register".
>>> Thus the vfio-user container would be registered for cpr-reboot mode, 
>>> which is fine
>>> at this time.
>>
>> Have you got a pointer to a commit showing how the registration should 
>> be done without using the old register/unregister functions? We are 
>> certainly interested in looking at cpr here at Nutanix, but since any 
>> work is in its early stages I don't think it matters too much if the 
>> old functions were to disappear.
> 
> No.  cpr-transfer for vfio-user is going to be a bit tricky because of 
> the external process,
> and the existing registrations will not cover it.

Got it. In that case I'm happy for Cédric to take my earlier patch to 
remove the old register/unregister functions from vfio-user to avoid 
blocking your work.


ATB,

Mark.


Re: [PATCH] vfio-user: do not register vfio-user container with cpr
Posted by Steven Sistare 7 months, 1 week ago
On 7/2/2025 9:30 AM, Mark Cave-Ayland wrote:
> On 02/07/2025 14:24, Steven Sistare wrote:
> 
>> On 7/2/2025 9:21 AM, Mark Cave-Ayland wrote:
>>> On 02/07/2025 13:07, Steven Sistare wrote:
>>>
>>>> On 7/2/2025 7:59 AM, Mark Cave-Ayland wrote:
>>>>> As the full cpr implementation is yet to be merged upstream, do not register
>>>>> the vfio-user container with cpr. Full vfio-user support for cpr can be
>>>>> merged later as a follow-up series.
>>>>>
>>>>> Signed-off-by: Mark Cave-Ayland <mark.caveayland@nutanix.com>
>>>>
>>>> This is fine, or I could drop my pending patch "vfio/container: delete old cpr register".
>>>> Thus the vfio-user container would be registered for cpr-reboot mode, which is fine
>>>> at this time.
>>>
>>> Have you got a pointer to a commit showing how the registration should be done without using the old register/unregister functions? We are certainly interested in looking at cpr here at Nutanix, but since any work is in its early stages I don't think it matters too much if the old functions were to disappear.
>>
>> No.  cpr-transfer for vfio-user is going to be a bit tricky because of the external process,
>> and the existing registrations will not cover it.
> 
> Got it. In that case I'm happy for Cédric to take my earlier patch to remove the old register/unregister functions from vfio-user to avoid blocking your work.

It will not block my work.  Leaving the old registrations in place in your patch and
mine allows cpr-reboot to work for vfio-user.  I would simply drop my patch that
deletes it, and rework the registration to support all cpr modes in the future.

- Steve

Re: [PATCH] vfio-user: do not register vfio-user container with cpr
Posted by Mark Cave-Ayland 7 months, 1 week ago
On 02/07/2025 14:39, Steven Sistare wrote:

> On 7/2/2025 9:30 AM, Mark Cave-Ayland wrote:
>> On 02/07/2025 14:24, Steven Sistare wrote:
>>
>>> On 7/2/2025 9:21 AM, Mark Cave-Ayland wrote:
>>>> On 02/07/2025 13:07, Steven Sistare wrote:
>>>>
>>>>> On 7/2/2025 7:59 AM, Mark Cave-Ayland wrote:
>>>>>> As the full cpr implementation is yet to be merged upstream, do 
>>>>>> not register
>>>>>> the vfio-user container with cpr. Full vfio-user support for cpr 
>>>>>> can be
>>>>>> merged later as a follow-up series.
>>>>>>
>>>>>> Signed-off-by: Mark Cave-Ayland <mark.caveayland@nutanix.com>
>>>>>
>>>>> This is fine, or I could drop my pending patch "vfio/container: 
>>>>> delete old cpr register".
>>>>> Thus the vfio-user container would be registered for cpr-reboot 
>>>>> mode, which is fine
>>>>> at this time.
>>>>
>>>> Have you got a pointer to a commit showing how the registration 
>>>> should be done without using the old register/unregister functions? 
>>>> We are certainly interested in looking at cpr here at Nutanix, but 
>>>> since any work is in its early stages I don't think it matters too 
>>>> much if the old functions were to disappear.
>>>
>>> No.  cpr-transfer for vfio-user is going to be a bit tricky because 
>>> of the external process,
>>> and the existing registrations will not cover it.
>>
>> Got it. In that case I'm happy for Cédric to take my earlier patch to 
>> remove the old register/unregister functions from vfio-user to avoid 
>> blocking your work.
> 
> It will not block my work.  Leaving the old registrations in place in 
> your patch and
> mine allows cpr-reboot to work for vfio-user.  I would simply drop my 
> patch that
> deletes it, and rework the registration to support all cpr modes in the 
> future.

Okay, great! I'm happy for you to CC me on your future work to help 
review patches in this area.


ATB,

Mark.


Re: [PATCH] vfio-user: do not register vfio-user container with cpr
Posted by Cédric Le Goater 7 months, 1 week ago
On 7/2/25 13:59, Mark Cave-Ayland wrote:
> As the full cpr implementation is yet to be merged upstream, do not register
> the vfio-user container with cpr. Full vfio-user support for cpr can be
> merged later as a follow-up series.
> 
> Signed-off-by: Mark Cave-Ayland <mark.caveayland@nutanix.com>


Reviewed-by: Cédric Le Goater <clg@redhat.com>

Thanks,

C.


> ---
>   hw/vfio-user/container.c | 10 +---------
>   1 file changed, 1 insertion(+), 9 deletions(-)
> 
> diff --git a/hw/vfio-user/container.c b/hw/vfio-user/container.c
> index 3133fef177..4ee99fc2cc 100644
> --- a/hw/vfio-user/container.c
> +++ b/hw/vfio-user/container.c
> @@ -225,14 +225,10 @@ vfio_user_container_connect(AddressSpace *as, VFIODevice *vbasedev,
>   
>       bcontainer = &container->bcontainer;
>   
> -    if (!vfio_cpr_register_container(bcontainer, errp)) {
> -        goto free_container_exit;
> -    }
> -
>       ret = ram_block_uncoordinated_discard_disable(true);
>       if (ret) {
>           error_setg_errno(errp, -ret, "Cannot set discarding of RAM broken");
> -        goto unregister_container_exit;
> +        goto free_container_exit;
>       }
>   
>       vioc = VFIO_IOMMU_GET_CLASS(bcontainer);
> @@ -261,9 +257,6 @@ listener_release_exit:
>   enable_discards_exit:
>       ram_block_uncoordinated_discard_disable(false);
>   
> -unregister_container_exit:
> -    vfio_cpr_unregister_container(bcontainer);
> -
>   free_container_exit:
>       object_unref(container);
>   
> @@ -286,7 +279,6 @@ static void vfio_user_container_disconnect(VFIOUserContainer *container)
>           vioc->release(bcontainer);
>       }
>   
> -    vfio_cpr_unregister_container(bcontainer);
>       object_unref(container);
>   
>       vfio_address_space_put(space);