qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Dave Hansen <dave@linux.vnet.ibm.com>
To: qemu-devel@nongnu.org
Cc: Amit Shah <amit.shah@redhat.com>,
	Anthony Liguori <aliguori@linux.vnet.ibm.com>,
	Dave Hansen <dave@linux.vnet.ibm.com>
Subject: [Qemu-devel] [PATCH] set VIRTIO_BALLOON_F_MUST_TELL_HOST unconditionally
Date: Fri, 15 Apr 2011 07:44:55 -0700	[thread overview]
Message-ID: <1302878695-10256-1-git-send-email-dave@linux.vnet.ibm.com> (raw)

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 <dave@linux.vnet.ibm.com>
Cc: Amit Shah <amit.shah@redhat.com>
Cc: Anthony Liguori <aliguori@linux.vnet.ibm.com>
---
 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

             reply	other threads:[~2011-04-15 14:45 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-15 14:44 Dave Hansen [this message]
2011-04-15 16:21 ` [Qemu-devel] [PATCH] set VIRTIO_BALLOON_F_MUST_TELL_HOST unconditionally Anthony Liguori
2011-04-15 16:36   ` Dave Hansen
2011-04-15 17:17     ` Anthony Liguori
2011-04-15 19:15       ` Dave Hansen
2011-04-15 19:20         ` Anthony Liguori
2011-04-18 15:37           ` Dave Hansen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1302878695-10256-1-git-send-email-dave@linux.vnet.ibm.com \
    --to=dave@linux.vnet.ibm.com \
    --cc=aliguori@linux.vnet.ibm.com \
    --cc=amit.shah@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).