From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NaZFH-0000dj-4r for qemu-devel@nongnu.org; Thu, 28 Jan 2010 13:37:35 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NaZFC-0000ct-Jn for qemu-devel@nongnu.org; Thu, 28 Jan 2010 13:37:34 -0500 Received: from [199.232.76.173] (port=54971 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NaZFC-0000cq-EX for qemu-devel@nongnu.org; Thu, 28 Jan 2010 13:37:30 -0500 Received: from mx1.redhat.com ([209.132.183.28]:47044) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NaZFB-0004RT-SK for qemu-devel@nongnu.org; Thu, 28 Jan 2010 13:37:30 -0500 Date: Thu, 28 Jan 2010 16:37:16 -0200 From: Luiz Capitulino Subject: Re: [Qemu-devel] [PATCH] New API for asynchronous monitor commands (V2) Message-ID: <20100128163716.11f909ed@doriath> In-Reply-To: <4B61D782.1010800@redhat.com> References: <1264443524.2890.3.camel@aglitke> <4B61D782.1010800@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf Cc: Avi Kivity , qemu-devel@nongnu.org, Adam Litke On Thu, 28 Jan 2010 19:29:22 +0100 Kevin Wolf wrote: > Am 25.01.2010 19:18, schrieb Adam Litke: > > Changes since V1: > > - Miscellaneous code cleanups (Thanks Luiz) > > > > Qemu has a number of commands that can operate asynchronously (savevm, migrate, > > etc) and it will be getting more. For these commands, the user monitor needs > > to be suspended, but QMP monitors could continue to to accept other commands. > > This patch introduces a new command API that isolates the details of handling > > different monitor types from the actual command execution. > > > > A monitor command can use this API by implementing the mhandler.cmd_async > > handler (or info_async if appropriate). This function is responsible for > > submitting the command and does not return any data although it may raise > > errors. When the command completes, the QMPCompletion callback should be > > invoked with its opaque data and the command result. > > > > The process for submitting and completing an asynchronous command is different > > for QMP and user monitors. A user monitor must be suspended at submit time and > > resumed at completion time. The user_print() function must be passed to the > > QMPCompletion callback so the result can be displayed properly. QMP monitors > > are simpler. No submit time setup is required. When the command completes, > > monitor_protocol_emitter() writes the result in JSON format. > > > > This API can also be used to implement synchronous commands. In this case, the > > cmd_async handler should immediately call the QMPCompletion callback. It is my > > hope that this new interface will work for all commands, leading to a > > drastically simplified monitor.c once all commands are ported. > > > > Thanks to Anthony for helping me out with the initial design. > > > > Signed-off-by: Adam Litke > > This commit introduces a segfault on info pci for me. The following > patch seems to make it work again. Is it correct or is rather info pci > doing something wrong? Breaks others 'info' commands as well, I've submitted a proper fix already: http://lists.gnu.org/archive/html/qemu-devel/2010-01/msg01965.html