From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NB9NB-0003Zs-ER for qemu-devel@nongnu.org; Thu, 19 Nov 2009 10:56:41 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NB9N6-0003Tk-9i for qemu-devel@nongnu.org; Thu, 19 Nov 2009 10:56:40 -0500 Received: from [199.232.76.173] (port=47625 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NB9N5-0003TD-VS for qemu-devel@nongnu.org; Thu, 19 Nov 2009 10:56:36 -0500 Received: from e1.ny.us.ibm.com ([32.97.182.141]:47572) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1NB9N5-0001mi-Fx for qemu-devel@nongnu.org; Thu, 19 Nov 2009 10:56:35 -0500 Received: from d01relay03.pok.ibm.com (d01relay03.pok.ibm.com [9.56.227.235]) by e1.ny.us.ibm.com (8.14.3/8.13.1) with ESMTP id nAJFsVBD000361 for ; Thu, 19 Nov 2009 10:54:31 -0500 Received: from d01av03.pok.ibm.com (d01av03.pok.ibm.com [9.56.224.217]) by d01relay03.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id nAJFuYxA096146 for ; Thu, 19 Nov 2009 10:56:34 -0500 Received: from d01av03.pok.ibm.com (loopback [127.0.0.1]) by d01av03.pok.ibm.com (8.14.3/8.13.1/NCO v10.0 AVout) with ESMTP id nAJ5qIkO005582 for ; Thu, 19 Nov 2009 00:52:18 -0500 From: Adam Litke In-Reply-To: <4B056206.4090207@redhat.com> References: <1258643169.3464.3.camel@aglitke> <4B056206.4090207@redhat.com> Content-Type: text/plain; charset="UTF-8" Date: Thu, 19 Nov 2009 09:56:31 -0600 Message-ID: <1258646191.3464.16.camel@aglitke> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] Re: virtio: Report new guest memory statistics pertinent to memory ballooning (V4) List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Avi Kivity Cc: Anthony Liguori , qemu-devel@nongnu.org On Thu, 2009-11-19 at 17:19 +0200, Avi Kivity wrote: > On 11/19/2009 05:06 PM, Adam Litke wrote: > > Avi and Anthony, > > If you agree that I've addressed all outstanding issues, please consider this > > patch for inclusion. Thanks. > > > > > > I'd like to see this (and all other virtio-ABI-modifying patches) first > go into the virtio pci spec, then propagated to guest and host. Where can I find information on the procedure for updating the virtio pci spec? > > Changes since V3: > > - Increase stat field size to 64 bits > > - Report all sizes in kb (not pages) > > > > Why not bytes? It's the most natural unit. The precision for most of these stats (except major and minor faults) is 4kb (at least for Linux guests on the platforms I can think of). I chose kb units to avoid wasting bits. I suppose the 64bit fields are "Bigger than we could ever possibly need (tm)". Others have suggested bytes as well so I will be happy to make the change. > > -static ram_addr_t virtio_balloon_to_target(void *opaque, ram_addr_t target) > > +static void request_stats(VirtIOBalloon *vb) > > +{ > > + vb->stats_requested = 1; > > + reset_stats(vb); > > + monitor_suspend(cur_mon); > > > > You allow the guest to kill a monitor here. Is there a better way to handle asynchronous communication with the guest? > > + virtqueue_push(vb->svq,&vb->stats_vq_elem, vb->stats_vq_offset); > > + virtio_notify(&vb->vdev, vb->svq); > > +} > > + > > > > > > > +typedef struct VirtIOBalloonStat { > > + uint16_t tag; > > + uint64_t val; > > +} VirtIOBalloonStat; > > > > Alignment here depends on word size. This needs to be padded to be > aligned the same way on 32 and 64 bit hosts and guests. ok. I assume that means the structure size must be a multiple of 64 bits in size? -- Thanks, Adam