ia64/xen-unstable

diff tools/libxc/xenguest.h @ 19639:205b1badbcfd

Add support for superpages (hugepages) in PV domain

This patch adds the option "superpages" to the domain configuration
file. If it is set, the domain is populated using 2M pages.

This code does not support fallback to small pages. If the domain can
not be created with 2M pages, the create will fail.

The patch also includes support for saving and restoring domains with
the superpage flag set. However, if a domain has freed small pages
within its physical page array and then extended the array, the
restore will fill in those freed pages. It will then attempt to
allocate more than its memory limit and will fail. This is
significant because apparently Linux does this during boot, thus a
freshly booted Linux image can not be saved and restored successfully.

Signed-off-by: Dave McCracken <dcm@mccr.org>
author Keir Fraser <keir.fraser@citrix.com>
date Tue May 26 09:58:38 2009 +0100 (2009-05-26)
parents a5f497f02e34
children 84c1f7c46444
line diff
     1.1 --- a/tools/libxc/xenguest.h	Tue May 26 09:54:53 2009 +0100
     1.2 +++ b/tools/libxc/xenguest.h	Tue May 26 09:58:38 2009 +0100
     1.3 @@ -40,12 +40,13 @@ int xc_domain_save(int xc_handle, int io
     1.4   * @parm store_mfn returned with the mfn of the store page
     1.5   * @parm hvm non-zero if this is a HVM restore
     1.6   * @parm pae non-zero if this HVM domain has PAE support enabled
     1.7 + * @parm superpages non-zero to allocate guest memory with superpages
     1.8   * @return 0 on success, -1 on failure
     1.9   */
    1.10  int xc_domain_restore(int xc_handle, int io_fd, uint32_t dom,
    1.11                        unsigned int store_evtchn, unsigned long *store_mfn,
    1.12                        unsigned int console_evtchn, unsigned long *console_mfn,
    1.13 -                      unsigned int hvm, unsigned int pae);
    1.14 +                      unsigned int hvm, unsigned int pae, int superpages);
    1.15  
    1.16  /**
    1.17   * This function will create a domain for a paravirtualized Linux
    1.18 @@ -62,6 +63,7 @@ int xc_domain_restore(int xc_handle, int
    1.19   * @parm store_mfn returned with the mfn of the store page
    1.20   * @parm console_evtchn the console event channel for this domain to use
    1.21   * @parm conole_mfn returned with the mfn of the console page
    1.22 + * @parm superpages populate memory in guest with superpages
    1.23   * @return 0 on success, -1 on failure
    1.24   */
    1.25  int xc_linux_build(int xc_handle,
    1.26 @@ -75,7 +77,8 @@ int xc_linux_build(int xc_handle,
    1.27                     unsigned int store_evtchn,
    1.28                     unsigned long *store_mfn,
    1.29                     unsigned int console_evtchn,
    1.30 -                   unsigned long *console_mfn);
    1.31 +                   unsigned long *console_mfn,
    1.32 +	           int superpages);
    1.33  
    1.34  /** The same interface, but the dom structure is managed by the caller */
    1.35  struct xc_dom_image;
    1.36 @@ -89,7 +92,8 @@ int xc_dom_linux_build(int xc_handle,
    1.37  		       unsigned int store_evtchn,
    1.38  		       unsigned long *store_mfn,
    1.39  		       unsigned int console_evtchn,
    1.40 -		       unsigned long *console_mfn);
    1.41 +		       unsigned long *console_mfn,
    1.42 +                       int superpages);
    1.43  
    1.44  /**
    1.45   * This function will create a domain for a paravirtualized Linux
    1.46 @@ -108,6 +112,7 @@ int xc_dom_linux_build(int xc_handle,
    1.47   * @parm store_mfn returned with the mfn of the store page
    1.48   * @parm console_evtchn the console event channel for this domain to use
    1.49   * @parm conole_mfn returned with the mfn of the console page
    1.50 + * @parm superpages populate memory in guest with superpages
    1.51   * @return 0 on success, -1 on failure
    1.52   */
    1.53  int xc_linux_build_mem(int xc_handle,
    1.54 @@ -123,7 +128,8 @@ int xc_linux_build_mem(int xc_handle,
    1.55                         unsigned int store_evtchn,
    1.56                         unsigned long *store_mfn,
    1.57                         unsigned int console_evtchn,
    1.58 -                       unsigned long *console_mfn);
    1.59 +                       unsigned long *console_mfn,
    1.60 +                       int superpages);
    1.61  
    1.62  int xc_hvm_build(int xc_handle,
    1.63                   uint32_t domid,