Skip to contentSkip to conversation

multifd: Unconditionally unregister yank function

PATCH In review Lukas Straub 3 participants 5 messages Aug 4, 2021 – Sep 9, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 multifd: Unconditionally unregister yank function

Unconditionally unregister yank function in multifd_load_cleanup(). If it is not unregistered here, it will leak and cause a crash in yank_unregister_instance(). Now if the ioc is still in use afterwards, it will only lead to qemu not being able to recover from a hang related to that ioc.

After checking the code, i am pretty sure that ref is always 1 when arriving here. So all this currently does is remove the unneeded check.

---

This is similar to Peter Xu's 39675ffffb3394d44b880d083a214c5e44786170 "migration: Move the yank unregister of channel_close out" in that it removes the "OBJECT(p->c)->ref == 1" hack. So it makes sense for 6.1 so these patches are together.

 migration/multifd.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
migration/multifd.c +1 -4
index 377da78f5b..a37805e17e 100644
@@ -987,10 +987,7 @@ int multifd_load_cleanup(Error **errp)
     for (i = 0; i < migrate_multifd_channels(); i++) {
         MultiFDRecvParams *p = &multifd_recv_state->params[i];
 
-        if (OBJECT(p->c)->ref == 1) {
-            migration_ioc_unregister_yank(p->c);
-        }
-
+        migration_ioc_unregister_yank(p->c);
         object_unref(OBJECT(p->c));
         p->c = NULL;
         qemu_mutex_destroy(&p->mutex);
Signature · 1 line
2.32.0
#1 lore raw
Quoted 3 lines · Lukas Straub

Unconditionally unregister yank function in multifd_load_cleanup(). If it is not unregistered here, it will leak and cause a crash in yank_unregister_instance().

Curious whether there was a crash somewhere that you hit?

Quoted 7 lines

Now if the ioc is still in use
afterwards, it will only lead to qemu not being able to recover from a hang related to that ioc.

After checking the code, i am pretty sure that ref is always 1 when arriving here. So all this currently does is remove the unneeded check.

Thanks for checking and removing the 2nd ref==1. I wanted to do that but I didn't dare before I look more closely or test more.

The patch looks good to me, it's just that I am not sure whether it suites 6.1 material as we've just released rc2 today. Maybe 6.2 is more suitable?

Quoted 31 lines

---

This is similar to Peter Xu's 39675ffffb3394d44b880d083a214c5e44786170 "migration: Move the yank unregister of channel_close out" in that it removes the "OBJECT(p->c)->ref == 1" hack. So it makes sense for 6.1 so these patches are together.

 migration/multifd.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
migration/multifd.c +1 -4
index 377da78f5b..a37805e17e 100644
@@ -987,10 +987,7 @@ int multifd_load_cleanup(Error **errp)
     for (i = 0; i < migrate_multifd_channels(); i++) {
         MultiFDRecvParams *p = &multifd_recv_state->params[i];
 
-        if (OBJECT(p->c)->ref == 1) {
-            migration_ioc_unregister_yank(p->c);
-        }
-
+        migration_ioc_unregister_yank(p->c);
         object_unref(OBJECT(p->c));
         p->c = NULL;
         qemu_mutex_destroy(&p->mutex);
Signature · 1 line
2.32.0
Signature · 1 line
Peter Xu
#2 lore raw
Quoted 6 lines · On Wed, 4 Aug 2021 15:39:55 -0400 Peter Xu <[email protected]> wrote:
Quoted 3 lines · Lukas Straub

Unconditionally unregister yank function in multifd_load_cleanup(). If it is not unregistered here, it will leak and cause a crash in yank_unregister_instance().

Curious whether there was a crash somewhere that you hit?

No, I just noticed this while working on a different patch.

Quoted 8 lines
Quoted 7 lines

Now if the ioc is still in use
afterwards, it will only lead to qemu not being able to recover from a hang related to that ioc.

After checking the code, i am pretty sure that ref is always 1 when arriving here. So all this currently does is remove the unneeded check.

Quoted 5 lines

Thanks for checking and removing the 2nd ref==1. I wanted to do that but I didn't dare before I look more closely or test more.

The patch looks good to me, it's just that I am not sure whether it suites 6.1 material as we've just released rc2 today. Maybe 6.2 is more suitable?

Yeah, if my assessment of the code is correct it's more of a cleanup.

Quoted 34 lines
Quoted 31 lines

---

This is similar to Peter Xu's 39675ffffb3394d44b880d083a214c5e44786170 "migration: Move the yank unregister of channel_close out" in that it removes the "OBJECT(p->c)->ref == 1" hack. So it makes sense for 6.1 so these patches are together.

 migration/multifd.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
migration/multifd.c +1 -4
index 377da78f5b..a37805e17e 100644
@@ -987,10 +987,7 @@ int multifd_load_cleanup(Error **errp)
     for (i = 0; i < migrate_multifd_channels(); i++) {
         MultiFDRecvParams *p = &multifd_recv_state->params[i];
 
-        if (OBJECT(p->c)->ref == 1) {
-            migration_ioc_unregister_yank(p->c);
-        }
-
+        migration_ioc_unregister_yank(p->c);
         object_unref(OBJECT(p->c));
         p->c = NULL;
         qemu_mutex_destroy(&p->mutex);
Signature · 1 line
2.32.0  
#3 lore raw
In reply to Lukas Straub
Quoted 28 lines · On Wed, 4 Aug 2021 21:26:32 +0200 Lukas Straub <[email protected]> wrote:

Unconditionally unregister yank function in multifd_load_cleanup(). If it is not unregistered here, it will leak and cause a crash in yank_unregister_instance(). Now if the ioc is still in use afterwards, it will only lead to qemu not being able to recover from a hang related to that ioc.

After checking the code, i am pretty sure that ref is always 1 when arriving here. So all this currently does is remove the unneeded check.

---

This is similar to Peter Xu's 39675ffffb3394d44b880d083a214c5e44786170 "migration: Move the yank unregister of channel_close out" in that it removes the "OBJECT(p->c)->ref == 1" hack. So it makes sense for 6.1 so these patches are together.

 migration/multifd.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
migration/multifd.c +0 -0
index 377da78f5b..a37805e17e 100644
@@ -987,10 +987,7 @@ int multifd_load_cleanup(Error **errp)
     for (i = 0; i < migrate_multifd_channels(); i++) {

migration/multifd.c int multifd_load_cleanup(Error **errp) · line 993

Quoted 10 lines
migration/multifd.c +1 -4
         MultiFDRecvParams *p = &multifd_recv_state->params[i];
 
-        if (OBJECT(p->c)->ref == 1) {
-            migration_ioc_unregister_yank(p->c);
-        }
-
+        migration_ioc_unregister_yank(p->c);
         object_unref(OBJECT(p->c));
         p->c = NULL;
         qemu_mutex_destroy(&p->mutex);

ping...

Reviewed-by on v1 1/1
#4 lore raw
In reply to Lukas Straub
Quoted 11 lines · Lukas Straub

Unconditionally unregister yank function in multifd_load_cleanup(). If it is not unregistered here, it will leak and cause a crash in yank_unregister_instance(). Now if the ioc is still in use afterwards, it will only lead to qemu not being able to recover from a hang related to that ioc.

After checking the code, i am pretty sure that ref is always 1 when arriving here. So all this currently does is remove the unneeded check.