Skip to contentSkip to conversation

Fix hanging user monitor when using balloon command

PATCH Applied Adam Litke 4 participants 7 messages Feb 12, 2010 – Mar 8, 2010

lore
Share & tools
lore

Adam Litke

author
#0 lore raw

PATCH 1/1 Fix hanging user monitor when using balloon command

Arghh... Adding missing S-O-B

Hi Anthony. I wonder if there was a problem when importing my async command handler patchset. Since the 'balloon' command completes immediately, it must call the completion callback before returning. That call was missing but is added by the patch below.

monitor.c +1 -0
index ae125b8..f94794d 100644
@@ -2258,6 +2258,7 @@ static int do_balloon(Monitor *mon, const QDict *params,
         return -1;
     }
 
+    cb(opaque, NULL);
     return 0;
 }
 
Signature · 2 lines
Thanks,
Adam
#1 lore raw
Quoted 15 lines · Adam Litke

Arghh... Adding missing S-O-B

Hi Anthony. I wonder if there was a problem when importing my async command handler patchset. Since the 'balloon' command completes immediately, it must call the completion callback before returning. That call was missing but is added by the patch below.

monitor.c +0 -0
index ae125b8..f94794d 100644

monitor.c static int do_balloon(Monitor *mon, const QDict *params, · line 2264

Quoted 7 lines
monitor.c +1 -0
@@ -2258,6 +2258,7 @@ static int do_balloon(Monitor *mon, const QDict *params,
         return -1;
     }
 
+    cb(opaque, NULL);
     return 0;
 }
 

Can we get this patch applied to GIT - without it, QEMU just hangs under libvirt immediately, since we nearly always issue a balloon command at start

Daniel

Signature · 4 lines
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|
#2 lore raw
In reply to Adam Litke
Quoted 9 lines · Adam Litke

Arghh... Adding missing S-O-B

Hi Anthony. I wonder if there was a problem when importing my async command handler patchset. Since the 'balloon' command completes immediately, it must call the completion callback before returning. That call was missing but is added by the patch below.

Applied. Thanks.

Regards,

Anthony Liguori

Quoted 13 lines
monitor.c +1 -0
index ae125b8..f94794d 100644
@@ -2258,6 +2258,7 @@ static int do_balloon(Monitor *mon, const QDict *params,
          return -1;
      }
 
+    cb(opaque, NULL);
      return 0;
  }
 
author
#3 lore raw
Quoted 8 lines · Anthony Liguori
Quoted 7 lines · Adam Litke

Arghh... Adding missing S-O-B

Hi Anthony. I wonder if there was a problem when importing my async command handler patchset. Since the 'balloon' command completes immediately, it must call the completion callback before returning. That call was missing but is added by the patch below.

Quoted 4 lines
Quoted 2 lines

Applied. Thanks.

This patch application failed. My patch adds a cb() call in do_balloon(), but the change in git has added the cb() call to do_info_balloon(). That is causing qemu segfaults. Applying the following should correct the damage. Thanks.

Fix for commit: 5c366a8a3d7ac71beda8499caa815cb3ea95eb58

The cb() call is needed in do_balloon(), not do_info_balloon().

monitor.c +1 -1
index b1a6edc..c7d2117 100644
@@ -2309,7 +2309,6 @@ static int do_info_balloon(Monitor *mon, MonitorCompletion cb, void *opaque)
         return -1;
     }
 
-    cb(opaque, NULL);
     return 0;
 }
 
@@ -2332,6 +2331,7 @@ static int do_balloon(Monitor *mon, const QDict *params,
         return -1;
     }
 
+    cb(opaque, NULL);
     return 0;
 }
 
Signature · 2 lines
Thanks,
Adam
#4 lore raw
Quoted 14 lines · On Mon, 22 Feb 2010 10:51:20 -0600 Adam Litke <[email protected]> wrote:
Quoted 8 lines · Anthony Liguori
Quoted 7 lines · Adam Litke

Arghh... Adding missing S-O-B

Hi Anthony. I wonder if there was a problem when importing my async command handler patchset. Since the 'balloon' command completes immediately, it must call the completion callback before returning. That call was missing but is added by the patch below.

Quoted 4 lines
Quoted 2 lines

Applied. Thanks.

Quoted 8 lines

This patch application failed. My patch adds a cb() call in do_balloon(), but the change in git has added the cb() call to do_info_balloon(). That is causing qemu segfaults. Applying the following should correct the damage. Thanks.

Fix for commit: 5c366a8a3d7ac71beda8499caa815cb3ea95eb58

The cb() call is needed in do_balloon(), not do_info_balloon().

It won't segfault on QMP, but will print a duplicated response on
query-balloon and no success response on balloon.

This patch fixes both. One question, though:

monitor.c static int do_balloon(Monitor *mon, const QDict *params, · line 2336

Quoted 7 lines
monitor.c +1 -0
@@ -2332,6 +2331,7 @@ static int do_balloon(Monitor *mon, const QDict *params,
         return -1;
     }
 
+    cb(opaque, NULL);
     return 0;
 }

Can't (or shouldn't) this be called by common code upon handler
completion?

author
#5 lore raw
Quoted 6 lines · Luiz Capitulino

This patch fixes both. One question, though:

Quoted 4 lines
monitor.c +0 -0
@@ -2332,6 +2331,7 @@ static int do_balloon(Monitor *mon, const QDict *params,
         return -1;
     }
 
Quoted 6 lines

monitor.c static int do_balloon(Monitor *mon, const QDict *params, · line 2336

Quoted 3 lines
monitor.c +1 -0
+    cb(opaque, NULL);
     return 0;
 }

Can't (or shouldn't) this be called by common code upon handler
completion?

The explicit cb() call is only needed for synchronous commands that want to use this API. For asynchronous commands, the top-half (ie. do_info_balloon) returns right away and the callback is called when the asynchronous command completes (in hw/virtio-balloon.c). Since do_balloon() is completely finished when it returns, it has to manually call cb().

If we decide to merge all commands into this new API in the future, then we could have common code call the cb() for all synchronous commands. For now, I just implemented do_balloon() this way as a proof of concept to show that synchronous commands can use the API.

Signature · 2 lines
Thanks,
Adam
#6 lore raw
In reply to Adam Litke
Quoted 11 lines · Adam Litke

This patch application failed. My patch adds a cb() call in do_balloon(), but the change in git has added the cb() call to do_info_balloon(). That is causing qemu segfaults. Applying the following should correct the damage. Thanks.

Fix for commit: 5c366a8a3d7ac71beda8499caa815cb3ea95eb58

The cb() call is needed in do_balloon(), not do_info_balloon().

Applied. Thanks.

Regards,

Anthony Liguori

Quoted 24 lines
monitor.c +1 -1
index b1a6edc..c7d2117 100644
@@ -2309,7 +2309,6 @@ static int do_info_balloon(Monitor *mon, MonitorCompletion cb, void *opaque)
          return -1;
      }
 
-    cb(opaque, NULL);
      return 0;
  }
 
@@ -2332,6 +2331,7 @@ static int do_balloon(Monitor *mon, const QDict *params,
          return -1;
      }
 
+    cb(opaque, NULL);
      return 0;
  }