From patchwork Thu Sep 26 09:46:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Xia, Hongyan" X-Patchwork-Id: 11162221 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 8AB7F13BD for ; Thu, 26 Sep 2019 09:53:32 +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 656BA2053B for ; Thu, 26 Sep 2019 09:53:32 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=amazon.com header.i=@amazon.com header.b="uycXVr/Q" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 656BA2053B Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=amazon.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 1iDQS5-0003kY-FM; Thu, 26 Sep 2019 09:52:45 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iDQS3-0003jd-Sy for xen-devel@lists.xenproject.org; Thu, 26 Sep 2019 09:52:43 +0000 X-Inumbo-ID: 620e9839-e043-11e9-964d-12813bfff9fa Received: from smtp-fw-33001.amazon.com (unknown [207.171.190.10]) by localhost (Halon) with ESMTPS id 620e9839-e043-11e9-964d-12813bfff9fa; Thu, 26 Sep 2019 09:52:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1569491563; x=1601027563; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=rYvzmeotaaJgW6qlOTM/rr72px2cLcmGMqr3gdxHDvU=; b=uycXVr/QfYo1UOG2ruuinl3Xr3UAUuktbEzYHZPu+4mYe+C7s+3s54gx Eq7SIiWAqBU1guKumgzS5gr96j2YarbK4Pm74BokYgam9KqSKHU7pISsH OFaGc0/lLg2H9QT7v1KZOQg/ZvoKaHFg6hzBYtwefadngnyWthjKA/ydE Q=; X-IronPort-AV: E=Sophos;i="5.64,551,1559520000"; d="scan'208";a="836989337" Received: from sea3-co-svc-lb6-vlan2.sea.amazon.com (HELO email-inbound-relay-1e-303d0b0e.us-east-1.amazon.com) ([10.47.22.34]) by smtp-border-fw-out-33001.sea14.amazon.com with ESMTP; 26 Sep 2019 09:50:42 +0000 Received: from EX13MTAUEA001.ant.amazon.com (iad55-ws-svc-p15-lb9-vlan3.iad.amazon.com [10.40.159.166]) by email-inbound-relay-1e-303d0b0e.us-east-1.amazon.com (Postfix) with ESMTPS id D3A90A26C9; Thu, 26 Sep 2019 09:50:26 +0000 (UTC) Received: from EX13D28EUC001.ant.amazon.com (10.43.164.4) by EX13MTAUEA001.ant.amazon.com (10.43.61.243) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Thu, 26 Sep 2019 09:50:02 +0000 Received: from EX13MTAUWA001.ant.amazon.com (10.43.160.58) by EX13D28EUC001.ant.amazon.com (10.43.164.4) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Thu, 26 Sep 2019 09:50:01 +0000 Received: from u9d785c4ba99158.ant.amazon.com (10.125.106.58) by mail-relay.amazon.com (10.43.160.118) with Microsoft SMTP Server id 15.0.1367.3 via Frontend Transport; Thu, 26 Sep 2019 09:49:57 +0000 From: To: Date: Thu, 26 Sep 2019 10:46:42 +0100 Message-ID: <96f10f9693fdc795152a7f24c6df65f7f345b0f4.1569489002.git.hongyax@amazon.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: Bulk Subject: [Xen-devel] [RFC PATCH 79/84] Don't assume bootmem_region_list is mapped. Also fix a double unmap bug. X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Stefano Stabellini , Wei Liu , Hongyan Xia , George Dunlap , Andrew Cooper , Konrad Rzeszutek Wilk , Ian Jackson , Tim Deegan , Julien Grall , Jan Beulich , =?utf-8?q?Roger_Pau_Monn=C3=A9?= Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" From: Hongyan Xia Signed-off-by: Hongyan Xia --- xen/arch/x86/pv/dom0_build.c | 2 +- xen/common/page_alloc.c | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/xen/arch/x86/pv/dom0_build.c b/xen/arch/x86/pv/dom0_build.c index 202edcaa17..1555a61b84 100644 --- a/xen/arch/x86/pv/dom0_build.c +++ b/xen/arch/x86/pv/dom0_build.c @@ -236,7 +236,7 @@ static __init void setup_pv_physmap(struct domain *d, unsigned long pgtbl_pfn, if ( pl3e ) unmap_domain_page(pl3e); - unmap_domain_page(l4start); + //unmap_domain_page(l4start); } static struct page_info * __init alloc_chunk(struct domain *d, diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c index deeeac065c..6acc1c78a4 100644 --- a/xen/common/page_alloc.c +++ b/xen/common/page_alloc.c @@ -247,6 +247,7 @@ mfn_t first_valid_mfn = INVALID_MFN_INITIALIZER; static struct bootmem_region { unsigned long s, e; /* MFNs @s through @e-1 inclusive are free */ } *__initdata bootmem_region_list; +struct page_info *bootmem_region_list_pg; static unsigned int __initdata nr_bootmem_regions; struct scrub_region { @@ -264,7 +265,11 @@ static void __init bootmem_region_add(unsigned long s, unsigned long e) unsigned int i; if ( (bootmem_region_list == NULL) && (s < e) ) - bootmem_region_list = mfn_to_virt(s++); + { + bootmem_region_list_pg = mfn_to_page(_mfn(s)); + bootmem_region_list = map_domain_page(_mfn(s)); + s++; + } if ( s >= e ) return; @@ -1869,7 +1874,10 @@ void __init end_boot_allocator(void) init_heap_pages(mfn_to_page(_mfn(r->s)), r->e - r->s); } nr_bootmem_regions = 0; - init_heap_pages(virt_to_page(bootmem_region_list), 1); + init_heap_pages(bootmem_region_list_pg, 1); + /* Remember to discard the mapping for bootmem_region_list. */ + unmap_domain_page(bootmem_region_list); + flush_tlb_one_local(bootmem_region_list); if ( !dma_bitsize && (num_online_nodes() > 1) ) dma_bitsize = arch_get_dma_bitsize();