qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] set VIRTIO_BALLOON_F_MUST_TELL_HOST uncondition


From: Anthony Liguori
Subject: Re: [Qemu-devel] [PATCH] set VIRTIO_BALLOON_F_MUST_TELL_HOST unconditionally
Date: Fri, 15 Apr 2011 11:21:39 -0500
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.15) Gecko/20110411 Lightning/1.0b2 Thunderbird/3.1.9

On 04/15/2011 09:44 AM, Dave Hansen wrote:
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.

It doesn't make me happy.

Why would we do this in QEMU? This prevents the guest from doing ballooning reclaim during OOM.

Regards,

Anthony Liguori

Signed-off-by: Dave Hansen<address@hidden>
Cc: Amit Shah<address@hidden>
Cc: Anthony Liguori<address@hidden>
---
  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;
  }





reply via email to

[Prev in Thread] Current Thread [Next in Thread]