Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NV8YI-0001L8-Iv for qemu-devel@nongnu.org; Wed, 13 Jan 2010 14:06:46 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NV8YE-0001Kp-Ic for qemu-devel@nongnu.org; Wed, 13 Jan 2010 14:06:46 -0500 Received: from [199.232.76.173] (port=51170 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NV8YE-0001Km-FV for qemu-devel@nongnu.org; Wed, 13 Jan 2010 14:06:42 -0500 Received: from mx20.gnu.org ([199.232.41.8]:13938) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1NV8YB-0004vv-FR for qemu-devel@nongnu.org; Wed, 13 Jan 2010 14:06:42 -0500 Received: from mx1.redhat.com ([209.132.183.28]) by mx20.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NV8XX-0001Dc-Uw for qemu-devel@nongnu.org; Wed, 13 Jan 2010 14:06:00 -0500 Date: Wed, 13 Jan 2010 17:05:35 -0200 From: Luiz Capitulino Message-ID: <20100113170535.5d7b0c9a@doriath> In-Reply-To: <1263409165.3376.12.camel@aglitke> References: <1263236975.2765.6.camel@aglitke> <20100113160422.32041171@doriath> <1263409165.3376.12.camel@aglitke> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] Re: virtio: Add memory statistics reporting to the balloon driver (V6) List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Adam Litke Cc: Anthony Liguori , Avi Kivity , qemu-devel@nongnu.org On Wed, 13 Jan 2010 12:59:25 -0600 Adam Litke wrote: > > > +/* > > > + * complete_stats_request - Clean up and report statistics. > > > + */ > > > +static void complete_stats_request(VirtIOBalloon *vb) > > > +{ > > > + QObject *stats = get_stats_qobject(vb); > > > + > > > + if (vb->stats_request_mode == QEMU_BALLOON_MODE_SYNC) { > > > + qemu_del_timer(vb->stats_timer); > > > + monitor_print_balloon(cur_mon, stats); > > > + monitor_resume(cur_mon); > > > + } else if (vb->stats_request_mode == QEMU_BALLOON_MODE_ASYNC) { > > > + monitor_protocol_event(QEVENT_BALLOON, stats); > > > + } > > > + > > > + vb->stats_request_mode = QEMU_BALLOON_MODE_NONE; > > > +} > > > > In the previous thread Anthony raised some issues about the 'cur_mon' > > usage that made me concerned, because some important code rely on > > it (read async events). > > > > As far as I could check, 'cur_mon' is guaranteed to be the default > > Monitor which is fine if you're aware of it when putting QEMU to run, > > but I'm afraid that testing your patch with two Monitors (user and qmp) > > is not going to work. > > > > Maybe not a big deal, but would be good to be aware of potential > > issues. > > I talked to Anthony and will try to fix this up. I just need to start > passing the monitor pointer around as well. After doing that you could help us improving the Monitor and check the other cur_mon usages too :) > > > -void qemu_balloon(ram_addr_t target) > > > +int qemu_balloon(ram_addr_t target) > > > { > > > - if (qemu_balloon_event) > > > - qemu_balloon_event(qemu_balloon_event_opaque, target); > > > + if (qemu_balloon_event) { > > > + qemu_balloon_event(qemu_balloon_event_opaque, target, > > > + QEMU_BALLOON_MODE_SYNC); > > > + return 1; > > > + } else { > > > + return 0; > > > + } > > > } > > > > This is used by do_balloon() right? Which is also used by QMP, > > shouldn't it also handle async vs. sync? > > qemu_balloon always acts synchronously. It does not wait on the guest > to do anything and it does not return data. Fine then.