Skip to contentSkip to conversation

vfio-user: do not register vfio-user container with cpr

PATCH Applied Mark Cave-Ayland 3 participants 9 messages Jul 2, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 vfio-user: do not register vfio-user container with cpr

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.

---
 hw/vfio-user/container.c | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)
hw/vfio-user/container.c +1 -9
index 3133fef177..4ee99fc2cc 100644
@@ -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);
Signature · 1 line
2.43.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 5 lines · Mark Cave-Ayland

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.

Thanks,

C.

Quoted 42 lines
---
  hw/vfio-user/container.c | 10 +---------
  1 file changed, 1 insertion(+), 9 deletions(-)
hw/vfio-user/container.c +1 -9
index 3133fef177..4ee99fc2cc 100644
@@ -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 lore raw
In reply to Mark Cave-Ayland
Quoted 5 lines · Mark Cave-Ayland

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.

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

Quoted 42 lines
---
  hw/vfio-user/container.c | 10 +---------
  1 file changed, 1 insertion(+), 9 deletions(-)
hw/vfio-user/container.c +1 -9
index 3133fef177..4ee99fc2cc 100644
@@ -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);
#3 lore raw
Quoted 10 lines · Steven Sistare
Quoted 5 lines · Mark Cave-Ayland

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.

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.

#4 lore raw
Quoted 7 lines · Mark Cave-Ayland
Quoted 5 lines · Steven Sistare
Quoted 4 lines · Mark Cave-Ayland

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.

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

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

#5 lore raw
Quoted 10 lines · Steven Sistare
Quoted 9 lines · Mark Cave-Ayland
Quoted 7 lines · Steven Sistare
Quoted 5 lines · Mark Cave-Ayland

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.

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

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.

#6 lore raw
Quoted 16 lines · Mark Cave-Ayland
Quoted 14 lines · Steven Sistare
Quoted 13 lines · Mark Cave-Ayland
Quoted 10 lines · Steven Sistare
Quoted 5 lines · Mark Cave-Ayland

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.

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.

Quoted 6 lines
Quoted 4 lines
Quoted 1 line

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

#7 lore raw
Quoted 19 lines · Steven Sistare
Quoted 18 lines · Mark Cave-Ayland
Quoted 16 lines · Steven Sistare
Quoted 14 lines · Mark Cave-Ayland
Quoted 10 lines · Steven Sistare
Quoted 5 lines · Mark Cave-Ayland

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.

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.

Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

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.

#8 lore raw
In reply to Mark Cave-Ayland
Quoted 40 lines · Mark Cave-Ayland

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.

---
  hw/vfio-user/container.c | 10 +---------
  1 file changed, 1 insertion(+), 9 deletions(-)
hw/vfio-user/container.c +1 -8
index 3133fef177..4ee99fc2cc 100644
@@ -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);
 

hw/vfio-user/container.c static void vfio_user_container_disconnect(VFIOUserContainer *container) · line 284

Quoted 7 lines
hw/vfio-user/container.c +0 -1
@@ -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.