diff options
author | Dan Williams <dan.j.williams@intel.com> | 2017-11-29 19:10:10 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2017-11-29 21:40:42 -0500 |
commit | e4e40e0263ea6a3bfefbfd15d1b6ff5c03f2b95e (patch) | |
tree | b70c06130d7d4a3e777d8f0e9e70173354589b2d | |
parent | 1501899a898dfb5477c55534bdfd734c046da06d (diff) |
mm: switch to 'define pmd_write' instead of __HAVE_ARCH_PMD_WRITE
In response to compile breakage introduced by a series that added the
pud_write helper to x86, Stephen notes:
did you consider using the other paradigm:
In arch include files:
#define pud_write pud_write
static inline int pud_write(pud_t pud)
.....
Then in include/asm-generic/pgtable.h:
#ifndef pud_write
tatic inline int pud_write(pud_t pud)
{
....
}
#endif
If you had, then the powerpc code would have worked ... ;-) and many
of the other interfaces in include/asm-generic/pgtable.h are
protected that way ...
Given that some architecture already define pmd_write() as a macro, it's
a net reduction to drop the definition of __HAVE_ARCH_PMD_WRITE.
Link: http://lkml.kernel.org/r/151129126721.37405.13339850900081557813.stgit@dwillia2-desk3.amr.corp.intel.com
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Suggested-by: Stephen Rothwell <sfr@canb.auug.org.au>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
Cc: Oliver OHalloran <oliveroh@au1.ibm.com>
Cc: Chris Metcalf <cmetcalf@mellanox.com>
Cc: Russell King <linux@armlinux.org.uk>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | arch/arm/include/asm/pgtable-3level.h | 1 | ||||
-rw-r--r-- | arch/arm64/include/asm/pgtable.h | 1 | ||||
-rw-r--r-- | arch/mips/include/asm/pgtable.h | 2 | ||||
-rw-r--r-- | arch/powerpc/include/asm/book3s/64/pgtable.h | 1 | ||||
-rw-r--r-- | arch/s390/include/asm/pgtable.h | 2 | ||||
-rw-r--r-- | arch/sparc/include/asm/pgtable_64.h | 2 | ||||
-rw-r--r-- | arch/tile/include/asm/pgtable.h | 1 | ||||
-rw-r--r-- | arch/x86/include/asm/pgtable.h | 2 | ||||
-rw-r--r-- | include/asm-generic/pgtable.h | 4 |
9 files changed, 6 insertions, 10 deletions
diff --git a/arch/arm/include/asm/pgtable-3level.h b/arch/arm/include/asm/pgtable-3level.h index 2a029bceaf2f..1a7a17b2a1ba 100644 --- a/arch/arm/include/asm/pgtable-3level.h +++ b/arch/arm/include/asm/pgtable-3level.h | |||
@@ -221,7 +221,6 @@ static inline pte_t pte_mkspecial(pte_t pte) | |||
221 | } | 221 | } |
222 | #define __HAVE_ARCH_PTE_SPECIAL | 222 | #define __HAVE_ARCH_PTE_SPECIAL |
223 | 223 | ||
224 | #define __HAVE_ARCH_PMD_WRITE | ||
225 | #define pmd_write(pmd) (pmd_isclear((pmd), L_PMD_SECT_RDONLY)) | 224 | #define pmd_write(pmd) (pmd_isclear((pmd), L_PMD_SECT_RDONLY)) |
226 | #define pmd_dirty(pmd) (pmd_isset((pmd), L_PMD_SECT_DIRTY)) | 225 | #define pmd_dirty(pmd) (pmd_isset((pmd), L_PMD_SECT_DIRTY)) |
227 | #define pud_page(pud) pmd_page(__pmd(pud_val(pud))) | 226 | #define pud_page(pud) pmd_page(__pmd(pud_val(pud))) |
diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h index c9530b5b5ca8..149d05fb9421 100644 --- a/arch/arm64/include/asm/pgtable.h +++ b/arch/arm64/include/asm/pgtable.h | |||
@@ -345,7 +345,6 @@ static inline int pmd_protnone(pmd_t pmd) | |||
345 | 345 | ||
346 | #define pmd_thp_or_huge(pmd) (pmd_huge(pmd) || pmd_trans_huge(pmd)) | 346 | #define pmd_thp_or_huge(pmd) (pmd_huge(pmd) || pmd_trans_huge(pmd)) |
347 | 347 | ||
348 | #define __HAVE_ARCH_PMD_WRITE | ||
349 | #define pmd_write(pmd) pte_write(pmd_pte(pmd)) | 348 | #define pmd_write(pmd) pte_write(pmd_pte(pmd)) |
350 | 349 | ||
351 | #define pmd_mkhuge(pmd) (__pmd(pmd_val(pmd) & ~PMD_TABLE_BIT)) | 350 | #define pmd_mkhuge(pmd) (__pmd(pmd_val(pmd) & ~PMD_TABLE_BIT)) |
diff --git a/arch/mips/include/asm/pgtable.h b/arch/mips/include/asm/pgtable.h index 9e9e94415d08..1a508a74d48d 100644 --- a/arch/mips/include/asm/pgtable.h +++ b/arch/mips/include/asm/pgtable.h | |||
@@ -552,7 +552,7 @@ static inline pmd_t pmd_mkhuge(pmd_t pmd) | |||
552 | extern void set_pmd_at(struct mm_struct *mm, unsigned long addr, | 552 | extern void set_pmd_at(struct mm_struct *mm, unsigned long addr, |
553 | pmd_t *pmdp, pmd_t pmd); | 553 | pmd_t *pmdp, pmd_t pmd); |
554 | 554 | ||
555 | #define __HAVE_ARCH_PMD_WRITE | 555 | #define pmd_write pmd_write |
556 | static inline int pmd_write(pmd_t pmd) | 556 | static inline int pmd_write(pmd_t pmd) |
557 | { | 557 | { |
558 | return !!(pmd_val(pmd) & _PAGE_WRITE); | 558 | return !!(pmd_val(pmd) & _PAGE_WRITE); |
diff --git a/arch/powerpc/include/asm/book3s/64/pgtable.h b/arch/powerpc/include/asm/book3s/64/pgtable.h index 9a677cd5997f..44697817ccc6 100644 --- a/arch/powerpc/include/asm/book3s/64/pgtable.h +++ b/arch/powerpc/include/asm/book3s/64/pgtable.h | |||
@@ -1005,7 +1005,6 @@ static inline int pmd_protnone(pmd_t pmd) | |||
1005 | } | 1005 | } |
1006 | #endif /* CONFIG_NUMA_BALANCING */ | 1006 | #endif /* CONFIG_NUMA_BALANCING */ |
1007 | 1007 | ||
1008 | #define __HAVE_ARCH_PMD_WRITE | ||
1009 | #define pmd_write(pmd) pte_write(pmd_pte(pmd)) | 1008 | #define pmd_write(pmd) pte_write(pmd_pte(pmd)) |
1010 | #define __pmd_write(pmd) __pte_write(pmd_pte(pmd)) | 1009 | #define __pmd_write(pmd) __pte_write(pmd_pte(pmd)) |
1011 | #define pmd_savedwrite(pmd) pte_savedwrite(pmd_pte(pmd)) | 1010 | #define pmd_savedwrite(pmd) pte_savedwrite(pmd_pte(pmd)) |
diff --git a/arch/s390/include/asm/pgtable.h b/arch/s390/include/asm/pgtable.h index d7fe9838084d..0a6b0286c32e 100644 --- a/arch/s390/include/asm/pgtable.h +++ b/arch/s390/include/asm/pgtable.h | |||
@@ -709,7 +709,7 @@ static inline unsigned long pmd_pfn(pmd_t pmd) | |||
709 | return (pmd_val(pmd) & origin_mask) >> PAGE_SHIFT; | 709 | return (pmd_val(pmd) & origin_mask) >> PAGE_SHIFT; |
710 | } | 710 | } |
711 | 711 | ||
712 | #define __HAVE_ARCH_PMD_WRITE | 712 | #define pmd_write pmd_write |
713 | static inline int pmd_write(pmd_t pmd) | 713 | static inline int pmd_write(pmd_t pmd) |
714 | { | 714 | { |
715 | return (pmd_val(pmd) & _SEGMENT_ENTRY_WRITE) != 0; | 715 | return (pmd_val(pmd) & _SEGMENT_ENTRY_WRITE) != 0; |
diff --git a/arch/sparc/include/asm/pgtable_64.h b/arch/sparc/include/asm/pgtable_64.h index 5a9e96be1665..9937c5ff94a9 100644 --- a/arch/sparc/include/asm/pgtable_64.h +++ b/arch/sparc/include/asm/pgtable_64.h | |||
@@ -715,7 +715,7 @@ static inline unsigned long pmd_pfn(pmd_t pmd) | |||
715 | return pte_pfn(pte); | 715 | return pte_pfn(pte); |
716 | } | 716 | } |
717 | 717 | ||
718 | #define __HAVE_ARCH_PMD_WRITE | 718 | #define pmd_write pmd_write |
719 | static inline unsigned long pmd_write(pmd_t pmd) | 719 | static inline unsigned long pmd_write(pmd_t pmd) |
720 | { | 720 | { |
721 | pte_t pte = __pte(pmd_val(pmd)); | 721 | pte_t pte = __pte(pmd_val(pmd)); |
diff --git a/arch/tile/include/asm/pgtable.h b/arch/tile/include/asm/pgtable.h index 2a26cc4fefc2..adfa21b18488 100644 --- a/arch/tile/include/asm/pgtable.h +++ b/arch/tile/include/asm/pgtable.h | |||
@@ -475,7 +475,6 @@ static inline void pmd_clear(pmd_t *pmdp) | |||
475 | #define pmd_mkdirty(pmd) pte_pmd(pte_mkdirty(pmd_pte(pmd))) | 475 | #define pmd_mkdirty(pmd) pte_pmd(pte_mkdirty(pmd_pte(pmd))) |
476 | #define pmd_huge_page(pmd) pte_huge(pmd_pte(pmd)) | 476 | #define pmd_huge_page(pmd) pte_huge(pmd_pte(pmd)) |
477 | #define pmd_mkhuge(pmd) pte_pmd(pte_mkhuge(pmd_pte(pmd))) | 477 | #define pmd_mkhuge(pmd) pte_pmd(pte_mkhuge(pmd_pte(pmd))) |
478 | #define __HAVE_ARCH_PMD_WRITE | ||
479 | 478 | ||
480 | #define pfn_pmd(pfn, pgprot) pte_pmd(pfn_pte((pfn), (pgprot))) | 479 | #define pfn_pmd(pfn, pgprot) pte_pmd(pfn_pte((pfn), (pgprot))) |
481 | #define pmd_pfn(pmd) pte_pfn(pmd_pte(pmd)) | 480 | #define pmd_pfn(pmd) pte_pfn(pmd_pte(pmd)) |
diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h index dcce76ee4aa7..95e2dfd75521 100644 --- a/arch/x86/include/asm/pgtable.h +++ b/arch/x86/include/asm/pgtable.h | |||
@@ -1061,7 +1061,7 @@ extern int pmdp_clear_flush_young(struct vm_area_struct *vma, | |||
1061 | unsigned long address, pmd_t *pmdp); | 1061 | unsigned long address, pmd_t *pmdp); |
1062 | 1062 | ||
1063 | 1063 | ||
1064 | #define __HAVE_ARCH_PMD_WRITE | 1064 | #define pmd_write pmd_write |
1065 | static inline int pmd_write(pmd_t pmd) | 1065 | static inline int pmd_write(pmd_t pmd) |
1066 | { | 1066 | { |
1067 | return pmd_flags(pmd) & _PAGE_RW; | 1067 | return pmd_flags(pmd) & _PAGE_RW; |
diff --git a/include/asm-generic/pgtable.h b/include/asm-generic/pgtable.h index 1ac457511f4e..b234d54f2cb6 100644 --- a/include/asm-generic/pgtable.h +++ b/include/asm-generic/pgtable.h | |||
@@ -805,13 +805,13 @@ static inline int pmd_trans_huge(pmd_t pmd) | |||
805 | { | 805 | { |
806 | return 0; | 806 | return 0; |
807 | } | 807 | } |
808 | #ifndef __HAVE_ARCH_PMD_WRITE | 808 | #ifndef pmd_write |
809 | static inline int pmd_write(pmd_t pmd) | 809 | static inline int pmd_write(pmd_t pmd) |
810 | { | 810 | { |
811 | BUG(); | 811 | BUG(); |
812 | return 0; | 812 | return 0; |
813 | } | 813 | } |
814 | #endif /* __HAVE_ARCH_PMD_WRITE */ | 814 | #endif /* pmd_write */ |
815 | #endif /* CONFIG_TRANSPARENT_HUGEPAGE */ | 815 | #endif /* CONFIG_TRANSPARENT_HUGEPAGE */ |
816 | 816 | ||
817 | #ifndef pud_write | 817 | #ifndef pud_write |