From patchwork Tue Jan 7 14:58:07 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 11320993 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A3FF06C1 for ; Tue, 7 Jan 2020 14:59:17 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 89E51208C4 for ; Tue, 7 Jan 2020 14:59:17 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 89E51208C4 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1ioqJM-0005AW-Mq; Tue, 07 Jan 2020 14:58:24 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1ioqJK-0005AF-JT for xen-devel@lists.xenproject.org; Tue, 07 Jan 2020 14:58:22 +0000 X-Inumbo-ID: 20bfc9b2-315e-11ea-b56d-bc764e2007e4 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 20bfc9b2-315e-11ea-b56d-bc764e2007e4; Tue, 07 Jan 2020 14:58:13 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id E0BA8AC50; Tue, 7 Jan 2020 14:58:12 +0000 (UTC) To: "xen-devel@lists.xenproject.org" From: Jan Beulich Message-ID: <3d085404-ab62-fd67-646b-d539c77080d9@suse.com> Date: Tue, 7 Jan 2020 15:58:07 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.9.1 MIME-Version: 1.0 Content-Language: en-US Subject: [Xen-devel] [PATCH] libxl: don't needlessly report "highmem" in use X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Anthony Perard , Ian Jackson , Wei Liu Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" 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 Acked-by: Wei Liu --- 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;