]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/2.6.32.10/x86-xen-disable-highmem-pte-allocation-even-when-config_highpte-y.patch
5.1-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 2.6.32.10 / x86-xen-disable-highmem-pte-allocation-even-when-config_highpte-y.patch
1 From 817a824b75b1475f1b067c8cee318c7b4d66fcde Mon Sep 17 00:00:00 2001
2 From: Ian Campbell <ian.campbell@citrix.com>
3 Date: Fri, 26 Feb 2010 17:16:00 +0000
4 Subject: x86, xen: Disable highmem PTE allocation even when CONFIG_HIGHPTE=y
5 MIME-Version: 1.0
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
8
9 From: Ian Campbell <ian.campbell@citrix.com>
10
11 commit 817a824b75b1475f1b067c8cee318c7b4d66fcde upstream.
12
13 There's a path in the pagefault code where the kernel deliberately
14 breaks its own locking rules by kmapping a high pte page without
15 holding the pagetable lock (in at least page_check_address). This
16 breaks Xen's ability to track the pinned/unpinned state of the
17 page. There does not appear to be a viable workaround for this
18 behaviour so simply disable HIGHPTE for all Xen guests.
19
20 Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
21 LKML-Reference: <1267204562-11844-1-git-send-email-ian.campbell@citrix.com>
22 Cc: Jeremy Fitzhardinge <jeremy@goop.org>
23 Cc: Ingo Molnar <mingo@elte.hu>
24 Cc: Pasi Kärkkäinen <pasik@iki.fi>
25 Cc: <xen-devel@lists.xensource.com>
26 Signed-off-by: H. Peter Anvin <hpa@zytor.com>
27 Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
28
29 ---
30 arch/x86/xen/enlighten.c | 7 +++++++
31 arch/x86/xen/mmu.c | 11 ++++++-----
32 2 files changed, 13 insertions(+), 5 deletions(-)
33
34 --- a/arch/x86/xen/enlighten.c
35 +++ b/arch/x86/xen/enlighten.c
36 @@ -48,6 +48,7 @@
37 #include <asm/traps.h>
38 #include <asm/setup.h>
39 #include <asm/desc.h>
40 +#include <asm/pgalloc.h>
41 #include <asm/pgtable.h>
42 #include <asm/tlbflush.h>
43 #include <asm/reboot.h>
44 @@ -1092,6 +1093,12 @@ asmlinkage void __init xen_start_kernel(
45
46 __supported_pte_mask |= _PAGE_IOMAP;
47
48 + /*
49 + * Prevent page tables from being allocated in highmem, even
50 + * if CONFIG_HIGHPTE is enabled.
51 + */
52 + __userpte_alloc_gfp &= ~__GFP_HIGHMEM;
53 +
54 #ifdef CONFIG_X86_64
55 /* Work out if we support NX */
56 check_efer();
57 --- a/arch/x86/xen/mmu.c
58 +++ b/arch/x86/xen/mmu.c
59 @@ -1432,14 +1432,15 @@ static void *xen_kmap_atomic_pte(struct
60 {
61 pgprot_t prot = PAGE_KERNEL;
62
63 + /*
64 + * We disable highmem allocations for page tables so we should never
65 + * see any calls to kmap_atomic_pte on a highmem page.
66 + */
67 + BUG_ON(PageHighMem(page));
68 +
69 if (PagePinned(page))
70 prot = PAGE_KERNEL_RO;
71
72 - if (0 && PageHighMem(page))
73 - printk("mapping highpte %lx type %d prot %s\n",
74 - page_to_pfn(page), type,
75 - (unsigned long)pgprot_val(prot) & _PAGE_RW ? "WRITE" : "READ");
76 -
77 return kmap_atomic_prot(page, type, prot);
78 }
79 #endif