From patchwork Wed Feb 24 19:07:32 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Cooper X-Patchwork-Id: 8411431 Return-Path: X-Original-To: patchwork-xen-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 651649F52D for ; Wed, 24 Feb 2016 19:10:45 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 85EF1202E6 for ; Wed, 24 Feb 2016 19:10:44 +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 89C4620266 for ; Wed, 24 Feb 2016 19:10:43 +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 1aYemq-0002Hh-NB; Wed, 24 Feb 2016 19:07:48 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1aYemp-0002Ex-FM for xen-devel@lists.xen.org; Wed, 24 Feb 2016 19:07:47 +0000 Received: from [85.158.137.68] by server-12.bemta-3.messagelabs.com id D0/7D-19343-E7FFDC65; Wed, 24 Feb 2016 19:07:42 +0000 X-Env-Sender: prvs=8552da0fd=Andrew.Cooper3@citrix.com X-Msg-Ref: server-11.tower-31.messagelabs.com!1456340861!24249596!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: 7.35.1; banners=-,-,- X-VirusChecked: Checked Received: (qmail 48274 invoked from network); 24 Feb 2016 19:07:42 -0000 Received: from smtp.citrix.com (HELO SMTP.CITRIX.COM) (66.165.176.89) by server-11.tower-31.messagelabs.com with RC4-SHA encrypted SMTP; 24 Feb 2016 19:07:42 -0000 X-IronPort-AV: E=Sophos;i="5.22,494,1449532800"; d="scan'208";a="334263054" From: Andrew Cooper To: Xen-devel Date: Wed, 24 Feb 2016 19:07:32 +0000 Message-ID: <1456340856-3065-5-git-send-email-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1456340856-3065-1-git-send-email-andrew.cooper3@citrix.com> References: <1456340856-3065-1-git-send-email-andrew.cooper3@citrix.com> MIME-Version: 1.0 X-DLP: MIA1 Cc: Andrew Cooper 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 The use of MAP_SMALL_PAGES causes shattering of the superpages making up the Xen virtual region, and is counter to the purpose of this series. Furthermore, it is not required for the memguard infrastructure to function (which itself uses map_pages_to_xen() for creating holes). Signed-off-by: Andrew Cooper Reviewed-by: Jan Beulich Acked-by: Stefano Stabellini --- v2: Reword the commmit message --- 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