xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* patch x86-xen-disable-highmem-pte-allocation-even-when-config_highpte-y.patch added to 2.6.33-stable tree
@ 2010-03-11 19:32 gregkh
  2010-03-12 14:08 ` Stefan Lippers-Hollmann
  0 siblings, 1 reply; 4+ messages in thread
From: gregkh @ 2010-03-11 19:32 UTC (permalink / raw)
  To: ian.campbell, gregkh, hpa, jeremy, mingo, pasik, xen-devel
  Cc: stable, stable-commits


This is a note to let you know that we have just queued up the patch titled

    Subject: x86, xen: Disable highmem PTE allocation even when CONFIG_HIGHPTE=y

to the 2.6.33-stable tree.  Its filename is

    x86-xen-disable-highmem-pte-allocation-even-when-config_highpte-y.patch

A git repo of this tree can be found at 
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary


>From 817a824b75b1475f1b067c8cee318c7b4d66fcde Mon Sep 17 00:00:00 2001
From: Ian Campbell <ian.campbell@citrix.com>
Date: Fri, 26 Feb 2010 17:16:00 +0000
Subject: x86, xen: Disable highmem PTE allocation even when CONFIG_HIGHPTE=y
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

From: Ian Campbell <ian.campbell@citrix.com>

commit 817a824b75b1475f1b067c8cee318c7b4d66fcde upstream.

There's a path in the pagefault code where the kernel deliberately
breaks its own locking rules by kmapping a high pte page without
holding the pagetable lock (in at least page_check_address). This
breaks Xen's ability to track the pinned/unpinned state of the
page. There does not appear to be a viable workaround for this
behaviour so simply disable HIGHPTE for all Xen guests.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
LKML-Reference: <1267204562-11844-1-git-send-email-ian.campbell@citrix.com>
Cc: Jeremy Fitzhardinge <jeremy@goop.org>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Pasi Kärkkäinen <pasik@iki.fi>
Cc: <xen-devel@lists.xensource.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
 arch/x86/xen/enlighten.c |    7 +++++++
 arch/x86/xen/mmu.c       |   11 ++++++-----
 2 files changed, 13 insertions(+), 5 deletions(-)

--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -50,6 +50,7 @@
 #include <asm/traps.h>
 #include <asm/setup.h>
 #include <asm/desc.h>
+#include <asm/pgalloc.h>
 #include <asm/pgtable.h>
 #include <asm/tlbflush.h>
 #include <asm/reboot.h>
@@ -1094,6 +1095,12 @@ asmlinkage void __init xen_start_kernel(
 
 	__supported_pte_mask |= _PAGE_IOMAP;
 
+	/*
+	 * Prevent page tables from being allocated in highmem, even
+	 * if CONFIG_HIGHPTE is enabled.
+	 */
+	__userpte_alloc_gfp &= ~__GFP_HIGHMEM;
+
 	/* Work out if we support NX */
 	x86_configure_nx();
 
--- a/arch/x86/xen/mmu.c
+++ b/arch/x86/xen/mmu.c
@@ -1432,14 +1432,15 @@ static void *xen_kmap_atomic_pte(struct
 {
 	pgprot_t prot = PAGE_KERNEL;
 
+	/*
+	 * We disable highmem allocations for page tables so we should never
+	 * see any calls to kmap_atomic_pte on a highmem page.
+	 */
+	BUG_ON(PageHighMem(page));
+
 	if (PagePinned(page))
 		prot = PAGE_KERNEL_RO;
 
-	if (0 && PageHighMem(page))
-		printk("mapping highpte %lx type %d prot %s\n",
-		       page_to_pfn(page), type,
-		       (unsigned long)pgprot_val(prot) & _PAGE_RW ? "WRITE" : "READ");
-
 	return kmap_atomic_prot(page, type, prot);
 }
 #endif


Patches currently in stable-queue which might be from ian.campbell@citrix.com are

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: patch x86-xen-disable-highmem-pte-allocation-even-when-config_highpte-y.patch added to 2.6.33-stable tree
  2010-03-11 19:32 patch x86-xen-disable-highmem-pte-allocation-even-when-config_highpte-y.patch added to 2.6.33-stable tree gregkh
@ 2010-03-12 14:08 ` Stefan Lippers-Hollmann
  2010-03-12 14:17   ` Ian Campbell
  0 siblings, 1 reply; 4+ messages in thread
From: Stefan Lippers-Hollmann @ 2010-03-12 14:08 UTC (permalink / raw)
  To: gregkh
  Cc: linux-kernel, ian.campbell, hpa, jeremy, mingo, pasik, xen-devel,
	stable

Hi

On Friday 12 March 2010, gregkh@suse.de wrote:
> This is a note to let you know that we have just queued up the patch titled
> 
>     Subject: x86, xen: Disable highmem PTE allocation even when CONFIG_HIGHPTE=y
> 
> to the 2.6.33-stable tree.  Its filename is
> 
>     x86-xen-disable-highmem-pte-allocation-even-when-config_highpte-y.patch
> 
> A git repo of this tree can be found at 
>     http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
> 
> 
> From 817a824b75b1475f1b067c8cee318c7b4d66fcde Mon Sep 17 00:00:00 2001
> From: Ian Campbell <ian.campbell@citrix.com>
> Date: Fri, 26 Feb 2010 17:16:00 +0000
> Subject: x86, xen: Disable highmem PTE allocation even when CONFIG_HIGHPTE=y
> MIME-Version: 1.0
> Content-Type: text/plain; charset=UTF-8
> Content-Transfer-Encoding: 8bit
> 
> From: Ian Campbell <ian.campbell@citrix.com>
> 
> commit 817a824b75b1475f1b067c8cee318c7b4d66fcde upstream.
> 
> There's a path in the pagefault code where the kernel deliberately
> breaks its own locking rules by kmapping a high pte page without
> holding the pagetable lock (in at least page_check_address). This
> breaks Xen's ability to track the pinned/unpinned state of the
> page. There does not appear to be a viable workaround for this
> behaviour so simply disable HIGHPTE for all Xen guests.

This patch breaks compilation of the current 2.6.33 -stable queue and might
also affect queue-2.6.32 (untested):

  CC      arch/x86/xen/enlighten.o
arch/x86/xen/enlighten.c: In function ‘xen_start_kernel’:
arch/x86/xen/enlighten.c:1102: error: ‘__userpte_alloc_gfp’ undeclared (first use in this function)
arch/x86/xen/enlighten.c:1102: error: (Each undeclared identifier is reported only once
arch/x86/xen/enlighten.c:1102: error: for each function it appears in.)
make[2]: *** [arch/x86/xen/enlighten.o] Error 1
make[1]: *** [arch/x86/xen] Error 2

as it seems to depend (tested) on:

commit 14315592009c17035cac81f4954d5a1f4d71e489
Author: Ian Campbell <ian.campbell@citrix.com>
Date:   Wed Feb 17 10:38:10 2010 +0000

    x86, mm: Allow highmem user page tables to be disabled at boot time

Regards
	Stefan Lippers-Hollmann

-- 
> Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
> LKML-Reference: <1267204562-11844-1-git-send-email-ian.campbell@citrix.com>
> Cc: Jeremy Fitzhardinge <jeremy@goop.org>
> Cc: Ingo Molnar <mingo@elte.hu>
> Cc: Pasi Kärkkäinen <pasik@iki.fi>
> Cc: <xen-devel@lists.xensource.com>
> Signed-off-by: H. Peter Anvin <hpa@zytor.com>
> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
> 
> ---
>  arch/x86/xen/enlighten.c |    7 +++++++
>  arch/x86/xen/mmu.c       |   11 ++++++-----
>  2 files changed, 13 insertions(+), 5 deletions(-)
> 
> --- a/arch/x86/xen/enlighten.c
> +++ b/arch/x86/xen/enlighten.c
> @@ -50,6 +50,7 @@
>  #include <asm/traps.h>
>  #include <asm/setup.h>
>  #include <asm/desc.h>
> +#include <asm/pgalloc.h>
>  #include <asm/pgtable.h>
>  #include <asm/tlbflush.h>
>  #include <asm/reboot.h>
> @@ -1094,6 +1095,12 @@ asmlinkage void __init xen_start_kernel(
>  
>  	__supported_pte_mask |= _PAGE_IOMAP;
>  
> +	/*
> +	 * Prevent page tables from being allocated in highmem, even
> +	 * if CONFIG_HIGHPTE is enabled.
> +	 */
> +	__userpte_alloc_gfp &= ~__GFP_HIGHMEM;
> +
>  	/* Work out if we support NX */
>  	x86_configure_nx();
>  
> --- a/arch/x86/xen/mmu.c
> +++ b/arch/x86/xen/mmu.c
> @@ -1432,14 +1432,15 @@ static void *xen_kmap_atomic_pte(struct
>  {
>  	pgprot_t prot = PAGE_KERNEL;
>  
> +	/*
> +	 * We disable highmem allocations for page tables so we should never
> +	 * see any calls to kmap_atomic_pte on a highmem page.
> +	 */
> +	BUG_ON(PageHighMem(page));
> +
>  	if (PagePinned(page))
>  		prot = PAGE_KERNEL_RO;
>  
> -	if (0 && PageHighMem(page))
> -		printk("mapping highpte %lx type %d prot %s\n",
> -		       page_to_pfn(page), type,
> -		       (unsigned long)pgprot_val(prot) & _PAGE_RW ? "WRITE" : "READ");
> -
>  	return kmap_atomic_prot(page, type, prot);
>  }
>  #endif

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: patch x86-xen-disable-highmem-pte-allocation-even-when-config_highpte-y.patch added to 2.6.33-stable tree
  2010-03-12 14:08 ` Stefan Lippers-Hollmann
@ 2010-03-12 14:17   ` Ian Campbell
  2010-03-12 16:35     ` Greg KH
  0 siblings, 1 reply; 4+ messages in thread
From: Ian Campbell @ 2010-03-12 14:17 UTC (permalink / raw)
  To: Stefan Lippers-Hollmann
  Cc: gregkh@suse.de, linux-kernel@vger.kernel.org, hpa@zytor.com,
	jeremy@goop.org, mingo@elte.hu, pasik@iki.fi,
	xen-devel@lists.xensource.com, stable@kernel.org

On Fri, 2010-03-12 at 14:08 +0000, Stefan Lippers-Hollmann wrote:
> Hi
> 
> On Friday 12 March 2010, gregkh@suse.de wrote:
> > This is a note to let you know that we have just queued up the patch titled
> > 
> >     Subject: x86, xen: Disable highmem PTE allocation even when CONFIG_HIGHPTE=y
> > 
> > to the 2.6.33-stable tree.  Its filename is
> > 
> >     x86-xen-disable-highmem-pte-allocation-even-when-config_highpte-y.patch
> > 
> > A git repo of this tree can be found at 
> >     http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
> > 
> > 
> > From 817a824b75b1475f1b067c8cee318c7b4d66fcde Mon Sep 17 00:00:00 2001
> > From: Ian Campbell <ian.campbell@citrix.com>
> > Date: Fri, 26 Feb 2010 17:16:00 +0000
> > Subject: x86, xen: Disable highmem PTE allocation even when CONFIG_HIGHPTE=y
> > MIME-Version: 1.0
> > Content-Type: text/plain; charset=UTF-8
> > Content-Transfer-Encoding: 8bit
> > 
> > From: Ian Campbell <ian.campbell@citrix.com>
> > 
> > commit 817a824b75b1475f1b067c8cee318c7b4d66fcde upstream.
> > 
> > There's a path in the pagefault code where the kernel deliberately
> > breaks its own locking rules by kmapping a high pte page without
> > holding the pagetable lock (in at least page_check_address). This
> > breaks Xen's ability to track the pinned/unpinned state of the
> > page. There does not appear to be a viable workaround for this
> > behaviour so simply disable HIGHPTE for all Xen guests.
> 
> This patch breaks compilation of the current 2.6.33 -stable queue and might
> also affect queue-2.6.32 (untested):
> 
>   CC      arch/x86/xen/enlighten.o
> arch/x86/xen/enlighten.c: In function ‘xen_start_kernel’:
> arch/x86/xen/enlighten.c:1102: error: ‘__userpte_alloc_gfp’ undeclared (first use in this function)
> arch/x86/xen/enlighten.c:1102: error: (Each undeclared identifier is reported only once
> arch/x86/xen/enlighten.c:1102: error: for each function it appears in.)
> make[2]: *** [arch/x86/xen/enlighten.o] Error 1
> make[1]: *** [arch/x86/xen] Error 2
> 
> as it seems to depend (tested) on:
> 
> commit 14315592009c17035cac81f4954d5a1f4d71e489
> Author: Ian Campbell <ian.campbell@citrix.com>
> Date:   Wed Feb 17 10:38:10 2010 +0000
> 
>     x86, mm: Allow highmem user page tables to be disabled at boot time

Thanks Stefan, this is indeed the correct fix. I pointed Greg to this
patch in private mail this morning.

Ian.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: patch x86-xen-disable-highmem-pte-allocation-even-when-config_highpte-y.patch added to 2.6.33-stable tree
  2010-03-12 14:17   ` Ian Campbell
@ 2010-03-12 16:35     ` Greg KH
  0 siblings, 0 replies; 4+ messages in thread
From: Greg KH @ 2010-03-12 16:35 UTC (permalink / raw)
  To: Ian Campbell
  Cc: Stefan Lippers-Hollmann, linux-kernel@vger.kernel.org,
	hpa@zytor.com, jeremy@goop.org, mingo@elte.hu, pasik@iki.fi,
	xen-devel@lists.xensource.com, stable@kernel.org

On Fri, Mar 12, 2010 at 02:17:33PM +0000, Ian Campbell wrote:
> On Fri, 2010-03-12 at 14:08 +0000, Stefan Lippers-Hollmann wrote:
> > Hi
> > 
> > On Friday 12 March 2010, gregkh@suse.de wrote:
> > > This is a note to let you know that we have just queued up the patch titled
> > > 
> > >     Subject: x86, xen: Disable highmem PTE allocation even when CONFIG_HIGHPTE=y
> > > 
> > > to the 2.6.33-stable tree.  Its filename is
> > > 
> > >     x86-xen-disable-highmem-pte-allocation-even-when-config_highpte-y.patch
> > > 
> > > A git repo of this tree can be found at 
> > >     http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
> > > 
> > > 
> > > From 817a824b75b1475f1b067c8cee318c7b4d66fcde Mon Sep 17 00:00:00 2001
> > > From: Ian Campbell <ian.campbell@citrix.com>
> > > Date: Fri, 26 Feb 2010 17:16:00 +0000
> > > Subject: x86, xen: Disable highmem PTE allocation even when CONFIG_HIGHPTE=y
> > > MIME-Version: 1.0
> > > Content-Type: text/plain; charset=UTF-8
> > > Content-Transfer-Encoding: 8bit
> > > 
> > > From: Ian Campbell <ian.campbell@citrix.com>
> > > 
> > > commit 817a824b75b1475f1b067c8cee318c7b4d66fcde upstream.
> > > 
> > > There's a path in the pagefault code where the kernel deliberately
> > > breaks its own locking rules by kmapping a high pte page without
> > > holding the pagetable lock (in at least page_check_address). This
> > > breaks Xen's ability to track the pinned/unpinned state of the
> > > page. There does not appear to be a viable workaround for this
> > > behaviour so simply disable HIGHPTE for all Xen guests.
> > 
> > This patch breaks compilation of the current 2.6.33 -stable queue and might
> > also affect queue-2.6.32 (untested):
> > 
> >   CC      arch/x86/xen/enlighten.o
> > arch/x86/xen/enlighten.c: In function ‘xen_start_kernel’:
> > arch/x86/xen/enlighten.c:1102: error: ‘__userpte_alloc_gfp’ undeclared (first use in this function)
> > arch/x86/xen/enlighten.c:1102: error: (Each undeclared identifier is reported only once
> > arch/x86/xen/enlighten.c:1102: error: for each function it appears in.)
> > make[2]: *** [arch/x86/xen/enlighten.o] Error 1
> > make[1]: *** [arch/x86/xen] Error 2
> > 
> > as it seems to depend (tested) on:
> > 
> > commit 14315592009c17035cac81f4954d5a1f4d71e489
> > Author: Ian Campbell <ian.campbell@citrix.com>
> > Date:   Wed Feb 17 10:38:10 2010 +0000
> > 
> >     x86, mm: Allow highmem user page tables to be disabled at boot time
> 
> Thanks Stefan, this is indeed the correct fix. I pointed Greg to this
> patch in private mail this morning.

I've just added it.  Odd that the kernel doesn't fail on my builds.  Oh,
I'm not enabling Xen, that's why, my fault...

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-03-12 16:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-11 19:32 patch x86-xen-disable-highmem-pte-allocation-even-when-config_highpte-y.patch added to 2.6.33-stable tree gregkh
2010-03-12 14:08 ` Stefan Lippers-Hollmann
2010-03-12 14:17   ` Ian Campbell
2010-03-12 16:35     ` Greg KH

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).