* [PATCH] GBPAGES: Fix global bit for 64bit
@ 2008-01-31 13:19 Andi Kleen
2008-01-31 16:43 ` Jeremy Fitzhardinge
0 siblings, 1 reply; 3+ messages in thread
From: Andi Kleen @ 2008-01-31 13:19 UTC (permalink / raw)
To: mingo, tglx; +Cc: jeremy, linux-kernel
[Ideally apply before the patch to enable gbpages direct mapping]
The gbpages direct patch assumed that __PAGE_KERNEL contains _PAGE_GLOBAL
(I think because that was true at some point in git-x86 and i forgot
to remove it again when forward porting)
This is currently true on 32bit, but not on 64bit which does not make
much sense. Add it to 64bit too. Also get rid of the obsolete MAKE_GLOBAL.
Signed-off-by: Andi Kleen <ak@suse.de>
Index: linux/include/asm-x86/pgtable.h
===================================================================
--- linux.orig/include/asm-x86/pgtable.h
+++ linux/include/asm-x86/pgtable.h
@@ -69,11 +69,13 @@
#define _PAGE_KERNEL (_PAGE_KERNEL_EXEC | _PAGE_NX)
#ifndef __ASSEMBLY__
+/* These are set up based on CPUID capabilities */
extern pteval_t __PAGE_KERNEL, __PAGE_KERNEL_EXEC;
#endif /* __ASSEMBLY__ */
#else
+/* 64bit can assume more CPUID capabilities */
#define __PAGE_KERNEL_EXEC \
- (_PAGE_PRESENT | _PAGE_RW | _PAGE_DIRTY | _PAGE_ACCESSED)
+ (_PAGE_PRESENT | _PAGE_RW | _PAGE_DIRTY | _PAGE_ACCESSED | _PAGE_GLOBAL)
#define __PAGE_KERNEL (__PAGE_KERNEL_EXEC | _PAGE_NX)
#endif
@@ -86,22 +88,16 @@ extern pteval_t __PAGE_KERNEL, __PAGE_KE
#define __PAGE_KERNEL_LARGE (__PAGE_KERNEL | _PAGE_PSE)
#define __PAGE_KERNEL_LARGE_EXEC (__PAGE_KERNEL_EXEC | _PAGE_PSE)
-#ifdef CONFIG_X86_32
-# define MAKE_GLOBAL(x) __pgprot((x))
-#else
-# define MAKE_GLOBAL(x) __pgprot((x) | _PAGE_GLOBAL)
-#endif
-
-#define PAGE_KERNEL MAKE_GLOBAL(__PAGE_KERNEL)
-#define PAGE_KERNEL_RO MAKE_GLOBAL(__PAGE_KERNEL_RO)
-#define PAGE_KERNEL_EXEC MAKE_GLOBAL(__PAGE_KERNEL_EXEC)
-#define PAGE_KERNEL_RX MAKE_GLOBAL(__PAGE_KERNEL_RX)
-#define PAGE_KERNEL_NOCACHE MAKE_GLOBAL(__PAGE_KERNEL_NOCACHE)
-#define PAGE_KERNEL_EXEC_NOCACHE MAKE_GLOBAL(__PAGE_KERNEL_EXEC_NOCACHE)
-#define PAGE_KERNEL_LARGE MAKE_GLOBAL(__PAGE_KERNEL_LARGE)
-#define PAGE_KERNEL_LARGE_EXEC MAKE_GLOBAL(__PAGE_KERNEL_LARGE_EXEC)
-#define PAGE_KERNEL_VSYSCALL MAKE_GLOBAL(__PAGE_KERNEL_VSYSCALL)
-#define PAGE_KERNEL_VSYSCALL_NOCACHE MAKE_GLOBAL(__PAGE_KERNEL_VSYSCALL_NOCACHE)
+#define PAGE_KERNEL __pgprot(__PAGE_KERNEL)
+#define PAGE_KERNEL_RO __pgprot(__PAGE_KERNEL_RO)
+#define PAGE_KERNEL_EXEC __pgprot(__PAGE_KERNEL_EXEC)
+#define PAGE_KERNEL_RX __pgprot(__PAGE_KERNEL_RX)
+#define PAGE_KERNEL_NOCACHE __pgprot(__PAGE_KERNEL_NOCACHE)
+#define PAGE_KERNEL_EXEC_NOCACHE __pgprot(__PAGE_KERNEL_EXEC_NOCACHE)
+#define PAGE_KERNEL_LARGE __pgprot(__PAGE_KERNEL_LARGE)
+#define PAGE_KERNEL_LARGE_EXEC __pgprot(__PAGE_KERNEL_LARGE_EXEC)
+#define PAGE_KERNEL_VSYSCALL __pgprot(__PAGE_KERNEL_VSYSCALL)
+#define PAGE_KERNEL_VSYSCALL_NOCACHE __pgprot(__PAGE_KERNEL_VSYSCALL_NOCACHE)
/* xwr */
#define __P000 PAGE_NONE
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] GBPAGES: Fix global bit for 64bit
2008-01-31 13:19 [PATCH] GBPAGES: Fix global bit for 64bit Andi Kleen
@ 2008-01-31 16:43 ` Jeremy Fitzhardinge
2008-01-31 18:35 ` Andi Kleen
0 siblings, 1 reply; 3+ messages in thread
From: Jeremy Fitzhardinge @ 2008-01-31 16:43 UTC (permalink / raw)
To: Andi Kleen; +Cc: mingo, tglx, linux-kernel
Andi Kleen wrote:
> [Ideally apply before the patch to enable gbpages direct mapping]
>
> The gbpages direct patch assumed that __PAGE_KERNEL contains _PAGE_GLOBAL
> (I think because that was true at some point in git-x86 and i forgot
> to remove it again when forward porting)
>
> This is currently true on 32bit, but not on 64bit which does not make
> much sense. Add it to 64bit too. Also get rid of the obsolete MAKE_GLOBAL.
>
Last time when my patch to do this was in the tree, it caused random
things to fail, even after increasing the strength of various tlb
flushes. Did you change something to fix this?
J
> Signed-off-by: Andi Kleen <ak@suse.de>
>
> Index: linux/include/asm-x86/pgtable.h
> ===================================================================
> --- linux.orig/include/asm-x86/pgtable.h
> +++ linux/include/asm-x86/pgtable.h
> @@ -69,11 +69,13 @@
> #define _PAGE_KERNEL (_PAGE_KERNEL_EXEC | _PAGE_NX)
>
> #ifndef __ASSEMBLY__
> +/* These are set up based on CPUID capabilities */
> extern pteval_t __PAGE_KERNEL, __PAGE_KERNEL_EXEC;
> #endif /* __ASSEMBLY__ */
> #else
> +/* 64bit can assume more CPUID capabilities */
> #define __PAGE_KERNEL_EXEC \
> - (_PAGE_PRESENT | _PAGE_RW | _PAGE_DIRTY | _PAGE_ACCESSED)
> + (_PAGE_PRESENT | _PAGE_RW | _PAGE_DIRTY | _PAGE_ACCESSED | _PAGE_GLOBAL)
> #define __PAGE_KERNEL (__PAGE_KERNEL_EXEC | _PAGE_NX)
> #endif
>
> @@ -86,22 +88,16 @@ extern pteval_t __PAGE_KERNEL, __PAGE_KE
> #define __PAGE_KERNEL_LARGE (__PAGE_KERNEL | _PAGE_PSE)
> #define __PAGE_KERNEL_LARGE_EXEC (__PAGE_KERNEL_EXEC | _PAGE_PSE)
>
> -#ifdef CONFIG_X86_32
> -# define MAKE_GLOBAL(x) __pgprot((x))
> -#else
> -# define MAKE_GLOBAL(x) __pgprot((x) | _PAGE_GLOBAL)
> -#endif
> -
> -#define PAGE_KERNEL MAKE_GLOBAL(__PAGE_KERNEL)
> -#define PAGE_KERNEL_RO MAKE_GLOBAL(__PAGE_KERNEL_RO)
> -#define PAGE_KERNEL_EXEC MAKE_GLOBAL(__PAGE_KERNEL_EXEC)
> -#define PAGE_KERNEL_RX MAKE_GLOBAL(__PAGE_KERNEL_RX)
> -#define PAGE_KERNEL_NOCACHE MAKE_GLOBAL(__PAGE_KERNEL_NOCACHE)
> -#define PAGE_KERNEL_EXEC_NOCACHE MAKE_GLOBAL(__PAGE_KERNEL_EXEC_NOCACHE)
> -#define PAGE_KERNEL_LARGE MAKE_GLOBAL(__PAGE_KERNEL_LARGE)
> -#define PAGE_KERNEL_LARGE_EXEC MAKE_GLOBAL(__PAGE_KERNEL_LARGE_EXEC)
> -#define PAGE_KERNEL_VSYSCALL MAKE_GLOBAL(__PAGE_KERNEL_VSYSCALL)
> -#define PAGE_KERNEL_VSYSCALL_NOCACHE MAKE_GLOBAL(__PAGE_KERNEL_VSYSCALL_NOCACHE)
> +#define PAGE_KERNEL __pgprot(__PAGE_KERNEL)
> +#define PAGE_KERNEL_RO __pgprot(__PAGE_KERNEL_RO)
> +#define PAGE_KERNEL_EXEC __pgprot(__PAGE_KERNEL_EXEC)
> +#define PAGE_KERNEL_RX __pgprot(__PAGE_KERNEL_RX)
> +#define PAGE_KERNEL_NOCACHE __pgprot(__PAGE_KERNEL_NOCACHE)
> +#define PAGE_KERNEL_EXEC_NOCACHE __pgprot(__PAGE_KERNEL_EXEC_NOCACHE)
> +#define PAGE_KERNEL_LARGE __pgprot(__PAGE_KERNEL_LARGE)
> +#define PAGE_KERNEL_LARGE_EXEC __pgprot(__PAGE_KERNEL_LARGE_EXEC)
> +#define PAGE_KERNEL_VSYSCALL __pgprot(__PAGE_KERNEL_VSYSCALL)
> +#define PAGE_KERNEL_VSYSCALL_NOCACHE __pgprot(__PAGE_KERNEL_VSYSCALL_NOCACHE)
>
> /* xwr */
> #define __P000 PAGE_NONE
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] GBPAGES: Fix global bit for 64bit
2008-01-31 16:43 ` Jeremy Fitzhardinge
@ 2008-01-31 18:35 ` Andi Kleen
0 siblings, 0 replies; 3+ messages in thread
From: Andi Kleen @ 2008-01-31 18:35 UTC (permalink / raw)
To: Jeremy Fitzhardinge; +Cc: Andi Kleen, mingo, tglx, linux-kernel
> Last time when my patch to do this was in the tree, it caused random
> things to fail, even after increasing the strength of various tlb
> flushes. Did you change something to fix this?
At least all the flushes in init_64 are global now.
But my latest iteration of gbpages actually doesn't need this patch anymore
because I'm back to using PAGE_KERNEL_LARGE (without underscores)
-Andi
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-01-31 18:01 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-31 13:19 [PATCH] GBPAGES: Fix global bit for 64bit Andi Kleen
2008-01-31 16:43 ` Jeremy Fitzhardinge
2008-01-31 18:35 ` Andi Kleen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox