From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Xen-devel <xen-devel@lists.xen.org>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>,
Tim Deegan <tim@xen.org>, Ian Campbell <Ian.Campbell@citrix.com>,
Jan Beulich <JBeulich@suse.com>
Subject: [PATCH] xen/memguard: Drop memguard_init() entirely
Date: Thu, 18 Feb 2016 18:03:40 +0000 [thread overview]
Message-ID: <1455818622-30625-3-git-send-email-andrew.cooper3@citrix.com> (raw)
In-Reply-To: <1455818622-30625-1-git-send-email-andrew.cooper3@citrix.com>
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 <andrew.cooper3@citrix.com>
---
CC: Jan Beulich <JBeulich@suse.com>
CC: Tim Deegan <tim@xen.org>
CC: Ian Campbell <Ian.Campbell@citrix.com>
---
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
--
2.1.4
next prev parent reply other threads:[~2016-02-18 18:03 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-18 18:03 [PATCH] xen/x86: Map Xen code/data/bss with superpages Andrew Cooper
2016-02-18 18:03 ` [PATCH] xen: Introduce IS_ALIGNED() Andrew Cooper
2016-02-18 18:03 ` Andrew Cooper [this message]
2016-02-19 14:44 ` [PATCH] xen/memguard: Drop memguard_init() entirely Jan Beulich
2016-02-19 16:18 ` Andrew Cooper
2016-02-22 10:02 ` Jan Beulich
2016-02-22 10:29 ` Andrew Cooper
2016-02-22 10:41 ` Jan Beulich
2016-02-18 18:03 ` [PATCH] xen/x86: Use 2M superpages for text/data/bss mappings Andrew Cooper
2016-02-19 14:58 ` Jan Beulich
2016-02-19 15:51 ` Andrew Cooper
2016-02-22 9:55 ` Jan Beulich
2016-02-22 10:24 ` Andrew Cooper
2016-02-22 10:43 ` Jan Beulich
2016-02-18 18:03 ` [PATCH] xen/x86: Unilaterally remove .init mappings Andrew Cooper
2016-02-19 15:02 ` Jan Beulich
2016-02-18 18:20 ` [PATCH] xen/x86: Map Xen code/data/bss with superpages Andrew Cooper
-- strict thread matches above, loose matches on Subject: below --
2016-02-24 19:07 [PATCH] " Andrew Cooper
2016-02-24 19:07 ` [PATCH] xen/memguard: Drop memguard_init() entirely Andrew Cooper
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1455818622-30625-3-git-send-email-andrew.cooper3@citrix.com \
--to=andrew.cooper3@citrix.com \
--cc=Ian.Campbell@citrix.com \
--cc=JBeulich@suse.com \
--cc=tim@xen.org \
--cc=xen-devel@lists.xen.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).