From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Nl741-0006fc-Dm for qemu-devel@nongnu.org; Fri, 26 Feb 2010 15:45:33 -0500 Received: from [199.232.76.173] (port=60925 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Nl740-0006fN-3Q for qemu-devel@nongnu.org; Fri, 26 Feb 2010 15:45:32 -0500 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1Nl73z-0006N2-9m for qemu-devel@nongnu.org; Fri, 26 Feb 2010 15:45:31 -0500 Received: from e33.co.us.ibm.com ([32.97.110.151]:50389) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Nl73y-0006LZ-V7 for qemu-devel@nongnu.org; Fri, 26 Feb 2010 15:45:31 -0500 Received: from d03relay04.boulder.ibm.com (d03relay04.boulder.ibm.com [9.17.195.106]) by e33.co.us.ibm.com (8.14.3/8.13.1) with ESMTP id o1QKfmPW007595 for ; Fri, 26 Feb 2010 13:41:48 -0700 Received: from d03av04.boulder.ibm.com (d03av04.boulder.ibm.com [9.17.195.170]) by d03relay04.boulder.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id o1QKj0VJ106690 for ; Fri, 26 Feb 2010 13:45:03 -0700 Received: from d03av04.boulder.ibm.com (loopback [127.0.0.1]) by d03av04.boulder.ibm.com (8.14.3/8.13.1/NCO v10.0 AVout) with ESMTP id o1QKj0EX005547 for ; Fri, 26 Feb 2010 13:45:00 -0700 Subject: Re: [Qemu-devel] [PATCH] Fix hanging user monitor when using balloon command From: Adam Litke In-Reply-To: <20100226172617.7e037e1e@redhat.com> References: <1266008156.3474.18.camel@aglitke> <4B7F070A.9010100@codemonkey.ws> <1266857480.3174.10.camel@aglitke> <20100226172617.7e037e1e@redhat.com> Content-Type: text/plain; charset="UTF-8" Date: Fri, 26 Feb 2010 14:44:58 -0600 Message-ID: <1267217098.3308.6.camel@aglitke> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Luiz Capitulino Cc: qemu-devel@nongnu.org On Fri, 2010-02-26 at 17:26 -0300, Luiz Capitulino wrote: > This patch fixes both. One question, though: > > > @@ -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? 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. -- Thanks, Adam