aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorkfraser@localhost.localdomain <kfraser@localhost.localdomain>2007-07-11 13:03:57 +0100
committerkfraser@localhost.localdomain <kfraser@localhost.localdomain>2007-07-11 13:03:57 +0100
commit4871e12b20d9c720ba781ce6564170bcc97fec27 (patch)
tree308fa8584b5cd5128270ef9b5bdc5b5e48e6cc97 /tools
parent929990b94033a5e32fbe24dce79dd6cdfae1d565 (diff)
downloadxen-4871e12b20d9c720ba781ce6564170bcc97fec27.tar.gz
xen-4871e12b20d9c720ba781ce6564170bcc97fec27.tar.bz2
xen-4871e12b20d9c720ba781ce6564170bcc97fec27.zip
Add new domctl hypercall to expose current heap values. This
functionality is needed for probing how much memory is available in a given node prior to VM creation. Signed-off-by: Ryan Harper <ryanh@us.ibm.com> Signed-off-by: Keir Fraser <keir@xensource.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/libxc/xc_domain.c21
-rw-r--r--tools/libxc/xenctrl.h14
2 files changed, 35 insertions, 0 deletions
diff --git a/tools/libxc/xc_domain.c b/tools/libxc/xc_domain.c
index 11c14247a2..485b260601 100644
--- a/tools/libxc/xc_domain.c
+++ b/tools/libxc/xc_domain.c
@@ -588,6 +588,27 @@ int xc_domain_ioport_permission(int xc_handle,
return do_domctl(xc_handle, &domctl);
}
+int xc_availheap(int xc_handle,
+ int min_width,
+ int max_width,
+ int node,
+ uint64_t *bytes)
+{
+ DECLARE_SYSCTL;
+ int rc;
+
+ sysctl.cmd = XEN_SYSCTL_availheap;
+ sysctl.u.availheap.min_bitwidth = min_width;
+ sysctl.u.availheap.max_bitwidth = max_width;
+ sysctl.u.availheap.node = node;
+
+ rc = xc_sysctl(xc_handle, &sysctl);
+
+ *bytes = sysctl.u.availheap.avail_bytes;
+
+ return rc;
+}
+
int xc_vcpu_setcontext(int xc_handle,
uint32_t domid,
uint32_t vcpu,
diff --git a/tools/libxc/xenctrl.h b/tools/libxc/xenctrl.h
index 6ba6c8b034..93842d4f00 100644
--- a/tools/libxc/xenctrl.h
+++ b/tools/libxc/xenctrl.h
@@ -616,6 +616,20 @@ int xc_get_pfn_type_batch(int xc_handle, uint32_t dom,
/* Get current total pages allocated to a domain. */
long xc_get_tot_pages(int xc_handle, uint32_t domid);
+/**
+ * This function retrieves the the number of bytes available
+ * in the heap in a specific range of address-widths and nodes.
+ *
+ * @parm xc_handle a handle to an open hypervisor interface
+ * @parm domid the domain to query
+ * @parm min_width the smallest address width to query (0 if don't care)
+ * @parm max_width the largest address width to query (0 if don't care)
+ * @parm node the node to query (-1 for all)
+ * @parm *bytes caller variable to put total bytes counted
+ * @return 0 on success, <0 on failure.
+ */
+int xc_availheap(int xc_handle, int min_width, int max_width, int node,
+ uint64_t *bytes);
/*
* Trace Buffer Operations