]> git.ipfire.org Git - thirdparty/libvirt.git/commit
libxl: fix dom0 autoballooning with Xen 4.8
authorJim Fehlig <jfehlig@suse.com>
Tue, 17 Jan 2017 22:11:32 +0000 (15:11 -0700)
committerJim Fehlig <jfehlig@suse.com>
Thu, 2 Feb 2017 17:24:24 +0000 (10:24 -0700)
commitf86a7a837207a1260ff7a8e4469b9057fbde11c8
tree120123bfe42cea33b16550b5ac076c846db5c420
parent5550dde150acb0f704bb8f8afb0cd35cb583d90b
libxl: fix dom0 autoballooning with Xen 4.8

xen.git commit 57f8b13c changed several of the libxl memory
get/set functions to take 64 bit parameters. The libvirt
libxl driver still uses uint32_t variables for these various
parameters, which is particularly problematic for the
libxl_set_memory_target() function.

When dom0 autoballooning is enabled, libvirt (like xl) determines
the memory needed to start a domain and the memory available. If
memory available is less than memory needed, dom0 is ballooned
down by passing a negative value to libxl_set_memory_target()
'target_memkb' parameter. Prior to xen.git commit 57f8b13c,
'target_memkb' was an int32_t. Subtracting a larger uint32 from
a smaller uint32 and assigning it to int32 resulted in a negative
number. After commit 57f8b13c, the same subtraction is widened
to a int64, resulting in a large positive number. The simple
fix taken by this patch is to assign the difference of the
uint32 values to a temporary int32 variable, which is then
passed to 'target_memkb' parameter of libxl_set_memory_target().

Note that it is undesirable to change libvirt to use 64 bit
variables since it requires setting LIBXL_API_VERSION to 0x040800.
Currently libvirt supports LIBXL_API_VERSION >= 0x040400,
essentially Xen >= 4.4.
src/libxl/libxl_domain.c