From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1L8LqY-0002Fa-Ui for qemu-devel@nongnu.org; Thu, 04 Dec 2008 16:34:55 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1L8LqX-0002EZ-Ba for qemu-devel@nongnu.org; Thu, 04 Dec 2008 16:34:54 -0500 Received: from [199.232.76.173] (port=50691 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1L8LqX-0002EP-6q for qemu-devel@nongnu.org; Thu, 04 Dec 2008 16:34:53 -0500 Received: from e8.ny.us.ibm.com ([32.97.182.138]:41943) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1L8LqW-0006YM-Od for qemu-devel@nongnu.org; Thu, 04 Dec 2008 16:34:52 -0500 Received: from d01relay02.pok.ibm.com (d01relay02.pok.ibm.com [9.56.227.234]) by e8.ny.us.ibm.com (8.13.1/8.13.1) with ESMTP id mB4LUFv4021322 for ; Thu, 4 Dec 2008 16:30:15 -0500 Received: from d01av02.pok.ibm.com (d01av02.pok.ibm.com [9.56.224.216]) by d01relay02.pok.ibm.com (8.13.8/8.13.8/NCO v9.1) with ESMTP id mB4LYpLR183212 for ; Thu, 4 Dec 2008 16:34:51 -0500 Received: from d01av02.pok.ibm.com (loopback [127.0.0.1]) by d01av02.pok.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id mB4LYNC6019628 for ; Thu, 4 Dec 2008 16:34:23 -0500 Subject: Re: [Qemu-devel] [5874] Add virtio-balloon support From: Hollis Blanchard In-Reply-To: References: Content-Type: text/plain Date: Thu, 04 Dec 2008 15:34:50 -0600 Message-Id: <1228426490.19459.44.camel@localhost.localdomain> Mime-Version: 1.0 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 Cc: Rusty Russell , kvm-devel On Thu, 2008-12-04 at 20:33 +0000, Anthony Liguori wrote: > > +static void balloon_page(void *addr, int deflate) > +{ > +#if defined(__linux__) > + if (!kvm_enabled() || kvm_has_sync_mmu()) > + madvise(addr, TARGET_PAGE_SIZE, > + deflate ? MADV_WILLNEED : MADV_DONTNEED); > +#endif > +} Hmm, I just noticed this... we need to use VIRTIO_BALLOON_PFN_SHIFT like Rusty did on the kernel side. However, in general I'm not sure how this is supposed to work. Isn't it true that madvise() is a no-op if 0 < length < getpagesize()? If so, how should the guest know the chunk size needed on the host? What happens when a guest tries to balloon 4K pages when it's backed on the host by hugetlbfs? We can't even use getpagesize() there. Maybe the virtio balloon interface needs to advertise a unit size from the host, and use that size instead of alloc_page() in the guest? -- Hollis Blanchard IBM Linux Technology Center