tools/libxl: detect and avoid conflicts with RDM
authorTiejun Chen <tiejun.chen@intel.com>
Wed, 22 Jul 2015 01:40:07 +0000 (01:40 +0000)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Thu, 23 Jul 2015 12:45:25 +0000 (13:45 +0100)
commit25652f232cbee8f4c6c740c86e9f12b45fa655e9
tree97d0837d1b4448a094c5a701f9073c49fa198f77
parent63bc1398ad28a67a67ce156231a0bfa72608263d
tools/libxl: detect and avoid conflicts with RDM

While building a VM, HVM domain builder provides struct hvm_info_table{}
to help hvmloader. Currently it includes two fields to construct guest
e820 table by hvmloader, low_mem_pgend and high_mem_pgend. So we should
check them to fix any conflict with RDM.

RMRR can reside in address space beyond 4G theoretically, but we never
see this in real world. So in order to avoid breaking highmem layout
we don't solve highmem conflict. Note this means highmem rmrr could still
be supported if no conflict.

But in the case of lowmem, RMRR probably scatter the whole RAM space.
Especially multiple RMRR entries would worsen this to lead a complicated
memory layout. And then its hard to extend hvm_info_table{} to work
hvmloader out. So here we're trying to figure out a simple solution to
avoid breaking existing layout. So when a conflict occurs,

    #1. Above a predefined boundary (2G)
        - move lowmem_end below reserved region to solve conflict;

    #2. Below a predefined boundary (2G)
        - Check strict/relaxed policy.
        "strict" policy leads to fail libxl. Note when both policies
        are specified on a given region, 'strict' is always preferred.
        "relaxed" policy issue a warning message and also mask this entry INVALID
        to indicate we shouldn't expose this entry to hvmloader.

Note later we need to provide a parameter to set that predefined boundary
dynamically.

CC: Ian Jackson <ian.jackson@eu.citrix.com>
CC: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
CC: Ian Campbell <ian.campbell@citrix.com>
CC: Wei Liu <wei.liu2@citrix.com>
Signed-off-by: Tiejun Chen <tiejun.chen@intel.com>
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
---
v13a: Change `flag' to `flags' in libxl__xc_device_get_rdm.
     No functional change.  [ Suggested by Tiejun Chen. ]
v13: Mechanical changes to deal with changes to patch 01/
     XENMEM_reserved_device_memory_map.
tools/libxl/libxl_create.c
tools/libxl/libxl_dm.c
tools/libxl/libxl_dom.c
tools/libxl/libxl_internal.h
tools/libxl/libxl_types.idl