Message ID | 3d085404-ab62-fd67-646b-d539c77080d9@suse.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | libxl: don't needlessly report "highmem" in use | expand |
On Tue, Jan 07, 2020 at 03:58:07PM +0100, Jan Beulich wrote: > Due to the unconditional updating of dom->highmem_end in > libxl__domain_device_construct_rdm() I've observed on a 2Gb HVM guest > with a passed through device (without overly large BARs, and with no RDM > ranges at all) > > (d2) RAM in high memory; setting high_mem resource base to 100000000 > ... > (d2) E820 table: > (d2) [00]: 00000000:00000000 - 00000000:000a0000: RAM > (d2) HOLE: 00000000:000a0000 - 00000000:000d0000 > (d2) [01]: 00000000:000d0000 - 00000000:00100000: RESERVED > (d2) [02]: 00000000:00100000 - 00000000:7f800000: RAM > (d2) HOLE: 00000000:7f800000 - 00000000:fc000000 > (d2) [03]: 00000000:fc000000 - 00000001:00000000: RESERVED > (d2) [04]: 00000001:00000000 - 00000001:00000000: RAM > > both of which aren't really appropriate in this case. Arrange for this > to not happen. Indeed. We shouldn't need to move RAM to high address in this configuration. Acked-by: Wei Liu <wl@xen.org>
--- a/tools/libxl/libxl_dm.c +++ b/tools/libxl/libxl_dm.c @@ -432,7 +432,7 @@ int libxl__domain_device_construct_rdm(l uint16_t seg; uint8_t bus, devfn; uint64_t rdm_start, rdm_size; - uint64_t highmem_end = dom->highmem_end ? dom->highmem_end : (1ull<<32); + uint64_t highmem_end = dom->highmem_end; /* * We just want to construct RDM once since RDM is specific to the @@ -557,6 +557,8 @@ int libxl__domain_device_construct_rdm(l * We will move downwards lowmem_end so we have to expand * highmem_end. */ + if (!highmem_end) + highmem_end = 1ull << 32; highmem_end += (dom->lowmem_end - rdm_start); /* Now move downwards lowmem_end. */ dom->lowmem_end = rdm_start; @@ -577,9 +579,10 @@ int libxl__domain_device_construct_rdm(l conflict = overlaps_rdm(0, dom->lowmem_end, rdm_start, rdm_size); /* Does this entry conflict with highmem? */ - conflict |= overlaps_rdm((1ULL<<32), - dom->highmem_end - (1ULL<<32), - rdm_start, rdm_size); + if (highmem_end) + conflict |= overlaps_rdm((1ULL << 32), + highmem_end - (1ULL << 32), + rdm_start, rdm_size); if (!conflict) continue;
Due to the unconditional updating of dom->highmem_end in libxl__domain_device_construct_rdm() I've observed on a 2Gb HVM guest with a passed through device (without overly large BARs, and with no RDM ranges at all) (d2) RAM in high memory; setting high_mem resource base to 100000000 ... (d2) E820 table: (d2) [00]: 00000000:00000000 - 00000000:000a0000: RAM (d2) HOLE: 00000000:000a0000 - 00000000:000d0000 (d2) [01]: 00000000:000d0000 - 00000000:00100000: RESERVED (d2) [02]: 00000000:00100000 - 00000000:7f800000: RAM (d2) HOLE: 00000000:7f800000 - 00000000:fc000000 (d2) [03]: 00000000:fc000000 - 00000001:00000000: RESERVED (d2) [04]: 00000001:00000000 - 00000001:00000000: RAM both of which aren't really appropriate in this case. Arrange for this to not happen. Signed-off-by: Jan Beulich <jbeulich@suse.com>