From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LWXsb-0001LF-Gj for qemu-devel@nongnu.org; Mon, 09 Feb 2009 10:17:01 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LWXsZ-0001K9-0w for qemu-devel@nongnu.org; Mon, 09 Feb 2009 10:17:00 -0500 Received: from [199.232.76.173] (port=57972 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LWXsY-0001K6-P2 for qemu-devel@nongnu.org; Mon, 09 Feb 2009 10:16:58 -0500 Received: from e35.co.us.ibm.com ([32.97.110.153]:39839) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1LWXsY-0001S4-66 for qemu-devel@nongnu.org; Mon, 09 Feb 2009 10:16:58 -0500 Received: from d03relay03.boulder.ibm.com (d03relay03.boulder.ibm.com [9.17.195.228]) by e35.co.us.ibm.com (8.13.1/8.13.1) with ESMTP id n19FDbH3009603 for ; Mon, 9 Feb 2009 08:13:37 -0700 Received: from d03av02.boulder.ibm.com (d03av02.boulder.ibm.com [9.17.195.168]) by d03relay03.boulder.ibm.com (8.13.8/8.13.8/NCO v9.1) with ESMTP id n19FGjYX175048 for ; Mon, 9 Feb 2009 08:16:47 -0700 Received: from d03av02.boulder.ibm.com (loopback [127.0.0.1]) by d03av02.boulder.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id n19FGhub012728 for ; Mon, 9 Feb 2009 08:16:43 -0700 Received: from squirrel.codemonkey.ws (sig-9-65-207-138.mts.ibm.com [9.65.207.138]) by d03av02.boulder.ibm.com (8.12.11.20060308/8.12.11) with ESMTP id n19FGgRi012702 for ; Mon, 9 Feb 2009 08:16:43 -0700 Message-ID: <499048C4.3030603@us.ibm.com> Date: Mon, 09 Feb 2009 09:16:20 -0600 From: Anthony Liguori MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH 14/17] monitor: Decouple terminals References: <20090207181627.13667.9979.stgit@mchn012c.ww002.siemens.net> <20090207181629.13667.20945.stgit@mchn012c.ww002.siemens.net> In-Reply-To: <20090207181629.13667.20945.stgit@mchn012c.ww002.siemens.net> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Jan Kiszka wrote: > Currently all registered (and activate) monitor terminals work in > broadcast mode: Everyone sees what someone else types on some other > terminal and what the monitor reports back. This model is broken when > you have a management monitor terminal that is automatically operated > and some other terminal used for independent guest inspection. Such an > additional terminal can be a multiplexed device channel or a gdb > frontend connected to QEMU's stub. > > Therefor, this patch decouples the buffers and states of all monitor > terminals, allowing the user to operate them independently. The basic > idea is stolen from Jason Wessel: When starting to handle a monitor > command or some terminal event, the current monitor terminal is set to > the one associated with the underlying char device, letting all > succeeding monitor_printf show up on only this selected terminal. > > There are still two asynchronous monitor writers: some error reporting > in VNC's audio_add and the log-to-monitor feature of the audio > subsystem. That concerns me. Nothing should output to the monitor asychronously. I'd like to see a few changes to make things a bit closer to the long term goals for the monitor (having proper multiple monitors devoid of global state). Here's what I'd suggest: 1) Make monitor_printf() take a monitor state. The easiest thing to do would be to introduce this in your previous rename patch making everything use current_monitor. 2) Introduce current_monitor and default_monitor global variables. They map to what you describe above and should be maintained as such. 3) Make all monitor callbacks take a monitor state 4) Convert monitor_printf()s called from monitor callbacks to use the passed monitor state 5) Eliminate all uses of current_monitor/default_monitor. I'd say, 1 and 2 are required for this patchset. I think 3 and 4 would be pretty easy to add to your patchset. I think 5 is probably tougher and could wait for another day. Regards, Anthony Liguori