@@ -587,6 +587,11 @@ which are incompatible with migration. Currently this is limited to
enabling the invariant TSC feature flag in CPUID results when TSC is
not emulated.
+=item B<noidentpt=BOOLEAN>
+
+Disable the creation of the Identity-map Pagetable that was required to run HVM
+guests on Intel CPUs with EPT where no unrestricted guest mode was available.
+
=item B<driver_domain=BOOLEAN>
Specify that this domain is a driver domain. This enables certain
@@ -26,6 +26,7 @@
#define XCFLAGS_LIVE (1 << 0)
#define XCFLAGS_DEBUG (1 << 1)
+#define XCFLAGS_NOIDENTPT (1 << 2)
#define X86_64_B_SIZE 64
#define X86_32_B_SIZE 32
@@ -718,20 +718,23 @@ static int alloc_magic_pages_hvm(struct xc_dom_image *dom)
goto out;
}
- /*
- * Identity-map page table is required for running with CR0.PG=0 when
- * using Intel EPT. Create a 32-bit non-PAE page directory of superpages.
- */
- if ( (ident_pt = xc_map_foreign_range(
- xch, domid, PAGE_SIZE, PROT_READ | PROT_WRITE,
- special_pfn(SPECIALPAGE_IDENT_PT))) == NULL )
- goto error_out;
- for ( i = 0; i < PAGE_SIZE / sizeof(*ident_pt); i++ )
- ident_pt[i] = ((i << 22) | _PAGE_PRESENT | _PAGE_RW | _PAGE_USER |
- _PAGE_ACCESSED | _PAGE_DIRTY | _PAGE_PSE);
- munmap(ident_pt, PAGE_SIZE);
- xc_hvm_param_set(xch, domid, HVM_PARAM_IDENT_PT,
- special_pfn(SPECIALPAGE_IDENT_PT) << PAGE_SHIFT);
+ if ( !(dom->flags & XCFLAGS_NOIDENTPT) )
+ {
+ /*
+ * Identity-map page table is required for running with CR0.PG=0 when
+ * using Intel EPT. Create a 32-bit non-PAE page directory of superpages.
+ */
+ if ( (ident_pt = xc_map_foreign_range(
+ xch, domid, PAGE_SIZE, PROT_READ | PROT_WRITE,
+ special_pfn(SPECIALPAGE_IDENT_PT))) == NULL )
+ goto error_out;
+ for ( i = 0; i < PAGE_SIZE / sizeof(*ident_pt); i++ )
+ ident_pt[i] = ((i << 22) | _PAGE_PRESENT | _PAGE_RW | _PAGE_USER |
+ _PAGE_ACCESSED | _PAGE_DIRTY | _PAGE_PSE);
+ munmap(ident_pt, PAGE_SIZE);
+ xc_hvm_param_set(xch, domid, HVM_PARAM_IDENT_PT,
+ special_pfn(SPECIALPAGE_IDENT_PT) << PAGE_SHIFT);
+ }
dom->console_pfn = special_pfn(SPECIALPAGE_CONSOLE);
xc_clear_domain_page(dom->xch, dom->guest_domid, dom->console_pfn);
@@ -256,6 +256,8 @@ int libxl__domain_build_info_setdefault(libxl__gc *gc,
libxl_defbool_setdefault(&b_info->disable_migrate, false);
+ libxl_defbool_setdefault(&b_info->disable_identpt, false);
+
for (i = 0 ; i < b_info->num_iomem; i++)
if (b_info->iomem[i].gfn == LIBXL_INVALID_GFN)
b_info->iomem[i].gfn = b_info->iomem[i].start;
@@ -1126,6 +1126,8 @@ int libxl__build_hvm(libxl__gc *gc, uint32_t domid,
dom->console_domid = state->console_domid;
dom->xenstore_domid = state->store_domid;
+ dom->flags |= libxl_defbool_val(info->disable_identpt) ? XCFLAGS_NOIDENTPT : 0;
+
rc = libxl__domain_device_construct_rdm(gc, d_config,
info->u.hvm.rdm_mem_boundary_memkb*1024,
dom);
@@ -508,6 +508,7 @@ libxl_domain_build_info = Struct("domain_build_info",[
("exec_ssid_label", string),
("localtime", libxl_defbool),
("disable_migrate", libxl_defbool),
+ ("disable_identpt", libxl_defbool),
("cpuid", libxl_cpuid_policy_list),
("blkdev_start", string),
@@ -1531,6 +1531,8 @@ void parse_config_data(const char *config_source,
xlu_cfg_get_defbool(config, "nomigrate", &b_info->disable_migrate, 0);
+ xlu_cfg_get_defbool(config, "noidentpt", &b_info->disable_identpt, 0);
+
if (!xlu_cfg_get_long(config, "tsc_mode", &l, 1)) {
const char *s = libxl_tsc_mode_to_string(l);
fprintf(stderr, "WARNING: specifying \"tsc_mode\" as an integer is deprecated. "
The Identity Pagetable is currently being created for all HVM VMs during setup. This was only necessary for running HVM guests on Intel CPUs where EPT was available but unrestricted guest mode was not. Add option to skip the creation of the Identity Pagetable via the "noidentpt" xl config option. This allows a system administrator to skip this step when the hardware is known to have the required features. Signed-off-by: Tamas K Lengyel <tamas.lengyel@intel.com> --- Further context: while running VM forks a significant bottle-neck was identified when HVM_PARAM_IDENT_PT is getting copied from the parent VM. This is due to the fact that setting this parameter requires obtaining a Xen-wide lock (domctl_lock_acquire). When running several VM forks in parallel during fuzzing the fork reset hypercall can fail due to the lock being taken by another fork that's being reset at the same time. This whole situation can be avoided if there is no Identity-map pagetable to begin with as on modern CPUs this identity-map pagetable is not actually required. --- docs/man/xl.cfg.5.pod.in | 5 +++++ tools/include/xenguest.h | 1 + tools/libs/guest/xg_dom_x86.c | 31 +++++++++++++++++-------------- tools/libs/light/libxl_create.c | 2 ++ tools/libs/light/libxl_dom.c | 2 ++ tools/libs/light/libxl_types.idl | 1 + tools/xl/xl_parse.c | 2 ++ 7 files changed, 30 insertions(+), 14 deletions(-)