tools/libxl: mark hvm mmio area as reserved in e820 map
PATCH 1/1 tools/libxl: mark hvm mmio area as reserved in e820 map
Make sure the HVM mmio area (especially console and Xenstore pages) is marked as "reserved" in the guest's E820 map, as otherwise conflicts might arise later, e.g. when hotplugging memory into the guest.
---
This is a bugfix for PVH and HVM guests. Please consider for 4.10.
--- tools/libxl/libxl_x86.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
tools/libxl/libxl_x86.c +11 -0
@@ -530,6 +530,9 @@ int libxl__arch_domain_construct_memmap(libxl__gc *gc,if (d_config->rdms[i].policy !=LIBXL_RDM_RESERVE_POLICY_INVALID ) e820_entries++; +/* Add mmio entry. */ +if (dom->mmio_size) + e820_entries++;/* If we should have a highmem range. */ if (highmem_size)
@@ -564,6 +567,14 @@ int libxl__arch_domain_construct_memmap(libxl__gc *gc, nr++; } +/* mmio area */ +if (dom->mmio_size) { + e820[nr].addr = dom->mmio_start; + e820[nr].size = dom->mmio_size; + e820[nr].type =E820_RESERVED ; + nr++; + } +for (i =0 ; i <MAX_ACPI_MODULES ; i++) {if (dom->acpi_modules[i].length) { e820[nr].addr = dom->acpi_modules[i].guest_addr_out & ~(page_size -1 );
Signature · 7 lines
2.12.3 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Quoted 5 lines · Juergen Gross
Make sure the HVM mmio area (especially console and Xenstore pages) is marked as "reserved" in the guest's E820 map, as otherwise conflicts might arise later, e.g. when hotplugging memory into the guest.
Signed-off-by Juergen Gross <[email protected]>
Quoted 2 lines
---
This is a bugfix for PVH and HVM guests. Please consider for 4.10.
I agree this is 4.10 material.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Quoted 4 lines
Quoted 1 line
Quoted 1 line · On 17.11.17 at 12:47, <[email protected]> wrote:
Make sure the HVM mmio area (especially console and Xenstore pages) is marked as "reserved" in the guest's E820 map, as otherwise conflicts might arise later, e.g. when hotplugging memory into the guest.
This is very certainly wrong. Have you looked at a couple of physical machines? Have you found an E820_RESERVED area on any of them for the MMIO hole? Two examples I can present right away:
<6>BIOS-e820: [mem 0x00000000c93f0000-0x00000000c9f8cfff] reserved <6>BIOS-e820: [mem 0x00000000c9f8d000-0x00000000c9fdefff] ACPI data <6>BIOS-e820: [mem 0x00000000c9fdf000-0x00000000cac82fff] ACPI NVS <6>BIOS-e820: [mem 0x00000000cac83000-0x00000000cb172fff] reserved <6>BIOS-e820: [mem 0x00000000cb173000-0x00000000cb173fff] usable <6>BIOS-e820: [mem 0x00000000cb174000-0x00000000cb181fff] reserved <6>BIOS-e820: [mem 0x00000000cb182000-0x00000000ccffffff] usable <6>BIOS-e820: [mem 0x00000000cd000000-0x00000000cdffffff] reserved <6>BIOS-e820: [mem 0x00000000d0000000-0x00000000dfffffff] reserved <6>BIOS-e820: [mem 0x00000000fed1c000-0x00000000fed1ffff] reserved <6>BIOS-e820: [mem 0x00000000ff000000-0x00000000ffffffff] reserved
and
(XEN) 00000000cf4bd000 - 00000000cf4bf000 (reserved) (XEN) 00000000cf4bf000 - 00000000cf636000 (usable) (XEN) 00000000cf636000 - 00000000cf7bf000 (ACPI NVS) (XEN) 00000000cf7bf000 - 00000000cf7df000 (usable) (XEN) 00000000cf7df000 - 00000000cf7ff000 (ACPI data) (XEN) 00000000cf7ff000 - 00000000cf800000 (usable) (XEN) 00000000cf800000 - 00000000d0000000 (reserved) (XEN) 00000000f8000000 - 00000000fd000000 (reserved) (XEN) 00000000ffe00000 - 0000000100000000 (reserved)
Things covered by E820_RESERVED include the MCFG area, yes, but not most other parts. The OS has to either be careful or consult ACPI for further resource usage details. In particular, the ACPI spec says
"The platform boot firmware does not return a range description for
the memory mapping of PCI devices, ISA Option ROMs, and ISA Plug and Play cards because the OS has mechanisms available to detect them."
See the section "E820 Assumptions and Limitations" for further details.
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Quoted 38 lines · Jan Beulich
Quoted 4 lines
Quoted 1 line
Quoted 1 line · On 17.11.17 at 12:47, <[email protected]> wrote:
Make sure the HVM mmio area (especially console and Xenstore pages) is marked as "reserved" in the guest's E820 map, as otherwise conflicts might arise later, e.g. when hotplugging memory into the guest.
This is very certainly wrong. Have you looked at a couple of physical machines? Have you found an
E820_RESERVEDarea on any of them for the MMIO hole? Two examples I can present right away:<6>BIOS-e820: [mem 0x00000000c93f0000-0x00000000c9f8cfff] reserved <6>BIOS-e820: [mem 0x00000000c9f8d000-0x00000000c9fdefff] ACPI data <6>BIOS-e820: [mem 0x00000000c9fdf000-0x00000000cac82fff] ACPI NVS <6>BIOS-e820: [mem 0x00000000cac83000-0x00000000cb172fff] reserved <6>BIOS-e820: [mem 0x00000000cb173000-0x00000000cb173fff] usable <6>BIOS-e820: [mem 0x00000000cb174000-0x00000000cb181fff] reserved <6>BIOS-e820: [mem 0x00000000cb182000-0x00000000ccffffff] usable <6>BIOS-e820: [mem 0x00000000cd000000-0x00000000cdffffff] reserved <6>BIOS-e820: [mem 0x00000000d0000000-0x00000000dfffffff] reserved <6>BIOS-e820: [mem 0x00000000fed1c000-0x00000000fed1ffff] reserved <6>BIOS-e820: [mem 0x00000000ff000000-0x00000000ffffffff] reserved
and
(XEN) 00000000cf4bd000 - 00000000cf4bf000 (reserved) (XEN) 00000000cf4bf000 - 00000000cf636000 (usable) (XEN) 00000000cf636000 - 00000000cf7bf000 (ACPI NVS) (XEN) 00000000cf7bf000 - 00000000cf7df000 (usable) (XEN) 00000000cf7df000 - 00000000cf7ff000 (ACPI data) (XEN) 00000000cf7ff000 - 00000000cf800000 (usable) (XEN) 00000000cf800000 - 00000000d0000000 (reserved) (XEN) 00000000f8000000 - 00000000fd000000 (reserved) (XEN) 00000000ffe00000 - 0000000100000000 (reserved)Things covered by
E820_RESERVEDinclude the MCFG area, yes, but not most other parts. The OS has to either be careful or consult ACPI for further resource usage details. In particular, the ACPI spec says
Quoted 6 lines
"The platform boot firmware does not return a range description for
the memory mapping of PCI devices, ISA Option ROMs, and ISA Plug and Play cards because the OS has mechanisms available to detect them."See the section "E820 Assumptions and Limitations" for further details.
So is it _wrong_ to return the mmio area as reserved? We at least want the shared console and Xenstore page to be marked as reserved, and those are part of the mmio area.
We could, of course, just report the HVM special pages as reserved, but this would IMO be more hacky than reporting just the mmio area.
Oh yes, and the LAPIC, of course. Again part of mmio area.
Juergen
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Quoted 7 lines · Juergen Gross
Make sure the HVM mmio area (especially console and Xenstore pages) is marked as "reserved" in the guest's E820 map, as otherwise conflicts might arise later, e.g. when hotplugging memory into the guest.
Signed-off-by Juergen Gross <[email protected]>---
This is a bugfix for PVH and HVM guests. Please consider for 4.10.
Please ignore this patch, it upsets HVMloader.
Juergen
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel