virtio-balloon: Use temporary PBP only
commita8cd64d488325f3be5c4ddec4bf07efb3b8c7330
authorDavid Hildenbrand <david@redhat.com>
Mon, 22 Jul 2019 13:41:08 +0000 (22 15:41 +0200)
committerMichael S. Tsirkin <mst@redhat.com>
Thu, 25 Jul 2019 11:58:03 +0000 (25 07:58 -0400)
tree8d92a395551235aee86c12bfff23efa30ecb80e0
parent1c5cfc2b7153dd72bf4b8ddc456408eb2b9b66d8
virtio-balloon: Use temporary PBP only

We still have multiple issues in the current code
- The PBP is not freed during unrealize()
- The PBP is not reset on device resets: After a reset, the PBP is stale.
- We are not indicating VIRTIO_BALLOON_F_MUST_TELL_HOST, therefore
  guests (esp. legacy guests) will reuse pages without deflating,
  turning the PBP stale. Adding that would require compat handling.

Instead, let's use the PBP only temporarily, when processing one bulk of
inflation requests. This will keep guest_page_size > 4k working (with
Linux guests). There is nothing to do for deflation requests anymore.
The pbp is only used for a limited amount of time.

Fixes: ed48c59875b6 ("virtio-balloon: Safely handle BALLOON_PAGE_SIZE < host page size")
Cc: qemu-stable@nongnu.org #v4.0.0
Suggested-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20190722134108.22151-7-david@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
hw/virtio/virtio-balloon.c
include/hw/virtio/virtio-balloon.h