From patchwork Mon Dec 12 14:35:13 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ross Lagerwall X-Patchwork-Id: 9470791 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 99A8C60476 for ; Mon, 12 Dec 2016 14:37:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8748727FE4 for ; Mon, 12 Dec 2016 14:37:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7B43528159; Mon, 12 Dec 2016 14:37:54 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 0630027FE4 for ; Mon, 12 Dec 2016 14:37:53 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cGRhI-0006Zx-Th; Mon, 12 Dec 2016 14:35:20 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cGRhH-0006Zr-HY for xen-devel@lists.xenproject.org; Mon, 12 Dec 2016 14:35:19 +0000 Received: from [193.109.254.147] by server-5.bemta-6.messagelabs.com id E0/D9-19272-6A5BE485; Mon, 12 Dec 2016 14:35:18 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrHLMWRWlGSWpSXmKPExsXitHRDpO6yrX4 RBvOWKll83zKZyYHR4/CHKywBjFGsmXlJ+RUJrBnTTzxlL3jFUTH9QSdbA+MO9i5GTg4JAX+J zgM7WEBsNgEDiVuXvjN3MXJwiAioSNzea9DFyMXBLLCcUeL4g5mMIDXCAs4SNxr2gtWzCKhK9 D68BTaHV8BDYumvj6wQM+Ukbp7rZAaxhQTUJN4uP8MCUSMocXLmEzCbWUBC4uCLF8wTGLlnIU nNQpJawMi0ilG9OLWoLLVI11QvqSgzPaMkNzEzR9fQwEwvN7W4ODE9NScxqVgvOT93EyMwFBi AYAfj9Mv+hxglOZiURHl/ePtFCPEl5adUZiQWZ8QXleakFh9ilOHgUJLgldkClBMsSk1PrUjL zAEGJUxagoNHSYQ3ZzNQmre4IDG3ODMdInWK0Zhj2rPFT5k41p1a8pRJiCUvPy9VSpz3LEipA EhpRmke3CBYtFxilJUS5mUEOk2IpyC1KDezBFX+FaM4B6OSMO9LkCk8mXklcPteAZ3CBHTK83 3eIKeUJCKkpBoYD0kG/ou5N/fta2Mx/m6zHxz95Y5V0041LHHaLG6f/PHngUebSlJmVVub/FN zNuSsfckzlbvi4ucwcz/9T3v391zp39sY/Nfh3txnlnxPpz9U2NqSn8mRKMZysV/PXe5A16ob hRL3d54wVK3Ol18YNnfT5sxHU8+nfvoqs3Pahb6Xde2+XE7HlViKMxINtZiLihMB9AXjrJECA AA= X-Env-Sender: prvs=147044df7=ross.lagerwall@citrix.com X-Msg-Ref: server-3.tower-27.messagelabs.com!1481553317!76658999!1 X-Originating-IP: [66.165.176.89] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni44OSA9PiAyMDMwMDc=\n, received_headers: No Received headers X-StarScan-Received: X-StarScan-Version: 9.1.1; banners=-,-,- X-VirusChecked: Checked Received: (qmail 37541 invoked from network); 12 Dec 2016 14:35:18 -0000 Received: from smtp.citrix.com (HELO SMTP.CITRIX.COM) (66.165.176.89) by server-3.tower-27.messagelabs.com with RC4-SHA encrypted SMTP; 12 Dec 2016 14:35:18 -0000 X-IronPort-AV: E=Sophos;i="5.33,336,1477958400"; d="scan'208";a="394280406" From: Ross Lagerwall To: Date: Mon, 12 Dec 2016 14:35:13 +0000 Message-ID: <1481553313-1251-1-git-send-email-ross.lagerwall@citrix.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Cc: Juergen Gross , Ross Lagerwall , Boris Ostrovsky , David Vrabel Subject: [Xen-devel] [PATCH v2] xen/setup: Don't relocate p2m over existing one X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP When relocating the p2m, take special care not to relocate it so that is overlaps with the current location of the p2m/initrd. This is needed since the full extent of the current location is not marked as a reserved region in the e820. This was seen to happen to a dom0 with a large initial p2m and a small reserved region in the middle of the initial p2m. Signed-off-by: Ross Lagerwall Reviewed-by: Juergen Gross --- arch/x86/xen/setup.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c index f8960fc..9f21b0c 100644 --- a/arch/x86/xen/setup.c +++ b/arch/x86/xen/setup.c @@ -713,10 +713,9 @@ static void __init xen_reserve_xen_mfnlist(void) size = PFN_PHYS(xen_start_info->nr_p2m_frames); } - if (!xen_is_e820_reserved(start, size)) { - memblock_reserve(start, size); + memblock_reserve(start, size); + if (!xen_is_e820_reserved(start, size)) return; - } #ifdef CONFIG_X86_32 /* @@ -727,6 +726,7 @@ static void __init xen_reserve_xen_mfnlist(void) BUG(); #else xen_relocate_p2m(); + memblock_free(start, size); #endif }