Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NV8RR-0008Dz-Sk for qemu-devel@nongnu.org; Wed, 13 Jan 2010 13:59:42 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NV8RN-00085t-Fa for qemu-devel@nongnu.org; Wed, 13 Jan 2010 13:59:41 -0500 Received: from [199.232.76.173] (port=38861 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NV8RN-00085h-9u for qemu-devel@nongnu.org; Wed, 13 Jan 2010 13:59:37 -0500 Received: from e3.ny.us.ibm.com ([32.97.182.143]:44677) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1NV8RM-0003lS-KB for qemu-devel@nongnu.org; Wed, 13 Jan 2010 13:59:37 -0500 Received: from d01relay07.pok.ibm.com (d01relay07.pok.ibm.com [9.56.227.147]) by e3.ny.us.ibm.com (8.14.3/8.13.1) with ESMTP id o0DInXgM007679 for ; Wed, 13 Jan 2010 13:49:33 -0500 Received: from d01av04.pok.ibm.com (d01av04.pok.ibm.com [9.56.224.64]) by d01relay07.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id o0DIxRCP2044084 for ; Wed, 13 Jan 2010 13:59:27 -0500 Received: from d01av04.pok.ibm.com (loopback [127.0.0.1]) by d01av04.pok.ibm.com (8.14.3/8.13.1/NCO v10.0 AVout) with ESMTP id o0DIxRnI008124 for ; Wed, 13 Jan 2010 13:59:27 -0500 From: Adam Litke In-Reply-To: <20100113160422.32041171@doriath> References: <1263236975.2765.6.camel@aglitke> <20100113160422.32041171@doriath> Content-Type: text/plain; charset="UTF-8" Date: Wed, 13 Jan 2010 12:59:25 -0600 Message-ID: <1263409165.3376.12.camel@aglitke> Mime-Version: 1.0 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: Luiz Capitulino Cc: Anthony Liguori , Avi Kivity , qemu-devel@nongnu.org On Wed, 2010-01-13 at 16:04 -0200, Luiz Capitulino wrote: > I've tried to apply this patch to play with it, but turns out it conflicts > with recent changes in hw/virtio-balloon. Ahh, I will continue my never-ending quest to stay current :) > Some comments on the QMP side of the patch follows. Thanks for your review! > > +/* > > + * 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. * > > + if (monitor_ctrl_mode(mon)) > > + mode = QEMU_BALLOON_MODE_ASYNC; > > + else > > + > > + mode = monitor_ctrl_mode(mon) ? > > + QEMU_BALLOON_MODE_ASYNC : QEMU_BALLOON_MODE_SYNC; > > I think what you want is: > > } else { > mode = QEMU_BALLOON_MODE_SYNC; > } Bah... Left over gunk. > > -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. -- Thanks, Adam