mbox series

[v4,0/3] Hyper-V Dynamic Memory Protocol driver (hv-balloon

Message ID cover.1682584770.git.maciej.szmigiero@oracle.com (mailing list archive)
Headers show
Series Hyper-V Dynamic Memory Protocol driver (hv-balloon | expand

Message

Maciej S. Szmigiero April 27, 2023, 9:08 a.m. UTC
From: "Maciej S. Szmigiero" <maciej.szmigiero@oracle.com>

This is a continuation of v3 patch series located here:
https://lore.kernel.org/qemu-devel/cover.1677274611.git.maciej.szmigiero@oracle.com/

Since v3 was just a rebase a more detailed description of this driver is
available in the cover letter of v2:
https://lore.kernel.org/qemu-devel/cover.1672878904.git.maciej.szmigiero@oracle.com/

Changes from v3:
* Convert the driver to directly take just a single memory backend,

* Remove virtual DIMMs support, make the driver directly implement
TYPE_MEMORY_DEVICE interface,

* Allow hot-adding just parts of that single memory backend instead of
always adding the whole backend,

* Integrate the hot-add functionality transparently into the ballooning
interface instead of having a dedicated QMP hot-add command,

* Additional comments and minor cleanups.


Updated example usage:
* Add "-device vmbus-bridge,id=vmbus-bridge \
  -object memory-backend-ram,id=mem1,size=256G \
  -device hv-balloon,id=hvb,memdev=mem1"
  to the QEMU command line and set "maxmem" value to something large,
  like 1T.

The examples below assume that the guest boot memory size was 4 GiB.

* Use QEMU HMP "balloon" command to resize guest up to 8 GiB:
  balloon 8192
  This will cause the driver to hot-add the first 4 GiB of the memory
  backend.

* Use the ballooning interface to ask the guest to give out as much
  memory as possible:
  balloon 1

* Use the ballooning interface to resize the guest up again to 10 GiB:
  balloon 10240
  This will cause the driver to first return all ballooned out pages
  to the guest and then hot-add next 2 GiB of the memory backend.

* Further ballooning interface monitor commands can be used to resize
  the guest up and down appropriately.

* The current guest size can be queried by issuing the "info balloon" command.
  This is useful to know what is happening, since large ballooning or
  unballooning operations take some time to complete.

 Kconfig.host                     |    3 +
 configure                        |   36 +
 hw/hyperv/Kconfig                |    5 +
 hw/hyperv/hv-balloon.c           | 2040 ++++++++++++++++++++++++++++++
 hw/hyperv/meson.build            |    1 +
 hw/hyperv/trace-events           |   16 +
 include/hw/hyperv/dynmem-proto.h |  423 +++++++
 include/qapi/error.h             |    2 +
 meson.build                      |    4 +-
 qapi/machine.json                |   25 +
 10 files changed, 2554 insertions(+), 1 deletion(-)
 create mode 100644 hw/hyperv/hv-balloon.c
 create mode 100644 include/hw/hyperv/dynmem-proto.h