File 5e15e174-libxl-dont-needlessly-report-highmem-in-use.patch of Package xen.33138
Subject: libxl: don't needlessly report "highmem" in use
From: Jan Beulich jbeulich@suse.com Wed Jan 8 15:04:36 2020 +0100
Date: Wed Jan 8 15:04:36 2020 +0100:
Git: 3840e98f3e72b7b92071089a042cd7cf5be72732
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>
Acked-by: Wei Liu <wl@xen.org>
diff --git a/tools/libxl/libxl_dm.c b/tools/libxl/libxl_dm.c
index dac1b8ddb8..e92e412c1b 100644
--- a/tools/libxl/libxl_dm.c
+++ b/tools/libxl/libxl_dm.c
@@ -432,7 +432,7 @@ int libxl__domain_device_construct_rdm(libxl__gc *gc,
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(libxl__gc *gc,
* 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(libxl__gc *gc,
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;