virtio-balloon: Rework pbp tracking data
commit1c5cfc2b7153dd72bf4b8ddc456408eb2b9b66d8
authorDavid Hildenbrand <david@redhat.com>
Mon, 22 Jul 2019 13:41:07 +0000 (22 15:41 +0200)
committerMichael S. Tsirkin <mst@redhat.com>
Thu, 25 Jul 2019 11:57:59 +0000 (25 07:57 -0400)
treefc172d83cee40c6672288b36de529de016ec1851
parente6129b271b9dccca22c84870e313c315f2c70063
virtio-balloon: Rework pbp tracking data

Using the address of a RAMBlock to test for a matching pbp is not really
safe. Instead, let's use the guest physical address of the base page
along with the page size (via the number of subpages).

Also, let's allocate the bitmap separately. This makes the code
easier to read and maintain - we can reuse bitmap_new().

Prepare the code to move the PBP out of the device.

Fixes: ed48c59875b6 ("virtio-balloon: Safely handle BALLOON_PAGE_SIZE < host page size")
Fixes: b27b32391404 ("virtio-balloon: Fix possible guest memory corruption with inflates & deflates")
Cc: qemu-stable@nongnu.org #v4.0.0
Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20190722134108.22151-6-david@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
hw/virtio/virtio-balloon.c