From patchwork Thu Feb 18 18:03:40 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Cooper X-Patchwork-Id: 8353201 Return-Path: X-Original-To: patchwork-xen-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id AA90CC0553 for ; Thu, 18 Feb 2016 18:06:38 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id ADFE720398 for ; Thu, 18 Feb 2016 18:06:37 +0000 (UTC) Received: from lists.xen.org (lists.xenproject.org [50.57.142.19]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1C010200DB for ; Thu, 18 Feb 2016 18:06:36 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xen.org) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1aWSvd-00072f-S2; Thu, 18 Feb 2016 18:03:49 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1aWSvc-00072E-Ah for xen-devel@lists.xen.org; Thu, 18 Feb 2016 18:03:48 +0000 Received: from [85.158.139.211] by server-13.bemta-5.messagelabs.com id 64/DC-02983-38706C65; Thu, 18 Feb 2016 18:03:47 +0000 X-Env-Sender: prvs=8491ce0b8=Andrew.Cooper3@citrix.com X-Msg-Ref: server-4.tower-206.messagelabs.com!1455818625!23409893!1 X-Originating-IP: [66.165.176.63] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni42MyA9PiAzMDYwNDg=\n, received_headers: No Received headers X-StarScan-Received: X-StarScan-Version: 7.35.1; banners=-,-,- X-VirusChecked: Checked Received: (qmail 9731 invoked from network); 18 Feb 2016 18:03:46 -0000 Received: from smtp02.citrix.com (HELO SMTP02.CITRIX.COM) (66.165.176.63) by server-4.tower-206.messagelabs.com with RC4-SHA encrypted SMTP; 18 Feb 2016 18:03:46 -0000 X-IronPort-AV: E=Sophos;i="5.22,466,1449532800"; d="scan'208";a="339217781" From: Andrew Cooper To: Xen-devel Date: Thu, 18 Feb 2016 18:03:40 +0000 Message-ID: <1455818622-30625-3-git-send-email-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1455818622-30625-1-git-send-email-andrew.cooper3@citrix.com> References: <1455818622-30625-1-git-send-email-andrew.cooper3@citrix.com> MIME-Version: 1.0 X-DLP: MIA1 Cc: Andrew Cooper , Tim Deegan , Ian Campbell , Jan Beulich Subject: [Xen-devel] [PATCH] xen/memguard: Drop memguard_init() entirely X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP It is not obvious what this code is doing. Most of it dates from 2007/2008, and there have been substantial changes in Xen's memory handling since then. It was previously optional, and isn't needed for any of the memguard infrastructure to function. The use of MAP_SMALL_PAGES causes needless shattering of superpages. Signed-off-by: Andrew Cooper --- CC: Jan Beulich CC: Tim Deegan CC: Ian Campbell --- xen/arch/x86/mm.c | 16 ---------------- xen/arch/x86/setup.c | 2 -- xen/include/asm-arm/mm.h | 1 - xen/include/asm-x86/mm.h | 2 -- 4 files changed, 21 deletions(-) diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c index d6aaed8..ed8ab02 100644 --- a/xen/arch/x86/mm.c +++ b/xen/arch/x86/mm.c @@ -6346,22 +6346,6 @@ void free_perdomain_mappings(struct domain *d) #ifdef MEMORY_GUARD -void memguard_init(void) -{ - unsigned long start = max_t(unsigned long, xen_phys_start, 1UL << 20); - map_pages_to_xen( - (unsigned long)__va(start), - start >> PAGE_SHIFT, - (__pa(&_end) + PAGE_SIZE - 1 - start) >> PAGE_SHIFT, - __PAGE_HYPERVISOR_RW|MAP_SMALL_PAGES); - BUG_ON(start != xen_phys_start); - map_pages_to_xen( - XEN_VIRT_START, - start >> PAGE_SHIFT, - (__pa(&_end) + PAGE_SIZE - 1 - start) >> PAGE_SHIFT, - __PAGE_HYPERVISOR|MAP_SMALL_PAGES); -} - static void __memguard_change_range(void *p, unsigned long l, int guard) { unsigned long _p = (unsigned long)p; diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index b8a28d7..cddf954 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -1146,8 +1146,6 @@ void __init noreturn __start_xen(unsigned long mbi_p) ~((1UL << L2_PAGETABLE_SHIFT) - 1); destroy_xen_mappings(xen_virt_end, XEN_VIRT_START + BOOTSTRAP_MAP_BASE); - memguard_init(); - nr_pages = 0; for ( i = 0; i < e820.nr_map; i++ ) if ( e820.map[i].type == E820_RAM ) diff --git a/xen/include/asm-arm/mm.h b/xen/include/asm-arm/mm.h index 2e9d0b2..68cf203 100644 --- a/xen/include/asm-arm/mm.h +++ b/xen/include/asm-arm/mm.h @@ -331,7 +331,6 @@ unsigned long domain_get_maximum_gpfn(struct domain *d); extern struct domain *dom_xen, *dom_io, *dom_cow; -#define memguard_init(_s) (_s) #define memguard_guard_stack(_p) ((void)0) #define memguard_guard_range(_p,_l) ((void)0) #define memguard_unguard_range(_p,_l) ((void)0) diff --git a/xen/include/asm-x86/mm.h b/xen/include/asm-x86/mm.h index a097382..23a4092 100644 --- a/xen/include/asm-x86/mm.h +++ b/xen/include/asm-x86/mm.h @@ -479,11 +479,9 @@ extern struct rangeset *mmio_ro_ranges; #define compat_cr3_to_pfn(cr3) (((unsigned)(cr3) >> 12) | ((unsigned)(cr3) << 20)) #ifdef MEMORY_GUARD -void memguard_init(void); void memguard_guard_range(void *p, unsigned long l); void memguard_unguard_range(void *p, unsigned long l); #else -#define memguard_init() ((void)0) #define memguard_guard_range(_p,_l) ((void)0) #define memguard_unguard_range(_p,_l) ((void)0) #endif