From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:44754) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QAkGm-00055l-Vz for qemu-devel@nongnu.org; Fri, 15 Apr 2011 10:45:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QAkGj-000234-9w for qemu-devel@nongnu.org; Fri, 15 Apr 2011 10:45:12 -0400 Received: from e3.ny.us.ibm.com ([32.97.182.143]:50996) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QAkGj-00022y-7W for qemu-devel@nongnu.org; Fri, 15 Apr 2011 10:45:09 -0400 Received: from d01relay01.pok.ibm.com (d01relay01.pok.ibm.com [9.56.227.233]) by e3.ny.us.ibm.com (8.14.4/8.13.1) with ESMTP id p3FEO0dt028932 for ; Fri, 15 Apr 2011 10:24:00 -0400 Received: from d01av01.pok.ibm.com (d01av01.pok.ibm.com [9.56.224.215]) by d01relay01.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id p3FEj5g5305694 for ; Fri, 15 Apr 2011 10:45:05 -0400 Received: from d01av01.pok.ibm.com (loopback [127.0.0.1]) by d01av01.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id p3FEj4vh004595 for ; Fri, 15 Apr 2011 10:45:04 -0400 From: Dave Hansen Date: Fri, 15 Apr 2011 07:44:55 -0700 Message-Id: <1302878695-10256-1-git-send-email-dave@linux.vnet.ibm.com> Subject: [Qemu-devel] [PATCH] set VIRTIO_BALLOON_F_MUST_TELL_HOST unconditionally List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Amit Shah , Anthony Liguori , Dave Hansen There's a patch pending on LKML at the moment: http://lkml.org/lkml/2011/4/7/101 The virtio balloon driver has a VIRTIO_BALLOON_F_MUST_TELL_HOST feature bit. As of now, qemu-kvm defines the bit, but doesn't set it. feature bit. Whenever the bit is set, the guest kernel must always tell the host before we free pages back to the allocator. Without this feature, we might free a page (and have another user touch it) while the hypervisor is unprepared for it. But, if the bit is _not_ set, there is no obligation to reverse the order; we're under no obligation to do _anything_. This patch makes the "tell host first" logic the only case. This should make everybody happy, and reduce the amount of untested or untestable code in the kernel. Signed-off-by: Dave Hansen Cc: Amit Shah Cc: Anthony Liguori --- hw/virtio-balloon.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/hw/virtio-balloon.c b/hw/virtio-balloon.c index 1e6be18..71b0864 100644 --- a/hw/virtio-balloon.c +++ b/hw/virtio-balloon.c @@ -198,6 +198,10 @@ static void virtio_balloon_set_config(VirtIODevice *vdev, static uint32_t virtio_balloon_get_features(VirtIODevice *vdev, uint32_t f) { f |= (1 << VIRTIO_BALLOON_F_STATS_VQ); + /* Kernels >= 2.6.40 do this unconditionally, so set + * the bit to make old kernels do the same thing + */ + f |= (1 << VIRTIO_BALLOON_F_MUST_TELL_HOST); return f; } -- 1.6.6.rc0.50.gaf06e9