linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00 of 36] x86: clean up pte functions in pgtable*.h
@ 2009-02-05 19:30 Jeremy Fitzhardinge
  2009-02-05 19:30 ` [PATCH 01 of 36] x86: unify pte_none Jeremy Fitzhardinge
                   ` (35 more replies)
  0 siblings, 36 replies; 42+ messages in thread
From: Jeremy Fitzhardinge @ 2009-02-05 19:30 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: linux-kernel, the arch/x86 maintainers

Hi Ingo,

Here's a bunch of tiny patches to move as much as possible from
pgtable_*.h to pgtable.h.  This serves two purposes:

 1. There was a lot of redundancy in there, so there's a fair amount
    of unification, and

 2. Moves all the pte-manipulation into one place, to make further
    header restructuring easier.

Lightly built on 32 and 64-bit pvops, and 64-bit non-pvops configs.
64-bit test boot under kvm.

Thanks,
	J


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

* [PATCH 01 of 36] x86: unify pte_none
  2009-02-05 19:30 [PATCH 00 of 36] x86: clean up pte functions in pgtable*.h Jeremy Fitzhardinge
@ 2009-02-05 19:30 ` Jeremy Fitzhardinge
  2009-02-05 19:30 ` [PATCH 02 of 36] x86: unify pte_same Jeremy Fitzhardinge
                   ` (34 subsequent siblings)
  35 siblings, 0 replies; 42+ messages in thread
From: Jeremy Fitzhardinge @ 2009-02-05 19:30 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: linux-kernel, the arch/x86 maintainers

Impact: cleanup

Unify and demacro pte_none.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
---
 arch/x86/include/asm/pgtable-2level.h |    2 --
 arch/x86/include/asm/pgtable-3level.h |    5 -----
 arch/x86/include/asm/pgtable.h        |    5 +++++
 arch/x86/include/asm/pgtable_64.h     |    1 -
 4 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/arch/x86/include/asm/pgtable-2level.h b/arch/x86/include/asm/pgtable-2level.h
--- a/arch/x86/include/asm/pgtable-2level.h
+++ b/arch/x86/include/asm/pgtable-2level.h
@@ -53,8 +53,6 @@
 #define native_ptep_get_and_clear(xp) native_local_ptep_get_and_clear(xp)
 #endif
 
-#define pte_none(x)		(!(x).pte_low)
-
 /*
  * Bits _PAGE_BIT_PRESENT, _PAGE_BIT_FILE and _PAGE_BIT_PROTNONE are taken,
  * split up the 29 bits of offset into this range:
diff --git a/arch/x86/include/asm/pgtable-3level.h b/arch/x86/include/asm/pgtable-3level.h
--- a/arch/x86/include/asm/pgtable-3level.h
+++ b/arch/x86/include/asm/pgtable-3level.h
@@ -151,11 +151,6 @@
 	return a.pte_low == b.pte_low && a.pte_high == b.pte_high;
 }
 
-static inline int pte_none(pte_t pte)
-{
-	return !pte.pte_low && !pte.pte_high;
-}
-
 /*
  * Bits 0, 6 and 7 are taken in the low part of the pte,
  * put the 32 bits of offset into the high part.
diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h
--- a/arch/x86/include/asm/pgtable.h
+++ b/arch/x86/include/asm/pgtable.h
@@ -457,6 +457,11 @@
 }
 #endif	/* CONFIG_PARAVIRT */
 
+static inline int pte_none(pte_t pte)
+{
+	return !pte.pte;
+}
+
 #endif	/* __ASSEMBLY__ */
 
 #ifdef CONFIG_X86_32
diff --git a/arch/x86/include/asm/pgtable_64.h b/arch/x86/include/asm/pgtable_64.h
--- a/arch/x86/include/asm/pgtable_64.h
+++ b/arch/x86/include/asm/pgtable_64.h
@@ -170,7 +170,6 @@
 	return (pmd_val(pmd) & ~(PTE_PFN_MASK | _PAGE_USER)) != _KERNPG_TABLE;
 }
 
-#define pte_none(x)	(!pte_val((x)))
 #define pte_present(x)	(pte_val((x)) & (_PAGE_PRESENT | _PAGE_PROTNONE))
 
 #ifdef CONFIG_KMEMCHECK



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

* [PATCH 02 of 36] x86: unify pte_same
  2009-02-05 19:30 [PATCH 00 of 36] x86: clean up pte functions in pgtable*.h Jeremy Fitzhardinge
  2009-02-05 19:30 ` [PATCH 01 of 36] x86: unify pte_none Jeremy Fitzhardinge
@ 2009-02-05 19:30 ` Jeremy Fitzhardinge
  2009-02-05 19:30 ` [PATCH 03 of 36] x86: unify pte_present Jeremy Fitzhardinge
                   ` (33 subsequent siblings)
  35 siblings, 0 replies; 42+ messages in thread
From: Jeremy Fitzhardinge @ 2009-02-05 19:30 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: linux-kernel, the arch/x86 maintainers

Impact: cleanup

Unify and demacro pte_same.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
---
 arch/x86/include/asm/pgtable-3level.h |    6 ------
 arch/x86/include/asm/pgtable.h        |    6 ++++++
 arch/x86/include/asm/pgtable_64.h     |    2 --
 3 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/arch/x86/include/asm/pgtable-3level.h b/arch/x86/include/asm/pgtable-3level.h
--- a/arch/x86/include/asm/pgtable-3level.h
+++ b/arch/x86/include/asm/pgtable-3level.h
@@ -145,12 +145,6 @@
 #define native_ptep_get_and_clear(xp) native_local_ptep_get_and_clear(xp)
 #endif
 
-#define __HAVE_ARCH_PTE_SAME
-static inline int pte_same(pte_t a, pte_t b)
-{
-	return a.pte_low == b.pte_low && a.pte_high == b.pte_high;
-}
-
 /*
  * Bits 0, 6 and 7 are taken in the low part of the pte,
  * put the 32 bits of offset into the high part.
diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h
--- a/arch/x86/include/asm/pgtable.h
+++ b/arch/x86/include/asm/pgtable.h
@@ -462,6 +462,12 @@
 	return !pte.pte;
 }
 
+#define __HAVE_ARCH_PTE_SAME
+static inline int pte_same(pte_t a, pte_t b)
+{
+	return a.pte == b.pte;
+}
+
 #endif	/* __ASSEMBLY__ */
 
 #ifdef CONFIG_X86_32
diff --git a/arch/x86/include/asm/pgtable_64.h b/arch/x86/include/asm/pgtable_64.h
--- a/arch/x86/include/asm/pgtable_64.h
+++ b/arch/x86/include/asm/pgtable_64.h
@@ -133,8 +133,6 @@
 	native_set_pgd(pgd, native_make_pgd(0));
 }
 
-#define pte_same(a, b)		((a).pte == (b).pte)
-
 #endif /* !__ASSEMBLY__ */
 
 #define PMD_SIZE	(_AC(1, UL) << PMD_SHIFT)



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

* [PATCH 03 of 36] x86: unify pte_present
  2009-02-05 19:30 [PATCH 00 of 36] x86: clean up pte functions in pgtable*.h Jeremy Fitzhardinge
  2009-02-05 19:30 ` [PATCH 01 of 36] x86: unify pte_none Jeremy Fitzhardinge
  2009-02-05 19:30 ` [PATCH 02 of 36] x86: unify pte_same Jeremy Fitzhardinge
@ 2009-02-05 19:30 ` Jeremy Fitzhardinge
  2009-02-05 19:30 ` [PATCH 04 of 36] x86: make _PAGE_HIDDEN conditional Jeremy Fitzhardinge
                   ` (32 subsequent siblings)
  35 siblings, 0 replies; 42+ messages in thread
From: Jeremy Fitzhardinge @ 2009-02-05 19:30 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: linux-kernel, the arch/x86 maintainers

Impact: cleanup

Unify and demacro pte_present.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
---
 arch/x86/include/asm/pgtable.h    |    5 +++++
 arch/x86/include/asm/pgtable_32.h |    2 --
 arch/x86/include/asm/pgtable_64.h |    2 --
 3 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h
--- a/arch/x86/include/asm/pgtable.h
+++ b/arch/x86/include/asm/pgtable.h
@@ -468,6 +468,11 @@
 	return a.pte == b.pte;
 }
 
+static inline int pte_present(pte_t a)
+{
+	return pte_flags(a) & (_PAGE_PRESENT | _PAGE_PROTNONE);
+}
+
 #endif	/* __ASSEMBLY__ */
 
 #ifdef CONFIG_X86_32
diff --git a/arch/x86/include/asm/pgtable_32.h b/arch/x86/include/asm/pgtable_32.h
--- a/arch/x86/include/asm/pgtable_32.h
+++ b/arch/x86/include/asm/pgtable_32.h
@@ -85,8 +85,6 @@
 /* The boot page tables (all created as a single array) */
 extern unsigned long pg0[];
 
-#define pte_present(x)	((x).pte_low & (_PAGE_PRESENT | _PAGE_PROTNONE))
-
 #ifdef CONFIG_KMEMCHECK
 #define pte_hidden(x)	((x).pte_low & (_PAGE_HIDDEN))
 #else
diff --git a/arch/x86/include/asm/pgtable_64.h b/arch/x86/include/asm/pgtable_64.h
--- a/arch/x86/include/asm/pgtable_64.h
+++ b/arch/x86/include/asm/pgtable_64.h
@@ -168,8 +168,6 @@
 	return (pmd_val(pmd) & ~(PTE_PFN_MASK | _PAGE_USER)) != _KERNPG_TABLE;
 }
 
-#define pte_present(x)	(pte_val((x)) & (_PAGE_PRESENT | _PAGE_PROTNONE))
-
 #ifdef CONFIG_KMEMCHECK
 #define pte_hidden(x)	(pte_val((x)) & (_PAGE_HIDDEN))
 #else



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

* [PATCH 04 of 36] x86: make _PAGE_HIDDEN conditional
  2009-02-05 19:30 [PATCH 00 of 36] x86: clean up pte functions in pgtable*.h Jeremy Fitzhardinge
                   ` (2 preceding siblings ...)
  2009-02-05 19:30 ` [PATCH 03 of 36] x86: unify pte_present Jeremy Fitzhardinge
@ 2009-02-05 19:30 ` Jeremy Fitzhardinge
  2009-02-05 19:30 ` [PATCH 05 of 36] x86: unify pte_hidden Jeremy Fitzhardinge
                   ` (31 subsequent siblings)
  35 siblings, 0 replies; 42+ messages in thread
From: Jeremy Fitzhardinge @ 2009-02-05 19:30 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: linux-kernel, the arch/x86 maintainers

Only _PAGE_HIDDEN when CONFIG_KMEMCHECK is defined, otherwise set it
to 0.  Allows later cleanups.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
---
 arch/x86/include/asm/pgtable.h |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h
--- a/arch/x86/include/asm/pgtable.h
+++ b/arch/x86/include/asm/pgtable.h
@@ -38,13 +38,18 @@
 #define _PAGE_GLOBAL	(_AT(pteval_t, 1) << _PAGE_BIT_GLOBAL)
 #define _PAGE_UNUSED1	(_AT(pteval_t, 1) << _PAGE_BIT_UNUSED1)
 #define _PAGE_IOMAP	(_AT(pteval_t, 1) << _PAGE_BIT_IOMAP)
-#define _PAGE_HIDDEN	(_AT(pteval_t, 1) << _PAGE_BIT_HIDDEN)
 #define _PAGE_PAT	(_AT(pteval_t, 1) << _PAGE_BIT_PAT)
 #define _PAGE_PAT_LARGE (_AT(pteval_t, 1) << _PAGE_BIT_PAT_LARGE)
 #define _PAGE_SPECIAL	(_AT(pteval_t, 1) << _PAGE_BIT_SPECIAL)
 #define _PAGE_CPA_TEST	(_AT(pteval_t, 1) << _PAGE_BIT_CPA_TEST)
 #define __HAVE_ARCH_PTE_SPECIAL
 
+#ifdef CONFIG_KMEMCHECK
+#define _PAGE_HIDDEN	(_AT(pteval_t, 1) << _PAGE_BIT_HIDDEN)
+#else
+#define _PAGE_HIDDEN	(_AT(pteval_t, 0))
+#endif
+
 #if defined(CONFIG_X86_64) || defined(CONFIG_X86_PAE)
 #define _PAGE_NX	(_AT(pteval_t, 1) << _PAGE_BIT_NX)
 #else



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

* [PATCH 05 of 36] x86: unify pte_hidden
  2009-02-05 19:30 [PATCH 00 of 36] x86: clean up pte functions in pgtable*.h Jeremy Fitzhardinge
                   ` (3 preceding siblings ...)
  2009-02-05 19:30 ` [PATCH 04 of 36] x86: make _PAGE_HIDDEN conditional Jeremy Fitzhardinge
@ 2009-02-05 19:30 ` Jeremy Fitzhardinge
  2009-02-05 19:30 ` [PATCH 06 of 36] x86: unify pud_present Jeremy Fitzhardinge
                   ` (30 subsequent siblings)
  35 siblings, 0 replies; 42+ messages in thread
From: Jeremy Fitzhardinge @ 2009-02-05 19:30 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: linux-kernel, the arch/x86 maintainers

Impact: cleanup

Unify and demacro pte_hidden.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
---
 arch/x86/include/asm/pgtable.h    |    5 +++++
 arch/x86/include/asm/pgtable_32.h |    6 ------
 arch/x86/include/asm/pgtable_64.h |    6 ------
 3 files changed, 5 insertions(+), 12 deletions(-)

diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h
--- a/arch/x86/include/asm/pgtable.h
+++ b/arch/x86/include/asm/pgtable.h
@@ -478,6 +478,11 @@
 	return pte_flags(a) & (_PAGE_PRESENT | _PAGE_PROTNONE);
 }
 
+static inline int pte_hidden(pte_t pte)
+{
+	return pte_flags(pte) & _PAGE_HIDDEN;
+}
+
 #endif	/* __ASSEMBLY__ */
 
 #ifdef CONFIG_X86_32
diff --git a/arch/x86/include/asm/pgtable_32.h b/arch/x86/include/asm/pgtable_32.h
--- a/arch/x86/include/asm/pgtable_32.h
+++ b/arch/x86/include/asm/pgtable_32.h
@@ -85,12 +85,6 @@
 /* The boot page tables (all created as a single array) */
 extern unsigned long pg0[];
 
-#ifdef CONFIG_KMEMCHECK
-#define pte_hidden(x)	((x).pte_low & (_PAGE_HIDDEN))
-#else
-#define pte_hidden(x)	0
-#endif
-
 /* To avoid harmful races, pmd_none(x) should check only the lower when PAE */
 #define pmd_none(x)	(!(unsigned long)pmd_val((x)))
 #define pmd_present(x)	(pmd_val((x)) & _PAGE_PRESENT)
diff --git a/arch/x86/include/asm/pgtable_64.h b/arch/x86/include/asm/pgtable_64.h
--- a/arch/x86/include/asm/pgtable_64.h
+++ b/arch/x86/include/asm/pgtable_64.h
@@ -168,12 +168,6 @@
 	return (pmd_val(pmd) & ~(PTE_PFN_MASK | _PAGE_USER)) != _KERNPG_TABLE;
 }
 
-#ifdef CONFIG_KMEMCHECK
-#define pte_hidden(x)	(pte_val((x)) & (_PAGE_HIDDEN))
-#else
-#define pte_hidden(x)	0
-#endif
-
 #define pages_to_mb(x)	((x) >> (20 - PAGE_SHIFT))   /* FIXME: is this right? */
 
 /*



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

* [PATCH 06 of 36] x86: unify pud_present
  2009-02-05 19:30 [PATCH 00 of 36] x86: clean up pte functions in pgtable*.h Jeremy Fitzhardinge
                   ` (4 preceding siblings ...)
  2009-02-05 19:30 ` [PATCH 05 of 36] x86: unify pte_hidden Jeremy Fitzhardinge
@ 2009-02-05 19:30 ` Jeremy Fitzhardinge
  2009-02-05 19:30 ` [PATCH 07 of 36] x86: unify pgd_present Jeremy Fitzhardinge
                   ` (29 subsequent siblings)
  35 siblings, 0 replies; 42+ messages in thread
From: Jeremy Fitzhardinge @ 2009-02-05 19:30 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: linux-kernel, the arch/x86 maintainers

Impact: cleanup

Unify and demacro pud_present.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
---
 arch/x86/include/asm/pgtable-3level.h |    5 -----
 arch/x86/include/asm/pgtable.h        |    7 +++++++
 arch/x86/include/asm/pgtable_64.h     |    1 -
 3 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/arch/x86/include/asm/pgtable-3level.h b/arch/x86/include/asm/pgtable-3level.h
--- a/arch/x86/include/asm/pgtable-3level.h
+++ b/arch/x86/include/asm/pgtable-3level.h
@@ -28,11 +28,6 @@
 	return (pud_val(pud) & ~(PTE_PFN_MASK | _KERNPG_TABLE | _PAGE_USER)) != 0;
 }
 
-static inline int pud_present(pud_t pud)
-{
-	return pud_val(pud) & _PAGE_PRESENT;
-}
-
 /* Rules for using set_pte: the pte being assigned *must* be
  * either not present or in a state where the hardware will
  * not attempt to update the pte.  In places where this is
diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h
--- a/arch/x86/include/asm/pgtable.h
+++ b/arch/x86/include/asm/pgtable.h
@@ -483,6 +483,13 @@
 	return pte_flags(pte) & _PAGE_HIDDEN;
 }
 
+#if PAGETABLE_LEVELS > 2
+static inline int pud_present(pud_t pud)
+{
+	return pud_val(pud) & _PAGE_PRESENT;
+}
+#endif	/* PAGETABLE_LEVELS > 2 */
+
 #endif	/* __ASSEMBLY__ */
 
 #ifdef CONFIG_X86_32
diff --git a/arch/x86/include/asm/pgtable_64.h b/arch/x86/include/asm/pgtable_64.h
--- a/arch/x86/include/asm/pgtable_64.h
+++ b/arch/x86/include/asm/pgtable_64.h
@@ -193,7 +193,6 @@
 #define pud_index(address) (((address) >> PUD_SHIFT) & (PTRS_PER_PUD - 1))
 #define pud_offset(pgd, address)					\
 	((pud_t *)pgd_page_vaddr(*(pgd)) + pud_index((address)))
-#define pud_present(pud) (pud_val((pud)) & _PAGE_PRESENT)
 
 static inline int pud_large(pud_t pte)
 {



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

* [PATCH 07 of 36] x86: unify pgd_present
  2009-02-05 19:30 [PATCH 00 of 36] x86: clean up pte functions in pgtable*.h Jeremy Fitzhardinge
                   ` (5 preceding siblings ...)
  2009-02-05 19:30 ` [PATCH 06 of 36] x86: unify pud_present Jeremy Fitzhardinge
@ 2009-02-05 19:30 ` Jeremy Fitzhardinge
  2009-02-05 19:30 ` [PATCH 08 of 36] x86: unify pmd_present Jeremy Fitzhardinge
                   ` (28 subsequent siblings)
  35 siblings, 0 replies; 42+ messages in thread
From: Jeremy Fitzhardinge @ 2009-02-05 19:30 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: linux-kernel, the arch/x86 maintainers

Impact: cleanup

Unify and demacro pgd_present.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
---
 arch/x86/include/asm/pgtable.h    |    7 +++++++
 arch/x86/include/asm/pgtable_64.h |    1 -
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h
--- a/arch/x86/include/asm/pgtable.h
+++ b/arch/x86/include/asm/pgtable.h
@@ -490,6 +490,13 @@
 }
 #endif	/* PAGETABLE_LEVELS > 2 */
 
+#if PAGETABLE_LEVELS > 3
+static inline int pgd_present(pgd_t pgd)
+{
+	return pgd_val(pgd) & _PAGE_PRESENT;
+}
+#endif	/* PAGETABLE_LEVELS > 3 */
+
 #endif	/* __ASSEMBLY__ */
 
 #ifdef CONFIG_X86_32
diff --git a/arch/x86/include/asm/pgtable_64.h b/arch/x86/include/asm/pgtable_64.h
--- a/arch/x86/include/asm/pgtable_64.h
+++ b/arch/x86/include/asm/pgtable_64.h
@@ -181,7 +181,6 @@
 #define pgd_page_vaddr(pgd)						\
 	((unsigned long)__va((unsigned long)pgd_val((pgd)) & PTE_PFN_MASK))
 #define pgd_page(pgd)		(pfn_to_page(pgd_val((pgd)) >> PAGE_SHIFT))
-#define pgd_present(pgd) (pgd_val(pgd) & _PAGE_PRESENT)
 static inline int pgd_large(pgd_t pgd) { return 0; }
 #define mk_kernel_pgd(address) __pgd((address) | _KERNPG_TABLE)
 



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

* [PATCH 08 of 36] x86: unify pmd_present
  2009-02-05 19:30 [PATCH 00 of 36] x86: clean up pte functions in pgtable*.h Jeremy Fitzhardinge
                   ` (6 preceding siblings ...)
  2009-02-05 19:30 ` [PATCH 07 of 36] x86: unify pgd_present Jeremy Fitzhardinge
@ 2009-02-05 19:30 ` Jeremy Fitzhardinge
  2009-02-05 19:30 ` [PATCH 09 of 36] x86: unify pmd_none Jeremy Fitzhardinge
                   ` (27 subsequent siblings)
  35 siblings, 0 replies; 42+ messages in thread
From: Jeremy Fitzhardinge @ 2009-02-05 19:30 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: linux-kernel, the arch/x86 maintainers

Impact: cleanup

Unify and demacro pmd_present.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
---
 arch/x86/include/asm/pgtable.h    |    5 +++++
 arch/x86/include/asm/pgtable_32.h |    1 -
 arch/x86/include/asm/pgtable_64.h |    1 -
 3 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h
--- a/arch/x86/include/asm/pgtable.h
+++ b/arch/x86/include/asm/pgtable.h
@@ -483,6 +483,11 @@
 	return pte_flags(pte) & _PAGE_HIDDEN;
 }
 
+static inline int pmd_present(pmd_t pmd)
+{
+	return pmd_val(pmd) & _PAGE_PRESENT;
+}
+
 #if PAGETABLE_LEVELS > 2
 static inline int pud_present(pud_t pud)
 {
diff --git a/arch/x86/include/asm/pgtable_32.h b/arch/x86/include/asm/pgtable_32.h
--- a/arch/x86/include/asm/pgtable_32.h
+++ b/arch/x86/include/asm/pgtable_32.h
@@ -87,7 +87,6 @@
 
 /* To avoid harmful races, pmd_none(x) should check only the lower when PAE */
 #define pmd_none(x)	(!(unsigned long)pmd_val((x)))
-#define pmd_present(x)	(pmd_val((x)) & _PAGE_PRESENT)
 #define pmd_bad(x) ((pmd_val(x) & (PTE_FLAGS_MASK & ~_PAGE_USER)) != _KERNPG_TABLE)
 
 #define pages_to_mb(x) ((x) >> (20-PAGE_SHIFT))
diff --git a/arch/x86/include/asm/pgtable_64.h b/arch/x86/include/asm/pgtable_64.h
--- a/arch/x86/include/asm/pgtable_64.h
+++ b/arch/x86/include/asm/pgtable_64.h
@@ -207,7 +207,6 @@
 #define pmd_offset(dir, address) ((pmd_t *)pud_page_vaddr(*(dir)) + \
 				  pmd_index(address))
 #define pmd_none(x)	(!pmd_val((x)))
-#define pmd_present(x)	(pmd_val((x)) & _PAGE_PRESENT)
 #define pfn_pmd(nr, prot) (__pmd(((nr) << PAGE_SHIFT) | pgprot_val((prot))))
 #define pmd_pfn(x)  ((pmd_val((x)) & __PHYSICAL_MASK) >> PAGE_SHIFT)
 



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

* [PATCH 09 of 36] x86: unify pmd_none
  2009-02-05 19:30 [PATCH 00 of 36] x86: clean up pte functions in pgtable*.h Jeremy Fitzhardinge
                   ` (7 preceding siblings ...)
  2009-02-05 19:30 ` [PATCH 08 of 36] x86: unify pmd_present Jeremy Fitzhardinge
@ 2009-02-05 19:30 ` Jeremy Fitzhardinge
  2009-02-05 19:30 ` [PATCH 10 of 36] x86: unify pgd_page_vaddr Jeremy Fitzhardinge
                   ` (26 subsequent siblings)
  35 siblings, 0 replies; 42+ messages in thread
From: Jeremy Fitzhardinge @ 2009-02-05 19:30 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: linux-kernel, the arch/x86 maintainers

Impact: cleanup

Unify and demacro pmd_none.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
---
 arch/x86/include/asm/pgtable.h    |    7 +++++++
 arch/x86/include/asm/pgtable_32.h |    2 --
 arch/x86/include/asm/pgtable_64.h |    1 -
 3 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h
--- a/arch/x86/include/asm/pgtable.h
+++ b/arch/x86/include/asm/pgtable.h
@@ -488,6 +488,13 @@
 	return pmd_val(pmd) & _PAGE_PRESENT;
 }
 
+static inline int pmd_none(pmd_t pmd)
+{
+	/* Only check low word on 32-bit platforms, since it might be
+	   out of sync with upper half. */
+	return !(unsigned long)native_pmd_val(pmd);
+}
+
 #if PAGETABLE_LEVELS > 2
 static inline int pud_present(pud_t pud)
 {
diff --git a/arch/x86/include/asm/pgtable_32.h b/arch/x86/include/asm/pgtable_32.h
--- a/arch/x86/include/asm/pgtable_32.h
+++ b/arch/x86/include/asm/pgtable_32.h
@@ -85,8 +85,6 @@
 /* The boot page tables (all created as a single array) */
 extern unsigned long pg0[];
 
-/* To avoid harmful races, pmd_none(x) should check only the lower when PAE */
-#define pmd_none(x)	(!(unsigned long)pmd_val((x)))
 #define pmd_bad(x) ((pmd_val(x) & (PTE_FLAGS_MASK & ~_PAGE_USER)) != _KERNPG_TABLE)
 
 #define pages_to_mb(x) ((x) >> (20-PAGE_SHIFT))
diff --git a/arch/x86/include/asm/pgtable_64.h b/arch/x86/include/asm/pgtable_64.h
--- a/arch/x86/include/asm/pgtable_64.h
+++ b/arch/x86/include/asm/pgtable_64.h
@@ -206,7 +206,6 @@
 #define pmd_index(address) (((address) >> PMD_SHIFT) & (PTRS_PER_PMD - 1))
 #define pmd_offset(dir, address) ((pmd_t *)pud_page_vaddr(*(dir)) + \
 				  pmd_index(address))
-#define pmd_none(x)	(!pmd_val((x)))
 #define pfn_pmd(nr, prot) (__pmd(((nr) << PAGE_SHIFT) | pgprot_val((prot))))
 #define pmd_pfn(x)  ((pmd_val((x)) & __PHYSICAL_MASK) >> PAGE_SHIFT)
 



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

* [PATCH 10 of 36] x86: unify pgd_page_vaddr
  2009-02-05 19:30 [PATCH 00 of 36] x86: clean up pte functions in pgtable*.h Jeremy Fitzhardinge
                   ` (8 preceding siblings ...)
  2009-02-05 19:30 ` [PATCH 09 of 36] x86: unify pmd_none Jeremy Fitzhardinge
@ 2009-02-05 19:30 ` Jeremy Fitzhardinge
  2009-02-05 19:30 ` [PATCH 11 of 36] x86: unify pud_page_vaddr Jeremy Fitzhardinge
                   ` (25 subsequent siblings)
  35 siblings, 0 replies; 42+ messages in thread
From: Jeremy Fitzhardinge @ 2009-02-05 19:30 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: linux-kernel, the arch/x86 maintainers

Impact: cleanup

Unify and demacro pgd_page_vaddr.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
---
 arch/x86/include/asm/pgtable.h    |    5 +++++
 arch/x86/include/asm/pgtable_64.h |    2 --
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h
--- a/arch/x86/include/asm/pgtable.h
+++ b/arch/x86/include/asm/pgtable.h
@@ -507,6 +507,11 @@
 {
 	return pgd_val(pgd) & _PAGE_PRESENT;
 }
+
+static inline unsigned long pgd_page_vaddr(pgd_t pgd)
+{
+	return (unsigned long)__va((unsigned long)pgd_val(pgd) & PTE_PFN_MASK);
+}
 #endif	/* PAGETABLE_LEVELS > 3 */
 
 #endif	/* __ASSEMBLY__ */
diff --git a/arch/x86/include/asm/pgtable_64.h b/arch/x86/include/asm/pgtable_64.h
--- a/arch/x86/include/asm/pgtable_64.h
+++ b/arch/x86/include/asm/pgtable_64.h
@@ -178,8 +178,6 @@
 /*
  * Level 4 access.
  */
-#define pgd_page_vaddr(pgd)						\
-	((unsigned long)__va((unsigned long)pgd_val((pgd)) & PTE_PFN_MASK))
 #define pgd_page(pgd)		(pfn_to_page(pgd_val((pgd)) >> PAGE_SHIFT))
 static inline int pgd_large(pgd_t pgd) { return 0; }
 #define mk_kernel_pgd(address) __pgd((address) | _KERNPG_TABLE)



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

* [PATCH 11 of 36] x86: unify pud_page_vaddr
  2009-02-05 19:30 [PATCH 00 of 36] x86: clean up pte functions in pgtable*.h Jeremy Fitzhardinge
                   ` (9 preceding siblings ...)
  2009-02-05 19:30 ` [PATCH 10 of 36] x86: unify pgd_page_vaddr Jeremy Fitzhardinge
@ 2009-02-05 19:30 ` Jeremy Fitzhardinge
  2009-02-05 19:30 ` [PATCH 12 of 36] x86: include pgtable_SIZE.h earlier Jeremy Fitzhardinge
                   ` (24 subsequent siblings)
  35 siblings, 0 replies; 42+ messages in thread
From: Jeremy Fitzhardinge @ 2009-02-05 19:30 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: linux-kernel, the arch/x86 maintainers

Impact: cleanup

Unify and demacro pud_page_vaddr.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
---
 arch/x86/include/asm/pgtable-3level.h |    3 ---
 arch/x86/include/asm/pgtable.h        |    5 +++++
 arch/x86/include/asm/pgtable_64.h     |    2 --
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/arch/x86/include/asm/pgtable-3level.h b/arch/x86/include/asm/pgtable-3level.h
--- a/arch/x86/include/asm/pgtable-3level.h
+++ b/arch/x86/include/asm/pgtable-3level.h
@@ -117,9 +117,6 @@
 
 #define pud_page(pud) pfn_to_page(pud_val(pud) >> PAGE_SHIFT)
 
-#define pud_page_vaddr(pud) ((unsigned long) __va(pud_val(pud) & PTE_PFN_MASK))
-
-
 /* Find an entry in the second-level page table.. */
 #define pmd_offset(pud, address) ((pmd_t *)pud_page_vaddr(*(pud)) +	\
 				  pmd_index(address))
diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h
--- a/arch/x86/include/asm/pgtable.h
+++ b/arch/x86/include/asm/pgtable.h
@@ -500,6 +500,11 @@
 {
 	return pud_val(pud) & _PAGE_PRESENT;
 }
+
+static inline unsigned long pud_page_vaddr(pud_t pud)
+{
+	return (unsigned long)__va((unsigned long)pud_val(pud) & PTE_PFN_MASK);
+}
 #endif	/* PAGETABLE_LEVELS > 2 */
 
 #if PAGETABLE_LEVELS > 3
diff --git a/arch/x86/include/asm/pgtable_64.h b/arch/x86/include/asm/pgtable_64.h
--- a/arch/x86/include/asm/pgtable_64.h
+++ b/arch/x86/include/asm/pgtable_64.h
@@ -184,8 +184,6 @@
 
 /* PUD - Level3 access */
 /* to find an entry in a page-table-directory. */
-#define pud_page_vaddr(pud)						\
-	((unsigned long)__va(pud_val((pud)) & PHYSICAL_PAGE_MASK))
 #define pud_page(pud)	(pfn_to_page(pud_val((pud)) >> PAGE_SHIFT))
 #define pud_index(address) (((address) >> PUD_SHIFT) & (PTRS_PER_PUD - 1))
 #define pud_offset(pgd, address)					\



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

* [PATCH 12 of 36] x86: include pgtable_SIZE.h earlier
  2009-02-05 19:30 [PATCH 00 of 36] x86: clean up pte functions in pgtable*.h Jeremy Fitzhardinge
                   ` (10 preceding siblings ...)
  2009-02-05 19:30 ` [PATCH 11 of 36] x86: unify pud_page_vaddr Jeremy Fitzhardinge
@ 2009-02-05 19:30 ` Jeremy Fitzhardinge
  2009-02-05 19:30 ` [PATCH 13 of 36] x86: unify pud_page Jeremy Fitzhardinge
                   ` (23 subsequent siblings)
  35 siblings, 0 replies; 42+ messages in thread
From: Jeremy Fitzhardinge @ 2009-02-05 19:30 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: linux-kernel, the arch/x86 maintainers

We'll need the definitions sooner.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
---
 arch/x86/include/asm/pgtable.h |   16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h
--- a/arch/x86/include/asm/pgtable.h
+++ b/arch/x86/include/asm/pgtable.h
@@ -462,6 +462,16 @@
 }
 #endif	/* CONFIG_PARAVIRT */
 
+#endif	/* __ASSEMBLY__ */
+
+#ifdef CONFIG_X86_32
+# include "pgtable_32.h"
+#else
+# include "pgtable_64.h"
+#endif
+
+#ifndef __ASSEMBLY__
+
 static inline int pte_none(pte_t pte)
 {
 	return !pte.pte;
@@ -521,12 +531,6 @@
 
 #endif	/* __ASSEMBLY__ */
 
-#ifdef CONFIG_X86_32
-# include "pgtable_32.h"
-#else
-# include "pgtable_64.h"
-#endif
-
 /*
  * the pgd page can be thought of an array like this: pgd_t[PTRS_PER_PGD]
  *



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

* [PATCH 13 of 36] x86: unify pud_page
  2009-02-05 19:30 [PATCH 00 of 36] x86: clean up pte functions in pgtable*.h Jeremy Fitzhardinge
                   ` (11 preceding siblings ...)
  2009-02-05 19:30 ` [PATCH 12 of 36] x86: include pgtable_SIZE.h earlier Jeremy Fitzhardinge
@ 2009-02-05 19:30 ` Jeremy Fitzhardinge
  2009-02-05 19:30 ` [PATCH 14 of 36] x86: unify pgd_page Jeremy Fitzhardinge
                   ` (22 subsequent siblings)
  35 siblings, 0 replies; 42+ messages in thread
From: Jeremy Fitzhardinge @ 2009-02-05 19:30 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: linux-kernel, the arch/x86 maintainers

Impact: cleanup

Unify and demacro pud_page.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
---
 arch/x86/include/asm/pgtable-3level.h |    2 --
 arch/x86/include/asm/pgtable.h        |    6 ++++++
 arch/x86/include/asm/pgtable_64.h     |    1 -
 3 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/arch/x86/include/asm/pgtable-3level.h b/arch/x86/include/asm/pgtable-3level.h
--- a/arch/x86/include/asm/pgtable-3level.h
+++ b/arch/x86/include/asm/pgtable-3level.h
@@ -115,8 +115,6 @@
 		write_cr3(pgd);
 }
 
-#define pud_page(pud) pfn_to_page(pud_val(pud) >> PAGE_SHIFT)
-
 /* Find an entry in the second-level page table.. */
 #define pmd_offset(pud, address) ((pmd_t *)pud_page_vaddr(*(pud)) +	\
 				  pmd_index(address))
diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h
--- a/arch/x86/include/asm/pgtable.h
+++ b/arch/x86/include/asm/pgtable.h
@@ -471,6 +471,7 @@
 #endif
 
 #ifndef __ASSEMBLY__
+#include <linux/mm_types.h>
 
 static inline int pte_none(pte_t pte)
 {
@@ -515,6 +516,11 @@
 {
 	return (unsigned long)__va((unsigned long)pud_val(pud) & PTE_PFN_MASK);
 }
+
+static inline struct page *pud_page(pud_t pud)
+{
+	return pfn_to_page(pud_val(pud) >> PAGE_SHIFT);
+}
 #endif	/* PAGETABLE_LEVELS > 2 */
 
 #if PAGETABLE_LEVELS > 3
diff --git a/arch/x86/include/asm/pgtable_64.h b/arch/x86/include/asm/pgtable_64.h
--- a/arch/x86/include/asm/pgtable_64.h
+++ b/arch/x86/include/asm/pgtable_64.h
@@ -184,7 +184,6 @@
 
 /* PUD - Level3 access */
 /* to find an entry in a page-table-directory. */
-#define pud_page(pud)	(pfn_to_page(pud_val((pud)) >> PAGE_SHIFT))
 #define pud_index(address) (((address) >> PUD_SHIFT) & (PTRS_PER_PUD - 1))
 #define pud_offset(pgd, address)					\
 	((pud_t *)pgd_page_vaddr(*(pgd)) + pud_index((address)))



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

* [PATCH 14 of 36] x86: unify pgd_page
  2009-02-05 19:30 [PATCH 00 of 36] x86: clean up pte functions in pgtable*.h Jeremy Fitzhardinge
                   ` (12 preceding siblings ...)
  2009-02-05 19:30 ` [PATCH 13 of 36] x86: unify pud_page Jeremy Fitzhardinge
@ 2009-02-05 19:30 ` Jeremy Fitzhardinge
  2009-02-05 19:30 ` [PATCH 15 of 36] x86: unify pud_index Jeremy Fitzhardinge
                   ` (21 subsequent siblings)
  35 siblings, 0 replies; 42+ messages in thread
From: Jeremy Fitzhardinge @ 2009-02-05 19:30 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: linux-kernel, the arch/x86 maintainers

Impact: cleanup

Unify and demacro pgd_page.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
---
 arch/x86/include/asm/pgtable.h    |    5 +++++
 arch/x86/include/asm/pgtable_64.h |    1 -
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h
--- a/arch/x86/include/asm/pgtable.h
+++ b/arch/x86/include/asm/pgtable.h
@@ -533,6 +533,11 @@
 {
 	return (unsigned long)__va((unsigned long)pgd_val(pgd) & PTE_PFN_MASK);
 }
+
+static inline struct page *pgd_page(pgd_t pgd)
+{
+	return pfn_to_page(pgd_val(pgd) >> PAGE_SHIFT);
+}
 #endif	/* PAGETABLE_LEVELS > 3 */
 
 #endif	/* __ASSEMBLY__ */
diff --git a/arch/x86/include/asm/pgtable_64.h b/arch/x86/include/asm/pgtable_64.h
--- a/arch/x86/include/asm/pgtable_64.h
+++ b/arch/x86/include/asm/pgtable_64.h
@@ -178,7 +178,6 @@
 /*
  * Level 4 access.
  */
-#define pgd_page(pgd)		(pfn_to_page(pgd_val((pgd)) >> PAGE_SHIFT))
 static inline int pgd_large(pgd_t pgd) { return 0; }
 #define mk_kernel_pgd(address) __pgd((address) | _KERNPG_TABLE)
 



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

* [PATCH 15 of 36] x86: unify pud_index
  2009-02-05 19:30 [PATCH 00 of 36] x86: clean up pte functions in pgtable*.h Jeremy Fitzhardinge
                   ` (13 preceding siblings ...)
  2009-02-05 19:30 ` [PATCH 14 of 36] x86: unify pgd_page Jeremy Fitzhardinge
@ 2009-02-05 19:30 ` Jeremy Fitzhardinge
  2009-02-05 19:30 ` [PATCH 16 of 36] x86: unify pud_offset Jeremy Fitzhardinge
                   ` (20 subsequent siblings)
  35 siblings, 0 replies; 42+ messages in thread
From: Jeremy Fitzhardinge @ 2009-02-05 19:30 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: linux-kernel, the arch/x86 maintainers

Impact: cleanup

Unify and demacro pud_index.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
---
 arch/x86/include/asm/pgtable.h    |    6 ++++++
 arch/x86/include/asm/pgtable_64.h |    2 --
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h
--- a/arch/x86/include/asm/pgtable.h
+++ b/arch/x86/include/asm/pgtable.h
@@ -538,6 +538,12 @@
 {
 	return pfn_to_page(pgd_val(pgd) >> PAGE_SHIFT);
 }
+
+/* to find an entry in a page-table-directory. */
+static inline unsigned pud_index(unsigned long address)
+{
+	return (address >> PUD_SHIFT) & (PTRS_PER_PUD - 1);
+}
 #endif	/* PAGETABLE_LEVELS > 3 */
 
 #endif	/* __ASSEMBLY__ */
diff --git a/arch/x86/include/asm/pgtable_64.h b/arch/x86/include/asm/pgtable_64.h
--- a/arch/x86/include/asm/pgtable_64.h
+++ b/arch/x86/include/asm/pgtable_64.h
@@ -182,8 +182,6 @@
 #define mk_kernel_pgd(address) __pgd((address) | _KERNPG_TABLE)
 
 /* PUD - Level3 access */
-/* to find an entry in a page-table-directory. */
-#define pud_index(address) (((address) >> PUD_SHIFT) & (PTRS_PER_PUD - 1))
 #define pud_offset(pgd, address)					\
 	((pud_t *)pgd_page_vaddr(*(pgd)) + pud_index((address)))
 



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

* [PATCH 16 of 36] x86: unify pud_offset
  2009-02-05 19:30 [PATCH 00 of 36] x86: clean up pte functions in pgtable*.h Jeremy Fitzhardinge
                   ` (14 preceding siblings ...)
  2009-02-05 19:30 ` [PATCH 15 of 36] x86: unify pud_index Jeremy Fitzhardinge
@ 2009-02-05 19:30 ` Jeremy Fitzhardinge
  2009-02-05 19:30 ` [PATCH 17 of 36] x86: unify pmd_page_vaddr Jeremy Fitzhardinge
                   ` (19 subsequent siblings)
  35 siblings, 0 replies; 42+ messages in thread
From: Jeremy Fitzhardinge @ 2009-02-05 19:30 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: linux-kernel, the arch/x86 maintainers

Impact: cleanup

Unify and demacro pud_offset.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
---
 arch/x86/include/asm/pgtable.h    |    5 +++++
 arch/x86/include/asm/pgtable_64.h |    2 --
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h
--- a/arch/x86/include/asm/pgtable.h
+++ b/arch/x86/include/asm/pgtable.h
@@ -544,6 +544,11 @@
 {
 	return (address >> PUD_SHIFT) & (PTRS_PER_PUD - 1);
 }
+
+static inline pud_t *pud_offset(pgd_t *pgd, unsigned long address)
+{
+	return (pud_t *)pgd_page_vaddr(*pgd) + pud_index(address);
+}
 #endif	/* PAGETABLE_LEVELS > 3 */
 
 #endif	/* __ASSEMBLY__ */
diff --git a/arch/x86/include/asm/pgtable_64.h b/arch/x86/include/asm/pgtable_64.h
--- a/arch/x86/include/asm/pgtable_64.h
+++ b/arch/x86/include/asm/pgtable_64.h
@@ -182,8 +182,6 @@
 #define mk_kernel_pgd(address) __pgd((address) | _KERNPG_TABLE)
 
 /* PUD - Level3 access */
-#define pud_offset(pgd, address)					\
-	((pud_t *)pgd_page_vaddr(*(pgd)) + pud_index((address)))
 
 static inline int pud_large(pud_t pte)
 {



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

* [PATCH 17 of 36] x86: unify pmd_page_vaddr
  2009-02-05 19:30 [PATCH 00 of 36] x86: clean up pte functions in pgtable*.h Jeremy Fitzhardinge
                   ` (15 preceding siblings ...)
  2009-02-05 19:30 ` [PATCH 16 of 36] x86: unify pud_offset Jeremy Fitzhardinge
@ 2009-02-05 19:30 ` Jeremy Fitzhardinge
  2009-02-05 19:31 ` [PATCH 18 of 36] x86: unify pmd_page Jeremy Fitzhardinge
                   ` (18 subsequent siblings)
  35 siblings, 0 replies; 42+ messages in thread
From: Jeremy Fitzhardinge @ 2009-02-05 19:30 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: linux-kernel, the arch/x86 maintainers

Impact: cleanup

Unify and demacro pmd_page_vaddr.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
---
 arch/x86/include/asm/pgtable.h    |    5 +++++
 arch/x86/include/asm/pgtable_32.h |    3 ---
 arch/x86/include/asm/pgtable_64.h |    1 -
 3 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h
--- a/arch/x86/include/asm/pgtable.h
+++ b/arch/x86/include/asm/pgtable.h
@@ -506,6 +506,11 @@
 	return !(unsigned long)native_pmd_val(pmd);
 }
 
+static inline unsigned long pmd_page_vaddr(pmd_t pmd)
+{
+	return (unsigned long)__va(pmd_val(pmd) & PTE_PFN_MASK);
+}
+
 #if PAGETABLE_LEVELS > 2
 static inline int pud_present(pud_t pud)
 {
diff --git a/arch/x86/include/asm/pgtable_32.h b/arch/x86/include/asm/pgtable_32.h
--- a/arch/x86/include/asm/pgtable_32.h
+++ b/arch/x86/include/asm/pgtable_32.h
@@ -126,9 +126,6 @@
 
 #define pmd_page(pmd) (pfn_to_page(pmd_val((pmd)) >> PAGE_SHIFT))
 
-#define pmd_page_vaddr(pmd)					\
-	((unsigned long)__va(pmd_val((pmd)) & PTE_PFN_MASK))
-
 #if defined(CONFIG_HIGHPTE)
 #define pte_offset_map(dir, address)					\
 	((pte_t *)kmap_atomic_pte(pmd_page(*(dir)), KM_PTE0) +		\
diff --git a/arch/x86/include/asm/pgtable_64.h b/arch/x86/include/asm/pgtable_64.h
--- a/arch/x86/include/asm/pgtable_64.h
+++ b/arch/x86/include/asm/pgtable_64.h
@@ -190,7 +190,6 @@
 }
 
 /* PMD  - Level 2 access */
-#define pmd_page_vaddr(pmd) ((unsigned long) __va(pmd_val((pmd)) & PTE_PFN_MASK))
 #define pmd_page(pmd)		(pfn_to_page(pmd_val((pmd)) >> PAGE_SHIFT))
 
 #define pmd_index(address) (((address) >> PMD_SHIFT) & (PTRS_PER_PMD - 1))



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

* [PATCH 18 of 36] x86: unify pmd_page
  2009-02-05 19:30 [PATCH 00 of 36] x86: clean up pte functions in pgtable*.h Jeremy Fitzhardinge
                   ` (16 preceding siblings ...)
  2009-02-05 19:30 ` [PATCH 17 of 36] x86: unify pmd_page_vaddr Jeremy Fitzhardinge
@ 2009-02-05 19:31 ` Jeremy Fitzhardinge
  2009-02-05 19:31 ` [PATCH 19 of 36] x86: unify pmd_index Jeremy Fitzhardinge
                   ` (17 subsequent siblings)
  35 siblings, 0 replies; 42+ messages in thread
From: Jeremy Fitzhardinge @ 2009-02-05 19:31 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: linux-kernel, the arch/x86 maintainers

Impact: cleanup

Unify and demacro pmd_page.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
---
 arch/x86/include/asm/pgtable.h    |    5 +++++
 arch/x86/include/asm/pgtable_32.h |    2 --
 arch/x86/include/asm/pgtable_64.h |    2 --
 3 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h
--- a/arch/x86/include/asm/pgtable.h
+++ b/arch/x86/include/asm/pgtable.h
@@ -511,6 +511,11 @@
 	return (unsigned long)__va(pmd_val(pmd) & PTE_PFN_MASK);
 }
 
+static inline struct page *pmd_page(pmd_t pmd)
+{
+	return pfn_to_page(pmd_val(pmd) >> PAGE_SHIFT);
+}
+
 #if PAGETABLE_LEVELS > 2
 static inline int pud_present(pud_t pud)
 {
diff --git a/arch/x86/include/asm/pgtable_32.h b/arch/x86/include/asm/pgtable_32.h
--- a/arch/x86/include/asm/pgtable_32.h
+++ b/arch/x86/include/asm/pgtable_32.h
@@ -124,8 +124,6 @@
 #define pte_offset_kernel(dir, address)				\
 	((pte_t *)pmd_page_vaddr(*(dir)) +  pte_index((address)))
 
-#define pmd_page(pmd) (pfn_to_page(pmd_val((pmd)) >> PAGE_SHIFT))
-
 #if defined(CONFIG_HIGHPTE)
 #define pte_offset_map(dir, address)					\
 	((pte_t *)kmap_atomic_pte(pmd_page(*(dir)), KM_PTE0) +		\
diff --git a/arch/x86/include/asm/pgtable_64.h b/arch/x86/include/asm/pgtable_64.h
--- a/arch/x86/include/asm/pgtable_64.h
+++ b/arch/x86/include/asm/pgtable_64.h
@@ -190,8 +190,6 @@
 }
 
 /* PMD  - Level 2 access */
-#define pmd_page(pmd)		(pfn_to_page(pmd_val((pmd)) >> PAGE_SHIFT))
-
 #define pmd_index(address) (((address) >> PMD_SHIFT) & (PTRS_PER_PMD - 1))
 #define pmd_offset(dir, address) ((pmd_t *)pud_page_vaddr(*(dir)) + \
 				  pmd_index(address))



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

* [PATCH 19 of 36] x86: unify pmd_index
  2009-02-05 19:30 [PATCH 00 of 36] x86: clean up pte functions in pgtable*.h Jeremy Fitzhardinge
                   ` (17 preceding siblings ...)
  2009-02-05 19:31 ` [PATCH 18 of 36] x86: unify pmd_page Jeremy Fitzhardinge
@ 2009-02-05 19:31 ` Jeremy Fitzhardinge
  2009-02-05 19:31 ` [PATCH 20 of 36] x86: unify pmd_offset Jeremy Fitzhardinge
                   ` (16 subsequent siblings)
  35 siblings, 0 replies; 42+ messages in thread
From: Jeremy Fitzhardinge @ 2009-02-05 19:31 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: linux-kernel, the arch/x86 maintainers

Impact: cleanup

Unify and demacro pmd_index.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
---
 arch/x86/include/asm/pgtable.h    |   11 +++++++++++
 arch/x86/include/asm/pgtable_32.h |    9 ---------
 arch/x86/include/asm/pgtable_64.h |    1 -
 3 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h
--- a/arch/x86/include/asm/pgtable.h
+++ b/arch/x86/include/asm/pgtable.h
@@ -516,6 +516,17 @@
 	return pfn_to_page(pmd_val(pmd) >> PAGE_SHIFT);
 }
 
+/*
+ * the pmd page can be thought of an array like this: pmd_t[PTRS_PER_PMD]
+ *
+ * this macro returns the index of the entry in the pmd page which would
+ * control the given virtual address
+ */
+static inline unsigned pmd_index(unsigned long address)
+{
+	return (address >> PMD_SHIFT) & (PTRS_PER_PMD - 1);
+}
+
 #if PAGETABLE_LEVELS > 2
 static inline int pud_present(pud_t pud)
 {
diff --git a/arch/x86/include/asm/pgtable_32.h b/arch/x86/include/asm/pgtable_32.h
--- a/arch/x86/include/asm/pgtable_32.h
+++ b/arch/x86/include/asm/pgtable_32.h
@@ -105,15 +105,6 @@
 static inline int pud_large(pud_t pud) { return 0; }
 
 /*
- * the pmd page can be thought of an array like this: pmd_t[PTRS_PER_PMD]
- *
- * this macro returns the index of the entry in the pmd page which would
- * control the given virtual address
- */
-#define pmd_index(address)				\
-	(((address) >> PMD_SHIFT) & (PTRS_PER_PMD - 1))
-
-/*
  * the pte page can be thought of an array like this: pte_t[PTRS_PER_PTE]
  *
  * this macro returns the index of the entry in the pte page which would
diff --git a/arch/x86/include/asm/pgtable_64.h b/arch/x86/include/asm/pgtable_64.h
--- a/arch/x86/include/asm/pgtable_64.h
+++ b/arch/x86/include/asm/pgtable_64.h
@@ -190,7 +190,6 @@
 }
 
 /* PMD  - Level 2 access */
-#define pmd_index(address) (((address) >> PMD_SHIFT) & (PTRS_PER_PMD - 1))
 #define pmd_offset(dir, address) ((pmd_t *)pud_page_vaddr(*(dir)) + \
 				  pmd_index(address))
 #define pfn_pmd(nr, prot) (__pmd(((nr) << PAGE_SHIFT) | pgprot_val((prot))))



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

* [PATCH 20 of 36] x86: unify pmd_offset
  2009-02-05 19:30 [PATCH 00 of 36] x86: clean up pte functions in pgtable*.h Jeremy Fitzhardinge
                   ` (18 preceding siblings ...)
  2009-02-05 19:31 ` [PATCH 19 of 36] x86: unify pmd_index Jeremy Fitzhardinge
@ 2009-02-05 19:31 ` Jeremy Fitzhardinge
  2009-02-05 19:31 ` [PATCH 21 of 36] x86: remove redundant pfn_pmd definition Jeremy Fitzhardinge
                   ` (15 subsequent siblings)
  35 siblings, 0 replies; 42+ messages in thread
From: Jeremy Fitzhardinge @ 2009-02-05 19:31 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: linux-kernel, the arch/x86 maintainers

Impact: cleanup

Unify and demacro pmd_offset.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
---
 arch/x86/include/asm/pgtable-3level.h |    4 ----
 arch/x86/include/asm/pgtable.h        |    6 ++++++
 arch/x86/include/asm/pgtable_64.h     |    2 --
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/arch/x86/include/asm/pgtable-3level.h b/arch/x86/include/asm/pgtable-3level.h
--- a/arch/x86/include/asm/pgtable-3level.h
+++ b/arch/x86/include/asm/pgtable-3level.h
@@ -115,10 +115,6 @@
 		write_cr3(pgd);
 }
 
-/* Find an entry in the second-level page table.. */
-#define pmd_offset(pud, address) ((pmd_t *)pud_page_vaddr(*(pud)) +	\
-				  pmd_index(address))
-
 #ifdef CONFIG_SMP
 static inline pte_t native_ptep_get_and_clear(pte_t *ptep)
 {
diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h
--- a/arch/x86/include/asm/pgtable.h
+++ b/arch/x86/include/asm/pgtable.h
@@ -542,6 +542,12 @@
 {
 	return pfn_to_page(pud_val(pud) >> PAGE_SHIFT);
 }
+
+/* Find an entry in the second-level page table.. */
+static inline pmd_t *pmd_offset(pud_t *pud, unsigned long address)
+{
+	return (pmd_t *)pud_page_vaddr(*pud) + pmd_index(address);
+}
 #endif	/* PAGETABLE_LEVELS > 2 */
 
 #if PAGETABLE_LEVELS > 3
diff --git a/arch/x86/include/asm/pgtable_64.h b/arch/x86/include/asm/pgtable_64.h
--- a/arch/x86/include/asm/pgtable_64.h
+++ b/arch/x86/include/asm/pgtable_64.h
@@ -190,8 +190,6 @@
 }
 
 /* PMD  - Level 2 access */
-#define pmd_offset(dir, address) ((pmd_t *)pud_page_vaddr(*(dir)) + \
-				  pmd_index(address))
 #define pfn_pmd(nr, prot) (__pmd(((nr) << PAGE_SHIFT) | pgprot_val((prot))))
 #define pmd_pfn(x)  ((pmd_val((x)) & __PHYSICAL_MASK) >> PAGE_SHIFT)
 



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

* [PATCH 21 of 36] x86: remove redundant pfn_pmd definition
  2009-02-05 19:30 [PATCH 00 of 36] x86: clean up pte functions in pgtable*.h Jeremy Fitzhardinge
                   ` (19 preceding siblings ...)
  2009-02-05 19:31 ` [PATCH 20 of 36] x86: unify pmd_offset Jeremy Fitzhardinge
@ 2009-02-05 19:31 ` Jeremy Fitzhardinge
  2009-02-05 19:31 ` [PATCH 22 of 36] x86: unify pmd_pfn Jeremy Fitzhardinge
                   ` (14 subsequent siblings)
  35 siblings, 0 replies; 42+ messages in thread
From: Jeremy Fitzhardinge @ 2009-02-05 19:31 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: linux-kernel, the arch/x86 maintainers

Impact: cleanup

It's already defined in pgtable.h

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
---
 arch/x86/include/asm/pgtable_64.h |    1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/x86/include/asm/pgtable_64.h b/arch/x86/include/asm/pgtable_64.h
--- a/arch/x86/include/asm/pgtable_64.h
+++ b/arch/x86/include/asm/pgtable_64.h
@@ -190,7 +190,6 @@
 }
 
 /* PMD  - Level 2 access */
-#define pfn_pmd(nr, prot) (__pmd(((nr) << PAGE_SHIFT) | pgprot_val((prot))))
 #define pmd_pfn(x)  ((pmd_val((x)) & __PHYSICAL_MASK) >> PAGE_SHIFT)
 
 #define pte_to_pgoff(pte) ((pte_val((pte)) & PHYSICAL_PAGE_MASK) >> PAGE_SHIFT)



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

* [PATCH 22 of 36] x86: unify pmd_pfn
  2009-02-05 19:30 [PATCH 00 of 36] x86: clean up pte functions in pgtable*.h Jeremy Fitzhardinge
                   ` (20 preceding siblings ...)
  2009-02-05 19:31 ` [PATCH 21 of 36] x86: remove redundant pfn_pmd definition Jeremy Fitzhardinge
@ 2009-02-05 19:31 ` Jeremy Fitzhardinge
  2009-02-05 19:31 ` [PATCH 23 " Jeremy Fitzhardinge
                   ` (13 subsequent siblings)
  35 siblings, 0 replies; 42+ messages in thread
From: Jeremy Fitzhardinge @ 2009-02-05 19:31 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: linux-kernel, the arch/x86 maintainers

Impact: cleanup

Unify and demacro pmd_pfn.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
---
 arch/x86/include/asm/pgtable.h    |    5 +++++
 arch/x86/include/asm/pgtable_64.h |    2 --
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h
--- a/arch/x86/include/asm/pgtable.h
+++ b/arch/x86/include/asm/pgtable.h
@@ -548,6 +548,11 @@
 {
 	return (pmd_t *)pud_page_vaddr(*pud) + pmd_index(address);
 }
+
+static inline unsigned long pmd_pfn(pmd_t pmd)
+{
+	return (pmd_val(pmd) & PTE_PFN_MASK) >> PAGE_SHIFT;
+}
 #endif	/* PAGETABLE_LEVELS > 2 */
 
 #if PAGETABLE_LEVELS > 3
diff --git a/arch/x86/include/asm/pgtable_64.h b/arch/x86/include/asm/pgtable_64.h
--- a/arch/x86/include/asm/pgtable_64.h
+++ b/arch/x86/include/asm/pgtable_64.h
@@ -190,8 +190,6 @@
 }
 
 /* PMD  - Level 2 access */
-#define pmd_pfn(x)  ((pmd_val((x)) & __PHYSICAL_MASK) >> PAGE_SHIFT)
-
 #define pte_to_pgoff(pte) ((pte_val((pte)) & PHYSICAL_PAGE_MASK) >> PAGE_SHIFT)
 #define pgoff_to_pte(off) ((pte_t) { .pte = ((off) << PAGE_SHIFT) |	\
 					    _PAGE_FILE })



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

* [PATCH 23 of 36] x86: unify pmd_pfn
  2009-02-05 19:30 [PATCH 00 of 36] x86: clean up pte functions in pgtable*.h Jeremy Fitzhardinge
                   ` (21 preceding siblings ...)
  2009-02-05 19:31 ` [PATCH 22 of 36] x86: unify pmd_pfn Jeremy Fitzhardinge
@ 2009-02-05 19:31 ` Jeremy Fitzhardinge
  2009-02-05 19:31 ` [PATCH 24 of 36] x86: unify pte_index Jeremy Fitzhardinge
                   ` (12 subsequent siblings)
  35 siblings, 0 replies; 42+ messages in thread
From: Jeremy Fitzhardinge @ 2009-02-05 19:31 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: linux-kernel, the arch/x86 maintainers

Impact: cleanup

Unify pmd_pfn.  Unfortunately it can't be demacroed because it has a
cyclic dependency on linux/mm.h:page_to_nid().

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
---
 arch/x86/include/asm/pgtable.h    |    9 +++++++++
 arch/x86/include/asm/pgtable_32.h |    7 -------
 arch/x86/include/asm/pgtable_64.h |    3 ---
 3 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h
--- a/arch/x86/include/asm/pgtable.h
+++ b/arch/x86/include/asm/pgtable.h
@@ -527,6 +527,15 @@
 	return (address >> PMD_SHIFT) & (PTRS_PER_PMD - 1);
 }
 
+/*
+ * Conversion functions: convert a page and protection to a page entry,
+ * and a page entry and page directory to the page they refer to.
+ *
+ * (Currently stuck as a macro because of indirect forward reference
+ * to linux/mm.h:page_to_nid())
+ */
+#define mk_pte(page, pgprot)   pfn_pte(page_to_pfn(page), (pgprot))
+
 #if PAGETABLE_LEVELS > 2
 static inline int pud_present(pud_t pud)
 {
diff --git a/arch/x86/include/asm/pgtable_32.h b/arch/x86/include/asm/pgtable_32.h
--- a/arch/x86/include/asm/pgtable_32.h
+++ b/arch/x86/include/asm/pgtable_32.h
@@ -95,13 +95,6 @@
 # include <asm/pgtable-2level.h>
 #endif
 
-/*
- * Conversion functions: convert a page and protection to a page entry,
- * and a page entry and page directory to the page they refer to.
- */
-#define mk_pte(page, pgprot)	pfn_pte(page_to_pfn(page), (pgprot))
-
-
 static inline int pud_large(pud_t pud) { return 0; }
 
 /*
diff --git a/arch/x86/include/asm/pgtable_64.h b/arch/x86/include/asm/pgtable_64.h
--- a/arch/x86/include/asm/pgtable_64.h
+++ b/arch/x86/include/asm/pgtable_64.h
@@ -197,9 +197,6 @@
 
 /* PTE - Level 1 access. */
 
-/* page, protection -> pte */
-#define mk_pte(page, pgprot)	pfn_pte(page_to_pfn((page)), (pgprot))
-
 #define pte_index(address) (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))
 #define pte_offset_kernel(dir, address) ((pte_t *) pmd_page_vaddr(*(dir)) + \
 					 pte_index((address)))



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

* [PATCH 24 of 36] x86: unify pte_index
  2009-02-05 19:30 [PATCH 00 of 36] x86: clean up pte functions in pgtable*.h Jeremy Fitzhardinge
                   ` (22 preceding siblings ...)
  2009-02-05 19:31 ` [PATCH 23 " Jeremy Fitzhardinge
@ 2009-02-05 19:31 ` Jeremy Fitzhardinge
  2009-02-05 19:31 ` [PATCH 25 of 36] x86: unify pte_offset_kernel Jeremy Fitzhardinge
                   ` (11 subsequent siblings)
  35 siblings, 0 replies; 42+ messages in thread
From: Jeremy Fitzhardinge @ 2009-02-05 19:31 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: linux-kernel, the arch/x86 maintainers

Impact: cleanup

Unify and demacro pte_index.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
---
 arch/x86/include/asm/pgtable.h    |   11 +++++++++++
 arch/x86/include/asm/pgtable_32.h |    8 --------
 arch/x86/include/asm/pgtable_64.h |    1 -
 3 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h
--- a/arch/x86/include/asm/pgtable.h
+++ b/arch/x86/include/asm/pgtable.h
@@ -536,6 +536,17 @@
  */
 #define mk_pte(page, pgprot)   pfn_pte(page_to_pfn(page), (pgprot))
 
+/*
+ * the pte page can be thought of an array like this: pte_t[PTRS_PER_PTE]
+ *
+ * this function returns the index of the entry in the pte page which would
+ * control the given virtual address
+ */
+static inline unsigned pte_index(unsigned long address)
+{
+	return (address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1);
+}
+
 #if PAGETABLE_LEVELS > 2
 static inline int pud_present(pud_t pud)
 {
diff --git a/arch/x86/include/asm/pgtable_32.h b/arch/x86/include/asm/pgtable_32.h
--- a/arch/x86/include/asm/pgtable_32.h
+++ b/arch/x86/include/asm/pgtable_32.h
@@ -97,14 +97,6 @@
 
 static inline int pud_large(pud_t pud) { return 0; }
 
-/*
- * the pte page can be thought of an array like this: pte_t[PTRS_PER_PTE]
- *
- * this macro returns the index of the entry in the pte page which would
- * control the given virtual address
- */
-#define pte_index(address)					\
-	(((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))
 #define pte_offset_kernel(dir, address)				\
 	((pte_t *)pmd_page_vaddr(*(dir)) +  pte_index((address)))
 
diff --git a/arch/x86/include/asm/pgtable_64.h b/arch/x86/include/asm/pgtable_64.h
--- a/arch/x86/include/asm/pgtable_64.h
+++ b/arch/x86/include/asm/pgtable_64.h
@@ -197,7 +197,6 @@
 
 /* PTE - Level 1 access. */
 
-#define pte_index(address) (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))
 #define pte_offset_kernel(dir, address) ((pte_t *) pmd_page_vaddr(*(dir)) + \
 					 pte_index((address)))
 



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

* [PATCH 25 of 36] x86: unify pte_offset_kernel
  2009-02-05 19:30 [PATCH 00 of 36] x86: clean up pte functions in pgtable*.h Jeremy Fitzhardinge
                   ` (23 preceding siblings ...)
  2009-02-05 19:31 ` [PATCH 24 of 36] x86: unify pte_index Jeremy Fitzhardinge
@ 2009-02-05 19:31 ` Jeremy Fitzhardinge
  2009-02-05 19:31 ` [PATCH 26 of 36] x86: unify pud_large Jeremy Fitzhardinge
                   ` (10 subsequent siblings)
  35 siblings, 0 replies; 42+ messages in thread
From: Jeremy Fitzhardinge @ 2009-02-05 19:31 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: linux-kernel, the arch/x86 maintainers

Impact: cleanup

Unify and demacro pte_offset_kernel.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
---
 arch/x86/include/asm/pgtable.h    |    5 +++++
 arch/x86/include/asm/pgtable_32.h |    3 ---
 arch/x86/include/asm/pgtable_64.h |    3 ---
 3 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h
--- a/arch/x86/include/asm/pgtable.h
+++ b/arch/x86/include/asm/pgtable.h
@@ -547,6 +547,11 @@
 	return (address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1);
 }
 
+static inline pte_t *pte_offset_kernel(pmd_t *pmd, unsigned long address)
+{
+	return (pte_t *)pmd_page_vaddr(*pmd) + pte_index(address);
+}
+
 #if PAGETABLE_LEVELS > 2
 static inline int pud_present(pud_t pud)
 {
diff --git a/arch/x86/include/asm/pgtable_32.h b/arch/x86/include/asm/pgtable_32.h
--- a/arch/x86/include/asm/pgtable_32.h
+++ b/arch/x86/include/asm/pgtable_32.h
@@ -97,9 +97,6 @@
 
 static inline int pud_large(pud_t pud) { return 0; }
 
-#define pte_offset_kernel(dir, address)				\
-	((pte_t *)pmd_page_vaddr(*(dir)) +  pte_index((address)))
-
 #if defined(CONFIG_HIGHPTE)
 #define pte_offset_map(dir, address)					\
 	((pte_t *)kmap_atomic_pte(pmd_page(*(dir)), KM_PTE0) +		\
diff --git a/arch/x86/include/asm/pgtable_64.h b/arch/x86/include/asm/pgtable_64.h
--- a/arch/x86/include/asm/pgtable_64.h
+++ b/arch/x86/include/asm/pgtable_64.h
@@ -197,9 +197,6 @@
 
 /* PTE - Level 1 access. */
 
-#define pte_offset_kernel(dir, address) ((pte_t *) pmd_page_vaddr(*(dir)) + \
-					 pte_index((address)))
-
 /* x86-64 always has all page tables mapped. */
 #define pte_offset_map(dir, address) pte_offset_kernel((dir), (address))
 #define pte_offset_map_nested(dir, address) pte_offset_kernel((dir), (address))



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

* [PATCH 26 of 36] x86: unify pud_large
  2009-02-05 19:30 [PATCH 00 of 36] x86: clean up pte functions in pgtable*.h Jeremy Fitzhardinge
                   ` (24 preceding siblings ...)
  2009-02-05 19:31 ` [PATCH 25 of 36] x86: unify pte_offset_kernel Jeremy Fitzhardinge
@ 2009-02-05 19:31 ` Jeremy Fitzhardinge
  2009-02-05 19:31 ` [PATCH 27 of 36] x86: unify pgd_bad Jeremy Fitzhardinge
                   ` (9 subsequent siblings)
  35 siblings, 0 replies; 42+ messages in thread
From: Jeremy Fitzhardinge @ 2009-02-05 19:31 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: linux-kernel, the arch/x86 maintainers

Impact: cleanup

Unify and demacro pud_large.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
---
 arch/x86/include/asm/pgtable.h    |    6 ++++++
 arch/x86/include/asm/pgtable_32.h |    2 --
 arch/x86/include/asm/pgtable_64.h |    6 ------
 3 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h
--- a/arch/x86/include/asm/pgtable.h
+++ b/arch/x86/include/asm/pgtable.h
@@ -578,6 +578,12 @@
 {
 	return (pmd_val(pmd) & PTE_PFN_MASK) >> PAGE_SHIFT;
 }
+
+static inline int pud_large(pud_t pud)
+{
+	return (pud_val(pud) & (_PAGE_PSE | _PAGE_PRESENT)) ==
+		(_PAGE_PSE | _PAGE_PRESENT);
+}
 #endif	/* PAGETABLE_LEVELS > 2 */
 
 #if PAGETABLE_LEVELS > 3
diff --git a/arch/x86/include/asm/pgtable_32.h b/arch/x86/include/asm/pgtable_32.h
--- a/arch/x86/include/asm/pgtable_32.h
+++ b/arch/x86/include/asm/pgtable_32.h
@@ -95,8 +95,6 @@
 # include <asm/pgtable-2level.h>
 #endif
 
-static inline int pud_large(pud_t pud) { return 0; }
-
 #if defined(CONFIG_HIGHPTE)
 #define pte_offset_map(dir, address)					\
 	((pte_t *)kmap_atomic_pte(pmd_page(*(dir)), KM_PTE0) +		\
diff --git a/arch/x86/include/asm/pgtable_64.h b/arch/x86/include/asm/pgtable_64.h
--- a/arch/x86/include/asm/pgtable_64.h
+++ b/arch/x86/include/asm/pgtable_64.h
@@ -183,12 +183,6 @@
 
 /* PUD - Level3 access */
 
-static inline int pud_large(pud_t pte)
-{
-	return (pud_val(pte) & (_PAGE_PSE | _PAGE_PRESENT)) ==
-		(_PAGE_PSE | _PAGE_PRESENT);
-}
-
 /* PMD  - Level 2 access */
 #define pte_to_pgoff(pte) ((pte_val((pte)) & PHYSICAL_PAGE_MASK) >> PAGE_SHIFT)
 #define pgoff_to_pte(off) ((pte_t) { .pte = ((off) << PAGE_SHIFT) |	\



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

* [PATCH 27 of 36] x86: unify pgd_bad
  2009-02-05 19:30 [PATCH 00 of 36] x86: clean up pte functions in pgtable*.h Jeremy Fitzhardinge
                   ` (25 preceding siblings ...)
  2009-02-05 19:31 ` [PATCH 26 of 36] x86: unify pud_large Jeremy Fitzhardinge
@ 2009-02-05 19:31 ` Jeremy Fitzhardinge
  2009-02-05 19:31 ` [PATCH 28 " Jeremy Fitzhardinge
                   ` (8 subsequent siblings)
  35 siblings, 0 replies; 42+ messages in thread
From: Jeremy Fitzhardinge @ 2009-02-05 19:31 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: linux-kernel, the arch/x86 maintainers

Impact: cleanup

Unify and demacro pgd_bad.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
---
 arch/x86/include/asm/pgtable.h    |    5 +++++
 arch/x86/include/asm/pgtable_64.h |    5 -----
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h
--- a/arch/x86/include/asm/pgtable.h
+++ b/arch/x86/include/asm/pgtable.h
@@ -612,6 +612,11 @@
 {
 	return (pud_t *)pgd_page_vaddr(*pgd) + pud_index(address);
 }
+
+static inline int pgd_bad(pgd_t pgd)
+{
+	return (pgd_val(pgd) & ~(PTE_PFN_MASK | _PAGE_USER)) != _KERNPG_TABLE;
+}
 #endif	/* PAGETABLE_LEVELS > 3 */
 
 #endif	/* __ASSEMBLY__ */
diff --git a/arch/x86/include/asm/pgtable_64.h b/arch/x86/include/asm/pgtable_64.h
--- a/arch/x86/include/asm/pgtable_64.h
+++ b/arch/x86/include/asm/pgtable_64.h
@@ -153,11 +153,6 @@
 
 #ifndef __ASSEMBLY__
 
-static inline int pgd_bad(pgd_t pgd)
-{
-	return (pgd_val(pgd) & ~(PTE_PFN_MASK | _PAGE_USER)) != _KERNPG_TABLE;
-}
-
 static inline int pud_bad(pud_t pud)
 {
 	return (pud_val(pud) & ~(PTE_PFN_MASK | _PAGE_USER)) != _KERNPG_TABLE;



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

* [PATCH 28 of 36] x86: unify pgd_bad
  2009-02-05 19:30 [PATCH 00 of 36] x86: clean up pte functions in pgtable*.h Jeremy Fitzhardinge
                   ` (26 preceding siblings ...)
  2009-02-05 19:31 ` [PATCH 27 of 36] x86: unify pgd_bad Jeremy Fitzhardinge
@ 2009-02-05 19:31 ` Jeremy Fitzhardinge
  2009-02-05 19:31 ` [PATCH 29 of 36] x86: unify pmd_bad Jeremy Fitzhardinge
                   ` (7 subsequent siblings)
  35 siblings, 0 replies; 42+ messages in thread
From: Jeremy Fitzhardinge @ 2009-02-05 19:31 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: linux-kernel, the arch/x86 maintainers

Impact: cleanup

Unify and demacro pgd_bad.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
---
 arch/x86/include/asm/pgtable-3level.h |    5 -----
 arch/x86/include/asm/pgtable.h        |    5 +++++
 arch/x86/include/asm/pgtable_64.h     |    5 -----
 3 files changed, 5 insertions(+), 10 deletions(-)

diff --git a/arch/x86/include/asm/pgtable-3level.h b/arch/x86/include/asm/pgtable-3level.h
--- a/arch/x86/include/asm/pgtable-3level.h
+++ b/arch/x86/include/asm/pgtable-3level.h
@@ -23,11 +23,6 @@
 	return pud_val(pud) == 0;
 }
 
-static inline int pud_bad(pud_t pud)
-{
-	return (pud_val(pud) & ~(PTE_PFN_MASK | _KERNPG_TABLE | _PAGE_USER)) != 0;
-}
-
 /* Rules for using set_pte: the pte being assigned *must* be
  * either not present or in a state where the hardware will
  * not attempt to update the pte.  In places where this is
diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h
--- a/arch/x86/include/asm/pgtable.h
+++ b/arch/x86/include/asm/pgtable.h
@@ -584,6 +584,11 @@
 	return (pud_val(pud) & (_PAGE_PSE | _PAGE_PRESENT)) ==
 		(_PAGE_PSE | _PAGE_PRESENT);
 }
+
+static inline int pud_bad(pud_t pud)
+{
+	return (pud_val(pud) & ~(PTE_PFN_MASK | _KERNPG_TABLE | _PAGE_USER)) != 0;
+}
 #endif	/* PAGETABLE_LEVELS > 2 */
 
 #if PAGETABLE_LEVELS > 3
diff --git a/arch/x86/include/asm/pgtable_64.h b/arch/x86/include/asm/pgtable_64.h
--- a/arch/x86/include/asm/pgtable_64.h
+++ b/arch/x86/include/asm/pgtable_64.h
@@ -153,11 +153,6 @@
 
 #ifndef __ASSEMBLY__
 
-static inline int pud_bad(pud_t pud)
-{
-	return (pud_val(pud) & ~(PTE_PFN_MASK | _PAGE_USER)) != _KERNPG_TABLE;
-}
-
 static inline int pmd_bad(pmd_t pmd)
 {
 	return (pmd_val(pmd) & ~(PTE_PFN_MASK | _PAGE_USER)) != _KERNPG_TABLE;



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

* [PATCH 29 of 36] x86: unify pmd_bad
  2009-02-05 19:30 [PATCH 00 of 36] x86: clean up pte functions in pgtable*.h Jeremy Fitzhardinge
                   ` (27 preceding siblings ...)
  2009-02-05 19:31 ` [PATCH 28 " Jeremy Fitzhardinge
@ 2009-02-05 19:31 ` Jeremy Fitzhardinge
  2009-02-05 19:31 ` [PATCH 30 of 36] x86: unify pages_to_mb Jeremy Fitzhardinge
                   ` (6 subsequent siblings)
  35 siblings, 0 replies; 42+ messages in thread
From: Jeremy Fitzhardinge @ 2009-02-05 19:31 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: linux-kernel, the arch/x86 maintainers

Impact: cleanup

Unify and demacro pmd_bad.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
---
 arch/x86/include/asm/pgtable.h    |    5 +++++
 arch/x86/include/asm/pgtable_32.h |    2 --
 arch/x86/include/asm/pgtable_64.h |    5 -----
 3 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h
--- a/arch/x86/include/asm/pgtable.h
+++ b/arch/x86/include/asm/pgtable.h
@@ -552,6 +552,11 @@
 	return (pte_t *)pmd_page_vaddr(*pmd) + pte_index(address);
 }
 
+static inline int pmd_bad(pmd_t pmd)
+{
+	return (pmd_val(pmd) & ~(PTE_PFN_MASK | _PAGE_USER)) != _KERNPG_TABLE;
+}
+
 #if PAGETABLE_LEVELS > 2
 static inline int pud_present(pud_t pud)
 {
diff --git a/arch/x86/include/asm/pgtable_32.h b/arch/x86/include/asm/pgtable_32.h
--- a/arch/x86/include/asm/pgtable_32.h
+++ b/arch/x86/include/asm/pgtable_32.h
@@ -85,8 +85,6 @@
 /* The boot page tables (all created as a single array) */
 extern unsigned long pg0[];
 
-#define pmd_bad(x) ((pmd_val(x) & (PTE_FLAGS_MASK & ~_PAGE_USER)) != _KERNPG_TABLE)
-
 #define pages_to_mb(x) ((x) >> (20-PAGE_SHIFT))
 
 #ifdef CONFIG_X86_PAE
diff --git a/arch/x86/include/asm/pgtable_64.h b/arch/x86/include/asm/pgtable_64.h
--- a/arch/x86/include/asm/pgtable_64.h
+++ b/arch/x86/include/asm/pgtable_64.h
@@ -153,11 +153,6 @@
 
 #ifndef __ASSEMBLY__
 
-static inline int pmd_bad(pmd_t pmd)
-{
-	return (pmd_val(pmd) & ~(PTE_PFN_MASK | _PAGE_USER)) != _KERNPG_TABLE;
-}
-
 #define pages_to_mb(x)	((x) >> (20 - PAGE_SHIFT))   /* FIXME: is this right? */
 
 /*



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

* [PATCH 30 of 36] x86: unify pages_to_mb
  2009-02-05 19:30 [PATCH 00 of 36] x86: clean up pte functions in pgtable*.h Jeremy Fitzhardinge
                   ` (28 preceding siblings ...)
  2009-02-05 19:31 ` [PATCH 29 of 36] x86: unify pmd_bad Jeremy Fitzhardinge
@ 2009-02-05 19:31 ` Jeremy Fitzhardinge
  2009-02-05 19:31 ` [PATCH 31 of 36] x86: unify pud_none Jeremy Fitzhardinge
                   ` (5 subsequent siblings)
  35 siblings, 0 replies; 42+ messages in thread
From: Jeremy Fitzhardinge @ 2009-02-05 19:31 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: linux-kernel, the arch/x86 maintainers

Impact: cleanup

Unify and demacro pages_to_mb.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
---
 arch/x86/include/asm/pgtable.h    |    5 +++++
 arch/x86/include/asm/pgtable_32.h |    2 --
 arch/x86/include/asm/pgtable_64.h |    2 --
 3 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h
--- a/arch/x86/include/asm/pgtable.h
+++ b/arch/x86/include/asm/pgtable.h
@@ -557,6 +557,11 @@
 	return (pmd_val(pmd) & ~(PTE_PFN_MASK | _PAGE_USER)) != _KERNPG_TABLE;
 }
 
+static inline unsigned long pages_to_mb(unsigned long npg)
+{
+	return npg >> (20 - PAGE_SHIFT);
+}
+
 #if PAGETABLE_LEVELS > 2
 static inline int pud_present(pud_t pud)
 {
diff --git a/arch/x86/include/asm/pgtable_32.h b/arch/x86/include/asm/pgtable_32.h
--- a/arch/x86/include/asm/pgtable_32.h
+++ b/arch/x86/include/asm/pgtable_32.h
@@ -85,8 +85,6 @@
 /* The boot page tables (all created as a single array) */
 extern unsigned long pg0[];
 
-#define pages_to_mb(x) ((x) >> (20-PAGE_SHIFT))
-
 #ifdef CONFIG_X86_PAE
 # include <asm/pgtable-3level.h>
 #else
diff --git a/arch/x86/include/asm/pgtable_64.h b/arch/x86/include/asm/pgtable_64.h
--- a/arch/x86/include/asm/pgtable_64.h
+++ b/arch/x86/include/asm/pgtable_64.h
@@ -153,8 +153,6 @@
 
 #ifndef __ASSEMBLY__
 
-#define pages_to_mb(x)	((x) >> (20 - PAGE_SHIFT))   /* FIXME: is this right? */
-
 /*
  * Conversion functions: convert a page and protection to a page entry,
  * and a page entry and page directory to the page they refer to.



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

* [PATCH 31 of 36] x86: unify pud_none
  2009-02-05 19:30 [PATCH 00 of 36] x86: clean up pte functions in pgtable*.h Jeremy Fitzhardinge
                   ` (29 preceding siblings ...)
  2009-02-05 19:31 ` [PATCH 30 of 36] x86: unify pages_to_mb Jeremy Fitzhardinge
@ 2009-02-05 19:31 ` Jeremy Fitzhardinge
  2009-02-05 19:31 ` [PATCH 32 of 36] x86: unify pgd_none Jeremy Fitzhardinge
                   ` (4 subsequent siblings)
  35 siblings, 0 replies; 42+ messages in thread
From: Jeremy Fitzhardinge @ 2009-02-05 19:31 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: linux-kernel, the arch/x86 maintainers

Impact: cleanup

Unify and demacro pud_none.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
---
 arch/x86/include/asm/pgtable-3level.h |    5 -----
 arch/x86/include/asm/pgtable.h        |    5 +++++
 arch/x86/include/asm/pgtable_64.h     |    1 -
 3 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/arch/x86/include/asm/pgtable-3level.h b/arch/x86/include/asm/pgtable-3level.h
--- a/arch/x86/include/asm/pgtable-3level.h
+++ b/arch/x86/include/asm/pgtable-3level.h
@@ -18,11 +18,6 @@
 	printk("%s:%d: bad pgd %p(%016Lx).\n",				\
 	       __FILE__, __LINE__, &(e), pgd_val(e))
 
-static inline int pud_none(pud_t pud)
-{
-	return pud_val(pud) == 0;
-}
-
 /* Rules for using set_pte: the pte being assigned *must* be
  * either not present or in a state where the hardware will
  * not attempt to update the pte.  In places where this is
diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h
--- a/arch/x86/include/asm/pgtable.h
+++ b/arch/x86/include/asm/pgtable.h
@@ -563,6 +563,11 @@
 }
 
 #if PAGETABLE_LEVELS > 2
+static inline int pud_none(pud_t pud)
+{
+	return pud_val(pud) == 0;
+}
+
 static inline int pud_present(pud_t pud)
 {
 	return pud_val(pud) & _PAGE_PRESENT;
diff --git a/arch/x86/include/asm/pgtable_64.h b/arch/x86/include/asm/pgtable_64.h
--- a/arch/x86/include/asm/pgtable_64.h
+++ b/arch/x86/include/asm/pgtable_64.h
@@ -67,7 +67,6 @@
 	       __FILE__, __LINE__, &(e), pgd_val(e))
 
 #define pgd_none(x)	(!pgd_val(x))
-#define pud_none(x)	(!pud_val(x))
 
 struct mm_struct;
 



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

* [PATCH 32 of 36] x86: unify pgd_none
  2009-02-05 19:30 [PATCH 00 of 36] x86: clean up pte functions in pgtable*.h Jeremy Fitzhardinge
                   ` (30 preceding siblings ...)
  2009-02-05 19:31 ` [PATCH 31 of 36] x86: unify pud_none Jeremy Fitzhardinge
@ 2009-02-05 19:31 ` Jeremy Fitzhardinge
  2009-02-05 19:31 ` [PATCH 33 of 36] x86: unify io_remap_pfn_range Jeremy Fitzhardinge
                   ` (3 subsequent siblings)
  35 siblings, 0 replies; 42+ messages in thread
From: Jeremy Fitzhardinge @ 2009-02-05 19:31 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: linux-kernel, the arch/x86 maintainers

Impact: cleanup

Unify and demacro pgd_none.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>

---
 arch/x86/include/asm/pgtable.h    |    5 +++++
 arch/x86/include/asm/pgtable_64.h |    2 --
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h
--- a/arch/x86/include/asm/pgtable.h
+++ b/arch/x86/include/asm/pgtable.h
@@ -637,6 +637,11 @@
 {
 	return (pgd_val(pgd) & ~(PTE_PFN_MASK | _PAGE_USER)) != _KERNPG_TABLE;
 }
+
+static inline int pgd_none(pgd_t pgd)
+{
+	return !pgd_val(pgd);
+}
 #endif	/* PAGETABLE_LEVELS > 3 */
 
 #endif	/* __ASSEMBLY__ */
diff --git a/arch/x86/include/asm/pgtable_64.h b/arch/x86/include/asm/pgtable_64.h
--- a/arch/x86/include/asm/pgtable_64.h
+++ b/arch/x86/include/asm/pgtable_64.h
@@ -66,8 +66,6 @@
 	printk("%s:%d: bad pgd %p(%016lx).\n",		\
 	       __FILE__, __LINE__, &(e), pgd_val(e))
 
-#define pgd_none(x)	(!pgd_val(x))
-
 struct mm_struct;
 
 void set_pte_vaddr_pud(pud_t *pud_page, unsigned long vaddr, pte_t new_pte);



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

* [PATCH 33 of 36] x86: unify io_remap_pfn_range
  2009-02-05 19:30 [PATCH 00 of 36] x86: clean up pte functions in pgtable*.h Jeremy Fitzhardinge
                   ` (31 preceding siblings ...)
  2009-02-05 19:31 ` [PATCH 32 of 36] x86: unify pgd_none Jeremy Fitzhardinge
@ 2009-02-05 19:31 ` Jeremy Fitzhardinge
  2009-02-05 19:31 ` [PATCH 34 of 36] x86: add and use pgd/pud/pmd_flags Jeremy Fitzhardinge
                   ` (2 subsequent siblings)
  35 siblings, 0 replies; 42+ messages in thread
From: Jeremy Fitzhardinge @ 2009-02-05 19:31 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: linux-kernel, the arch/x86 maintainers

Impact: cleanup

Unify io_remap_pfn_range.  Don't demacro yet.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
---
 arch/x86/include/asm/pgtable.h    |    3 +++
 arch/x86/include/asm/pgtable_32.h |    3 ---
 arch/x86/include/asm/pgtable_64.h |    3 ---
 3 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h
--- a/arch/x86/include/asm/pgtable.h
+++ b/arch/x86/include/asm/pgtable.h
@@ -562,6 +562,9 @@
 	return npg >> (20 - PAGE_SHIFT);
 }
 
+#define io_remap_pfn_range(vma, vaddr, pfn, size, prot)	\
+	remap_pfn_range(vma, vaddr, pfn, size, prot)
+
 #if PAGETABLE_LEVELS > 2
 static inline int pud_none(pud_t pud)
 {
diff --git a/arch/x86/include/asm/pgtable_32.h b/arch/x86/include/asm/pgtable_32.h
--- a/arch/x86/include/asm/pgtable_32.h
+++ b/arch/x86/include/asm/pgtable_32.h
@@ -133,7 +133,4 @@
 #define kern_addr_valid(kaddr)	(0)
 #endif
 
-#define io_remap_pfn_range(vma, vaddr, pfn, size, prot)	\
-	remap_pfn_range(vma, vaddr, pfn, size, prot)
-
 #endif /* _ASM_X86_PGTABLE_32_H */
diff --git a/arch/x86/include/asm/pgtable_64.h b/arch/x86/include/asm/pgtable_64.h
--- a/arch/x86/include/asm/pgtable_64.h
+++ b/arch/x86/include/asm/pgtable_64.h
@@ -204,9 +204,6 @@
 extern int kern_addr_valid(unsigned long addr);
 extern void cleanup_highmap(void);
 
-#define io_remap_pfn_range(vma, vaddr, pfn, size, prot)	\
-	remap_pfn_range(vma, vaddr, pfn, size, prot)
-
 #define HAVE_ARCH_UNMAPPED_AREA
 #define HAVE_ARCH_UNMAPPED_AREA_TOPDOWN
 



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

* [PATCH 34 of 36] x86: add and use pgd/pud/pmd_flags
  2009-02-05 19:30 [PATCH 00 of 36] x86: clean up pte functions in pgtable*.h Jeremy Fitzhardinge
                   ` (32 preceding siblings ...)
  2009-02-05 19:31 ` [PATCH 33 of 36] x86: unify io_remap_pfn_range Jeremy Fitzhardinge
@ 2009-02-05 19:31 ` Jeremy Fitzhardinge
  2009-02-05 19:31 ` [PATCH 35 of 36] x86: make pgd/pud/pmd/pte_none consistent Jeremy Fitzhardinge
  2009-02-05 19:31 ` [PATCH 36 of 36] x86: make the X_bad functions consistent Jeremy Fitzhardinge
  35 siblings, 0 replies; 42+ messages in thread
From: Jeremy Fitzhardinge @ 2009-02-05 19:31 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: linux-kernel, the arch/x86 maintainers

Add pgd/pud/pmd_flags which are analogous to pte_flags, and use them
where-ever we only care about testing the flags portions of the
respective entries.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
---
 arch/x86/include/asm/page.h    |   15 +++++++++++++++
 arch/x86/include/asm/pgtable.h |   16 ++++++++--------
 2 files changed, 23 insertions(+), 8 deletions(-)

diff --git a/arch/x86/include/asm/page.h b/arch/x86/include/asm/page.h
--- a/arch/x86/include/asm/page.h
+++ b/arch/x86/include/asm/page.h
@@ -95,6 +95,11 @@
 	return pgd.pgd;
 }
 
+static inline pgdval_t pgd_flags(pgd_t pgd)
+{
+	return native_pgd_val(pgd) & PTE_FLAGS_MASK;
+}
+
 #if PAGETABLE_LEVELS >= 3
 #if PAGETABLE_LEVELS == 4
 typedef struct { pudval_t pud; } pud_t;
@@ -117,6 +122,11 @@
 }
 #endif	/* PAGETABLE_LEVELS == 4 */
 
+static inline pudval_t pud_flags(pud_t pud)
+{
+	return native_pud_val(pud) & PTE_FLAGS_MASK;
+}
+
 typedef struct { pmdval_t pmd; } pmd_t;
 
 static inline pmd_t native_make_pmd(pmdval_t val)
@@ -128,6 +138,11 @@
 {
 	return pmd.pmd;
 }
+
+static inline pmdval_t pmd_flags(pmd_t pmd)
+{
+	return native_pmd_val(pmd) & PTE_FLAGS_MASK;
+}
 #else  /* PAGETABLE_LEVELS == 2 */
 #include <asm-generic/pgtable-nopmd.h>
 
diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h
--- a/arch/x86/include/asm/pgtable.h
+++ b/arch/x86/include/asm/pgtable.h
@@ -241,7 +241,7 @@
 
 static inline int pmd_large(pmd_t pte)
 {
-	return (pmd_val(pte) & (_PAGE_PSE | _PAGE_PRESENT)) ==
+	return (pmd_flags(pte) & (_PAGE_PSE | _PAGE_PRESENT)) ==
 		(_PAGE_PSE | _PAGE_PRESENT);
 }
 
@@ -496,7 +496,7 @@
 
 static inline int pmd_present(pmd_t pmd)
 {
-	return pmd_val(pmd) & _PAGE_PRESENT;
+	return pmd_flags(pmd) & _PAGE_PRESENT;
 }
 
 static inline int pmd_none(pmd_t pmd)
@@ -554,7 +554,7 @@
 
 static inline int pmd_bad(pmd_t pmd)
 {
-	return (pmd_val(pmd) & ~(PTE_PFN_MASK | _PAGE_USER)) != _KERNPG_TABLE;
+	return (pmd_flags(pmd) & ~_PAGE_USER) != _KERNPG_TABLE;
 }
 
 static inline unsigned long pages_to_mb(unsigned long npg)
@@ -573,7 +573,7 @@
 
 static inline int pud_present(pud_t pud)
 {
-	return pud_val(pud) & _PAGE_PRESENT;
+	return pud_flags(pud) & _PAGE_PRESENT;
 }
 
 static inline unsigned long pud_page_vaddr(pud_t pud)
@@ -599,20 +599,20 @@
 
 static inline int pud_large(pud_t pud)
 {
-	return (pud_val(pud) & (_PAGE_PSE | _PAGE_PRESENT)) ==
+	return (pud_flags(pud) & (_PAGE_PSE | _PAGE_PRESENT)) ==
 		(_PAGE_PSE | _PAGE_PRESENT);
 }
 
 static inline int pud_bad(pud_t pud)
 {
-	return (pud_val(pud) & ~(PTE_PFN_MASK | _KERNPG_TABLE | _PAGE_USER)) != 0;
+	return (pud_flags(pud) & ~(_KERNPG_TABLE | _PAGE_USER)) != 0;
 }
 #endif	/* PAGETABLE_LEVELS > 2 */
 
 #if PAGETABLE_LEVELS > 3
 static inline int pgd_present(pgd_t pgd)
 {
-	return pgd_val(pgd) & _PAGE_PRESENT;
+	return pgd_flags(pgd) & _PAGE_PRESENT;
 }
 
 static inline unsigned long pgd_page_vaddr(pgd_t pgd)
@@ -638,7 +638,7 @@
 
 static inline int pgd_bad(pgd_t pgd)
 {
-	return (pgd_val(pgd) & ~(PTE_PFN_MASK | _PAGE_USER)) != _KERNPG_TABLE;
+	return (pgd_flags(pgd) & ~_PAGE_USER) != _KERNPG_TABLE;
 }
 
 static inline int pgd_none(pgd_t pgd)



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

* [PATCH 35 of 36] x86: make pgd/pud/pmd/pte_none consistent
  2009-02-05 19:30 [PATCH 00 of 36] x86: clean up pte functions in pgtable*.h Jeremy Fitzhardinge
                   ` (33 preceding siblings ...)
  2009-02-05 19:31 ` [PATCH 34 of 36] x86: add and use pgd/pud/pmd_flags Jeremy Fitzhardinge
@ 2009-02-05 19:31 ` Jeremy Fitzhardinge
  2009-02-06 15:29   ` Ian Campbell
  2009-02-05 19:31 ` [PATCH 36 of 36] x86: make the X_bad functions consistent Jeremy Fitzhardinge
  35 siblings, 1 reply; 42+ messages in thread
From: Jeremy Fitzhardinge @ 2009-02-05 19:31 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: linux-kernel, the arch/x86 maintainers

The _none test is done differently for every level of the pagetable.
Standardize them by:

 1: Use the native_X_val to extract the raw entry, with no need to go
    via paravirt_ops, diff -r 1d0646d0d319 arch/x86/include/asm/pgtable.h, and
 2: Compare with 0 rather than using a boolean !, since they are actually values
    and not booleans.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>

---
 arch/x86/include/asm/pgtable.h |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h
--- a/arch/x86/include/asm/pgtable.h
+++ b/arch/x86/include/asm/pgtable.h
@@ -503,7 +503,7 @@
 {
 	/* Only check low word on 32-bit platforms, since it might be
 	   out of sync with upper half. */
-	return !(unsigned long)native_pmd_val(pmd);
+	return (unsigned long)native_pmd_val(pmd) == 0;
 }
 
 static inline unsigned long pmd_page_vaddr(pmd_t pmd)
@@ -568,7 +568,7 @@
 #if PAGETABLE_LEVELS > 2
 static inline int pud_none(pud_t pud)
 {
-	return pud_val(pud) == 0;
+	return native_pud_val(pud) == 0;
 }
 
 static inline int pud_present(pud_t pud)
@@ -643,7 +643,7 @@
 
 static inline int pgd_none(pgd_t pgd)
 {
-	return !pgd_val(pgd);
+	return !native_pgd_val(pgd);
 }
 #endif	/* PAGETABLE_LEVELS > 3 */
 



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

* [PATCH 36 of 36] x86: make the X_bad functions consistent
  2009-02-05 19:30 [PATCH 00 of 36] x86: clean up pte functions in pgtable*.h Jeremy Fitzhardinge
                   ` (34 preceding siblings ...)
  2009-02-05 19:31 ` [PATCH 35 of 36] x86: make pgd/pud/pmd/pte_none consistent Jeremy Fitzhardinge
@ 2009-02-05 19:31 ` Jeremy Fitzhardinge
  2009-02-05 20:25   ` Hugh Dickins
  35 siblings, 1 reply; 42+ messages in thread
From: Jeremy Fitzhardinge @ 2009-02-05 19:31 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: linux-kernel, the arch/x86 maintainers

Impact: cleanup

Use the same logic to implement all 3 _bad() functions.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
---
 arch/x86/include/asm/pgtable.h |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h
--- a/arch/x86/include/asm/pgtable.h
+++ b/arch/x86/include/asm/pgtable.h
@@ -554,7 +554,7 @@
 
 static inline int pmd_bad(pmd_t pmd)
 {
-	return (pmd_flags(pmd) & ~_PAGE_USER) != _KERNPG_TABLE;
+	return (pmd_flags(pmd) & ~(_KERNPG_TABLE | _PAGE_USER)) != 0;
 }
 
 static inline unsigned long pages_to_mb(unsigned long npg)
@@ -638,7 +638,7 @@
 
 static inline int pgd_bad(pgd_t pgd)
 {
-	return (pgd_flags(pgd) & ~_PAGE_USER) != _KERNPG_TABLE;
+	return (pgd_flags(pgd) & ~(_KERNPG_TABLE | _PAGE_USER)) != 0;
 }
 
 static inline int pgd_none(pgd_t pgd)



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

* Re: [PATCH 36 of 36] x86: make the X_bad functions consistent
  2009-02-05 19:31 ` [PATCH 36 of 36] x86: make the X_bad functions consistent Jeremy Fitzhardinge
@ 2009-02-05 20:25   ` Hugh Dickins
  2009-02-05 20:39     ` Jeremy Fitzhardinge
  0 siblings, 1 reply; 42+ messages in thread
From: Hugh Dickins @ 2009-02-05 20:25 UTC (permalink / raw)
  To: Jeremy Fitzhardinge; +Cc: Ingo Molnar, linux-kernel, the arch/x86 maintainers

On Thu, 5 Feb 2009, Jeremy Fitzhardinge wrote:

> Impact: cleanup
> 
> Use the same logic to implement all 3 _bad() functions.
> 
> Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>

A backward step in my opinion.

Hugh

> ---
>  arch/x86/include/asm/pgtable.h |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h
> --- a/arch/x86/include/asm/pgtable.h
> +++ b/arch/x86/include/asm/pgtable.h
> @@ -554,7 +554,7 @@
>  
>  static inline int pmd_bad(pmd_t pmd)
>  {
> -	return (pmd_flags(pmd) & ~_PAGE_USER) != _KERNPG_TABLE;
> +	return (pmd_flags(pmd) & ~(_KERNPG_TABLE | _PAGE_USER)) != 0;
>  }
>  
>  static inline unsigned long pages_to_mb(unsigned long npg)
> @@ -638,7 +638,7 @@
>  
>  static inline int pgd_bad(pgd_t pgd)
>  {
> -	return (pgd_flags(pgd) & ~_PAGE_USER) != _KERNPG_TABLE;
> +	return (pgd_flags(pgd) & ~(_KERNPG_TABLE | _PAGE_USER)) != 0;
>  }
>  
>  static inline int pgd_none(pgd_t pgd)

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

* Re: [PATCH 36 of 36] x86: make the X_bad functions consistent
  2009-02-05 20:25   ` Hugh Dickins
@ 2009-02-05 20:39     ` Jeremy Fitzhardinge
  0 siblings, 0 replies; 42+ messages in thread
From: Jeremy Fitzhardinge @ 2009-02-05 20:39 UTC (permalink / raw)
  To: Hugh Dickins; +Cc: Ingo Molnar, linux-kernel, the arch/x86 maintainers

Hugh Dickins wrote:
> On Thu, 5 Feb 2009, Jeremy Fitzhardinge wrote:
>
>   
>> Impact: cleanup
>>
>> Use the same logic to implement all 3 _bad() functions.
>>
>> Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
>>     
>
> A backward step in my opinion.
>   

OK, I'm happy to go the other way.  I'll give it a spin.

    J

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

* Re: [PATCH 35 of 36] x86: make pgd/pud/pmd/pte_none consistent
  2009-02-05 19:31 ` [PATCH 35 of 36] x86: make pgd/pud/pmd/pte_none consistent Jeremy Fitzhardinge
@ 2009-02-06 15:29   ` Ian Campbell
  2009-02-06 15:45     ` Ian Campbell
  0 siblings, 1 reply; 42+ messages in thread
From: Ian Campbell @ 2009-02-06 15:29 UTC (permalink / raw)
  To: Jeremy Fitzhardinge; +Cc: Ingo Molnar, linux-kernel, the arch/x86 maintainers

On Thu, 2009-02-05 at 11:31 -0800, Jeremy Fitzhardinge wrote:
> The _none test is done differently for every level of the pagetable.
> Standardize them by:
> 
>  1: Use the native_X_val to extract the raw entry, with no need to go
>     via paravirt_ops, diff -r 1d0646d0d319 arch/x86/include/asm/pgtable.h, and
>  2: Compare with 0 rather than using a boolean !, since they are actually values
>     and not booleans.

In a 32 bit Xen guest this one causes

        [    8.354898] 1 multicall(s) failed: cpu 1
        [    8.354921] Pid: 2213, comm: bootclean Not tainted 2.6.29-rc3-x86_32p-xenU-tip #135
        [    8.354937] Call Trace:
        [    8.354955]  [<c01036e3>] xen_mc_flush+0x133/0x1b0
        [    8.354971]  [<c0105d2a>] ? xen_force_evtchn_callback+0x1a/0x30
        [    8.354988]  [<c0105a60>] xen_flush_tlb_others+0xb0/0xd0
        [    8.355003]  [<c0126643>] flush_tlb_page+0x53/0xa0
        [    8.355018]  [<c0176a80>] do_wp_page+0x2a0/0x7c0
        [    8.355034]  [<c0238f0a>] ? notify_remote_via_irq+0x3a/0x70
        [    8.355049]  [<c0178950>] handle_mm_fault+0x7b0/0xa50
        [    8.355065]  [<c0131a3e>] ? wake_up_new_task+0x8e/0xb0
        [    8.355079]  [<c01337b5>] ? do_fork+0xe5/0x320
        [    8.355095]  [<c0121919>] do_page_fault+0xe9/0x240
        [    8.355109]  [<c0121830>] ? do_page_fault+0x0/0x240
        [    8.355125]  [<c032457a>] error_code+0x72/0x78
        [    8.355139]   call  1/1: op=2863311530 arg=[aaaaaaaa] result=-38	xen_flush_tlb_others+0x41/0xd0
        [    8.355161] ------------[ cut here ]------------
        [    8.355172] kernel BUG at /local/scratch/ianc/devel/kernels/paravirt/arch/x86/xen/multicalls.c:182!
        [    8.355189] invalid opcode: 0000 [#1] SMP 
        [    8.355207] last sysfs file: /sys/class/net/lo/operstate
        [    8.355218] Modules linked in:
        [    8.355230] 
        [    8.355239] Pid: 2213, comm: bootclean Not tainted (2.6.29-rc3-x86_32p-xenU-tip #135) 
        [    8.355254] EIP: 0061:[<c010374b>] EFLAGS: 00010002 CPU: 1
        [    8.355267] EIP is at xen_mc_flush+0x19b/0x1b0
        [    8.355278] EAX: 00000000 EBX: 00000000 ECX: c10cc060 EDX: 00000000
        [    8.355290] ESI: 00000000 EDI: 00000001 EBP: c4c61e70 ESP: c4c61e40
        [    8.355302]  DS: 007b ES: 007b FS: 00d8 GS: 0033 SS: 0069
        [    8.355314] Process bootclean (pid: 2213, ti=c4c60000 task=c5ad3460 task.ti=c4c60000)
        [    8.355328] Stack:
        [    8.355336]  c0367d84 00000001 00000001 aaaaaaaa aaaaaaaa ffffffda c01059f1 c10cc060
        [    8.355372]  c10c0060 c4c7a6d4 bfabf790 bfabf790 c4c61e80 c0105a60 c4c7a6d4 c4c7a580
        [    8.355413]  c4c61ea0 c0126643 00000000 80000000 00000025 08428067 80000000 c4c
        
Didn't figure out why yet.

> 
> Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
> 
> ---
>  arch/x86/include/asm/pgtable.h |    6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h
> --- a/arch/x86/include/asm/pgtable.h
> +++ b/arch/x86/include/asm/pgtable.h
> @@ -503,7 +503,7 @@
>  {
>  	/* Only check low word on 32-bit platforms, since it might be
>  	   out of sync with upper half. */
> -	return !(unsigned long)native_pmd_val(pmd);
> +	return (unsigned long)native_pmd_val(pmd) == 0;
>  }
>  
>  static inline unsigned long pmd_page_vaddr(pmd_t pmd)
> @@ -568,7 +568,7 @@
>  #if PAGETABLE_LEVELS > 2
>  static inline int pud_none(pud_t pud)
>  {
> -	return pud_val(pud) == 0;
> +	return native_pud_val(pud) == 0;
>  }
>  
>  static inline int pud_present(pud_t pud)
> @@ -643,7 +643,7 @@
>  
>  static inline int pgd_none(pgd_t pgd)
>  {
> -	return !pgd_val(pgd);
> +	return !native_pgd_val(pgd);
>  }
>  #endif	/* PAGETABLE_LEVELS > 3 */
>  
> 
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
> 
-- 
Ian Campbell

I can resist anything but temptation.


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

* Re: [PATCH 35 of 36] x86: make pgd/pud/pmd/pte_none consistent
  2009-02-06 15:29   ` Ian Campbell
@ 2009-02-06 15:45     ` Ian Campbell
  2009-02-06 17:43       ` Ian Campbell
  0 siblings, 1 reply; 42+ messages in thread
From: Ian Campbell @ 2009-02-06 15:45 UTC (permalink / raw)
  To: Jeremy Fitzhardinge; +Cc: Ingo Molnar, linux-kernel, the arch/x86 maintainers

On Fri, 2009-02-06 at 15:29 +0000, Ian Campbell wrote:
> On Thu, 2009-02-05 at 11:31 -0800, Jeremy Fitzhardinge wrote:
> > The _none test is done differently for every level of the pagetable.
> > Standardize them by:
> > 
> >  1: Use the native_X_val to extract the raw entry, with no need to go
> >     via paravirt_ops, diff -r 1d0646d0d319 arch/x86/include/asm/pgtable.h, and
> >  2: Compare with 0 rather than using a boolean !, since they are actually values
> >     and not booleans.
> 
> In a 32 bit Xen guest this one causes
> 
>         [    8.354898] 1 multicall(s) failed: cpu 1

Spoke too soon, it's not as 100% reliably reproducing as I thought which
confused my bisection attempt. Will try and locate the real culprit...

Ian.

-- 
Ian Campbell

For a man to truly understand rejection, he must first be ignored by a cat.


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

* Re: [PATCH 35 of 36] x86: make pgd/pud/pmd/pte_none consistent
  2009-02-06 15:45     ` Ian Campbell
@ 2009-02-06 17:43       ` Ian Campbell
  0 siblings, 0 replies; 42+ messages in thread
From: Ian Campbell @ 2009-02-06 17:43 UTC (permalink / raw)
  To: Jeremy Fitzhardinge
  Cc: Ingo Molnar, linux-kernel, the arch/x86 maintainers,
	Rusty Russell, Mike Travis

On Fri, 2009-02-06 at 15:45 +0000, Ian Campbell wrote:
> On Fri, 2009-02-06 at 15:29 +0000, Ian Campbell wrote:
> > On Thu, 2009-02-05 at 11:31 -0800, Jeremy Fitzhardinge wrote:
> > > The _none test is done differently for every level of the pagetable.
> > > Standardize them by:
> > > 
> > >  1: Use the native_X_val to extract the raw entry, with no need to go
> > >     via paravirt_ops, diff -r 1d0646d0d319 arch/x86/include/asm/pgtable.h, and
> > >  2: Compare with 0 rather than using a boolean !, since they are actually values
> > >     and not booleans.
> > 
> > In a 32 bit Xen guest this one causes
> > 
> >         [    8.354898] 1 multicall(s) failed: cpu 1
> 
> Spoke too soon, it's not as 100% reliably reproducing as I thought which
> confused my bisection attempt. Will try and locate the real culprit...

Real culprit was somewhere else entirely:

Subject: Fix xen_flush_tlb_others after const cpumask changes 

The commit
    commit 4595f9620cda8a1e973588e743cf5f8436dd20c6
    Author: Rusty Russell <rusty@rustcorp.com.au>
    Date:   Sat Jan 10 21:58:09 2009 -0800

        x86: change flush_tlb_others to take a const struct cpumask

causes xen_flush_tlb_others to allocate a multicall and then issue it
without initializing it in the case where the cpumask is empty,
leading to:

        [    8.354898] 1 multicall(s) failed: cpu 1
        [    8.354921] Pid: 2213, comm: bootclean Not tainted 2.6.29-rc3-x86_32p-xenU-tip #135
        [    8.354937] Call Trace:
        [    8.354955]  [<c01036e3>] xen_mc_flush+0x133/0x1b0
        [    8.354971]  [<c0105d2a>] ? xen_force_evtchn_callback+0x1a/0x30
        [    8.354988]  [<c0105a60>] xen_flush_tlb_others+0xb0/0xd0
        [    8.355003]  [<c0126643>] flush_tlb_page+0x53/0xa0
        [    8.355018]  [<c0176a80>] do_wp_page+0x2a0/0x7c0
        [    8.355034]  [<c0238f0a>] ? notify_remote_via_irq+0x3a/0x70
        [    8.355049]  [<c0178950>] handle_mm_fault+0x7b0/0xa50
        [    8.355065]  [<c0131a3e>] ? wake_up_new_task+0x8e/0xb0
        [    8.355079]  [<c01337b5>] ? do_fork+0xe5/0x320
        [    8.355095]  [<c0121919>] do_page_fault+0xe9/0x240
        [    8.355109]  [<c0121830>] ? do_page_fault+0x0/0x240
        [    8.355125]  [<c032457a>] error_code+0x72/0x78
        [    8.355139]   call  1/1: op=2863311530 arg=[aaaaaaaa] result=-38     xen_flush_tlb_others+0x41/0xd0

Since empty cpumasks are rare and undoing an xen_mc_entry() is tricky
just issue such requests normally.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Cc: Jeremy Fitzhardinge <jeremy@goop.org>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: Mike Travis <travis@sgi.com>
Cc: x86@kernel.org
---
 arch/x86/xen/mmu.c |    3 ---
 1 files changed, 0 insertions(+), 3 deletions(-)

diff --git a/arch/x86/xen/mmu.c b/arch/x86/xen/mmu.c
index d2e8ed1..319bd40 100644
--- a/arch/x86/xen/mmu.c
+++ b/arch/x86/xen/mmu.c
@@ -1273,8 +1273,6 @@ static void xen_flush_tlb_others(const struct cpumask *cpus,
 	/* Remove us, and any offline CPUS. */
 	cpumask_and(to_cpumask(args->mask), cpus, cpu_online_mask);
 	cpumask_clear_cpu(smp_processor_id(), to_cpumask(args->mask));
-	if (unlikely(cpumask_empty(to_cpumask(args->mask))))
-		goto issue;
 
 	if (va == TLB_FLUSH_ALL) {
 		args->op.cmd = MMUEXT_TLB_FLUSH_MULTI;
@@ -1285,7 +1283,6 @@ static void xen_flush_tlb_others(const struct cpumask *cpus,
 
 	MULTI_mmuext_op(mcs.mc, &args->op, 1, NULL, DOMID_SELF);
 
-issue:
 	xen_mc_issue(PARAVIRT_LAZY_MMU);
 }
 
-- 
1.5.6.5


-- 
Ian Campbell

We are now enjoying total mutual interaction in an imaginary hot tub ...


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

end of thread, other threads:[~2009-02-06 17:44 UTC | newest]

Thread overview: 42+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-02-05 19:30 [PATCH 00 of 36] x86: clean up pte functions in pgtable*.h Jeremy Fitzhardinge
2009-02-05 19:30 ` [PATCH 01 of 36] x86: unify pte_none Jeremy Fitzhardinge
2009-02-05 19:30 ` [PATCH 02 of 36] x86: unify pte_same Jeremy Fitzhardinge
2009-02-05 19:30 ` [PATCH 03 of 36] x86: unify pte_present Jeremy Fitzhardinge
2009-02-05 19:30 ` [PATCH 04 of 36] x86: make _PAGE_HIDDEN conditional Jeremy Fitzhardinge
2009-02-05 19:30 ` [PATCH 05 of 36] x86: unify pte_hidden Jeremy Fitzhardinge
2009-02-05 19:30 ` [PATCH 06 of 36] x86: unify pud_present Jeremy Fitzhardinge
2009-02-05 19:30 ` [PATCH 07 of 36] x86: unify pgd_present Jeremy Fitzhardinge
2009-02-05 19:30 ` [PATCH 08 of 36] x86: unify pmd_present Jeremy Fitzhardinge
2009-02-05 19:30 ` [PATCH 09 of 36] x86: unify pmd_none Jeremy Fitzhardinge
2009-02-05 19:30 ` [PATCH 10 of 36] x86: unify pgd_page_vaddr Jeremy Fitzhardinge
2009-02-05 19:30 ` [PATCH 11 of 36] x86: unify pud_page_vaddr Jeremy Fitzhardinge
2009-02-05 19:30 ` [PATCH 12 of 36] x86: include pgtable_SIZE.h earlier Jeremy Fitzhardinge
2009-02-05 19:30 ` [PATCH 13 of 36] x86: unify pud_page Jeremy Fitzhardinge
2009-02-05 19:30 ` [PATCH 14 of 36] x86: unify pgd_page Jeremy Fitzhardinge
2009-02-05 19:30 ` [PATCH 15 of 36] x86: unify pud_index Jeremy Fitzhardinge
2009-02-05 19:30 ` [PATCH 16 of 36] x86: unify pud_offset Jeremy Fitzhardinge
2009-02-05 19:30 ` [PATCH 17 of 36] x86: unify pmd_page_vaddr Jeremy Fitzhardinge
2009-02-05 19:31 ` [PATCH 18 of 36] x86: unify pmd_page Jeremy Fitzhardinge
2009-02-05 19:31 ` [PATCH 19 of 36] x86: unify pmd_index Jeremy Fitzhardinge
2009-02-05 19:31 ` [PATCH 20 of 36] x86: unify pmd_offset Jeremy Fitzhardinge
2009-02-05 19:31 ` [PATCH 21 of 36] x86: remove redundant pfn_pmd definition Jeremy Fitzhardinge
2009-02-05 19:31 ` [PATCH 22 of 36] x86: unify pmd_pfn Jeremy Fitzhardinge
2009-02-05 19:31 ` [PATCH 23 " Jeremy Fitzhardinge
2009-02-05 19:31 ` [PATCH 24 of 36] x86: unify pte_index Jeremy Fitzhardinge
2009-02-05 19:31 ` [PATCH 25 of 36] x86: unify pte_offset_kernel Jeremy Fitzhardinge
2009-02-05 19:31 ` [PATCH 26 of 36] x86: unify pud_large Jeremy Fitzhardinge
2009-02-05 19:31 ` [PATCH 27 of 36] x86: unify pgd_bad Jeremy Fitzhardinge
2009-02-05 19:31 ` [PATCH 28 " Jeremy Fitzhardinge
2009-02-05 19:31 ` [PATCH 29 of 36] x86: unify pmd_bad Jeremy Fitzhardinge
2009-02-05 19:31 ` [PATCH 30 of 36] x86: unify pages_to_mb Jeremy Fitzhardinge
2009-02-05 19:31 ` [PATCH 31 of 36] x86: unify pud_none Jeremy Fitzhardinge
2009-02-05 19:31 ` [PATCH 32 of 36] x86: unify pgd_none Jeremy Fitzhardinge
2009-02-05 19:31 ` [PATCH 33 of 36] x86: unify io_remap_pfn_range Jeremy Fitzhardinge
2009-02-05 19:31 ` [PATCH 34 of 36] x86: add and use pgd/pud/pmd_flags Jeremy Fitzhardinge
2009-02-05 19:31 ` [PATCH 35 of 36] x86: make pgd/pud/pmd/pte_none consistent Jeremy Fitzhardinge
2009-02-06 15:29   ` Ian Campbell
2009-02-06 15:45     ` Ian Campbell
2009-02-06 17:43       ` Ian Campbell
2009-02-05 19:31 ` [PATCH 36 of 36] x86: make the X_bad functions consistent Jeremy Fitzhardinge
2009-02-05 20:25   ` Hugh Dickins
2009-02-05 20:39     ` Jeremy Fitzhardinge

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