linux/drivers/virtio
Wei Wang 86a559787e virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_HINT
Negotiation of the VIRTIO_BALLOON_F_FREE_PAGE_HINT feature indicates the
support of reporting hints of guest free pages to host via virtio-balloon.
Currenlty, only free page blocks of MAX_ORDER - 1 are reported. They are
obtained one by one from the mm free list via the regular allocation
function.

Host requests the guest to report free page hints by sending a new cmd id
to the guest via the free_page_report_cmd_id configuration register. When
the guest starts to report, it first sends a start cmd to host via the
free page vq, which acks to host the cmd id received. When the guest
finishes reporting free pages, a stop cmd is sent to host via the vq.
Host may also send a stop cmd id to the guest to stop the reporting.

VIRTIO_BALLOON_CMD_ID_STOP: Host sends this cmd to stop the guest
reporting.
VIRTIO_BALLOON_CMD_ID_DONE: Host sends this cmd to tell the guest that
the reported pages are ready to be freed.

Why does the guest free the reported pages when host tells it is ready to
free?
This is because freeing pages appears to be expensive for live migration.
free_pages() dirties memory very quickly and makes the live migraion not
converge in some cases. So it is good to delay the free_page operation
when the migration is done, and host sends a command to guest about that.

Why do we need the new VIRTIO_BALLOON_CMD_ID_DONE, instead of reusing
VIRTIO_BALLOON_CMD_ID_STOP?
This is because live migration is usually done in several rounds. At the
end of each round, host needs to send a VIRTIO_BALLOON_CMD_ID_STOP cmd to
the guest to stop (or say pause) the reporting. The guest resumes the
reporting when it receives a new command id at the beginning of the next
round. So we need a new cmd id to distinguish between "stop reporting" and
"ready to free the reported pages".

TODO:
- Add a batch page allocation API to amortize the allocation overhead.

Signed-off-by: Wei Wang <wei.w.wang@intel.com>
Signed-off-by: Liang Li <liang.z.li@intel.com>
Cc: Michael S. Tsirkin <mst@redhat.com>
Cc: Michal Hocko <mhocko@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2018-10-24 20:57:55 -04:00
..
Kconfig virtio: make VIRTIO a menuconfig to ease disabling it all 2018-02-01 16:26:43 +02:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
virtio.c virtio: split device_register into device_initialize and device_add 2018-02-01 16:26:45 +02:00
virtio_balloon.c virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_HINT 2018-10-24 20:57:55 -04:00
virtio_input.c virtio: wrap find_vqs 2017-05-02 23:41:42 +03:00
virtio_mmio.c virtio: mmio-v1: Validate queue PFN 2018-08-22 00:56:56 +03:00
virtio_pci_common.c virtio: Make vp_set_vq_affinity() take a mask. 2018-08-11 12:02:18 -07:00
virtio_pci_common.h virtio: Make vp_set_vq_affinity() take a mask. 2018-08-11 12:02:18 -07:00
virtio_pci_legacy.c virtio: pci-legacy: Validate queue pfn 2018-08-22 00:56:58 +03:00
virtio_pci_modern.c virtio_pci: support enabling VFs 2018-06-12 04:59:29 +03:00
virtio_ring.c treewide: kmalloc() -> kmalloc_array() 2018-06-12 16:19:22 -07:00