consolidate pte mapping functions across all architectures
Subsystems (26)
cover consolidate pte mapping functions across all architectures
I want to use pte_offset_map() and pte_unmap() for nefarious purposes. But, there are too many dang implementations in all the architectures. These patches set out to consolidate them.
These are mostly one patch per arch to make it easier for the individual arch maintainers to go and look at only the bits that they care about.
In the end, we go from 34 implementations of pte_offset_map{_nested}() and pte_unmap{_nested}() to only three:
1. all highpte implementations (x86, ppc32, frv)
2. all direct-mapped pte implementations (everything almost)
3. SUN3-based m68k
The SUN3 one is special because it uses kmap() instead of kmap_atomic() for which it is wholly unique.
The diffstat is long, but here's the summary. Pretty cool considering that 41 of these lines are just for #includes.
67 files changed, 62 insertions(+), 196 deletions(-)
The steps are as follows, and should be bisectable:
1. Break out all the functions into a new asm/ptemap.h and include it in place of the original functions.
2. Move linux/mm.h arch-independent pte mapping code to linux/ptemap.h, include asm/ptemap.h there
3. Include linux/ptemap.h directly at all use sites (only 39 of these kernel-wide)
4. Standardize all the implementations to use pte_offset_kernel() as the basis for pte_offset_map() whenever possible.
5. Create asm-generic/ptemap.h and consolidate all the architectures that share the pte_offset_kernel() implementations.
6. Consolidate the three HIGHPTE implementations (x86, frv, ppc64) in asm-generic/ptemap.h.
7. Remove the direct asm/ptemap.h includes.
This passes my compile tests on x86, x86_64, sparc, sparc64 s390, ppc64, ppc32, m68k, arm and alpha.
The pte_offset_kernel() migrations help fix the issue that there are two basical variants of pte_offset_map() which is the same for pte_offset_kernel() for !HIGHPTE (this has a few casts removed for clarity):
#define pte_offset_map(dir, address) \ (page_address(pmd_page(*dir)) + pte_index(address)) and #define pte_offset_map(dir, address) \ (pmd_page_vaddr(*dir) + pte_index(addr))
As you can see, the pte_index() is exactly the same. The only question is if
page_address(pmd_page(*dir))
and
pmd_page_vaddr(*dir)
are equivalent. I claim they are and that the pmd_page_vaddr() version is superior since it doesn't need to do the conversion to a 'struct page' and back.
Let's look at those with pmd_page_vaddr() and pmd_page expanded:
page_address(pfn_to_page(pmd_val(pmd) >> PAGE_SHIFT)) __va(pmd_val(pmd) & PTE_PFN_MASK)
pmd pages are never in highmem, so page_address() is always effectively lowmem_page_address(). Epanding that, we have:
__va(page_to_pfn(pfn_to_page(pmd_val(pmd) >> PAGE_SHIFT)) << PAGE_SHIFT)
doing page_to_pfn(pfn_to_page()) is a noop, so that simplifies to:
__va((pmd_val(pmd) >> PAGE_SHIFT) << PAGE_SHIFT) which we're comparing to: __va(pmd_val(pmd) & PTE_PFN_MASK)
the '>> PAGE_SHIFT << PAGE_SHIFT' just has the effect of masking out some low bits, which is exactly what '& PTE_PFN_MASK' does.
67 files changed, 62 insertions(+), 196 deletions(-)
arch/alpha/include/asm/pgtable.h | 5 +---- arch/arm/include/asm/pgtable.h | 8 ++------ arch/arm/kernel/traps.c | 1 + arch/arm/mm/fault-armv.c | 1 + arch/arm/mm/fault.c | 1 + arch/arm/mm/pgd.c | 1 + arch/cris/include/asm/pgtable.h | 6 ------ arch/frv/include/asm/highmem.h | 5 +++++ arch/frv/include/asm/pgtable.h | 17 +---------------- arch/frv/kernel/gdb-stub.c | 2 +- arch/frv/mm/fault.c | 2 +- arch/ia64/include/asm/pgtable.h | 4 ---- arch/ia64/mm/hugetlbpage.c | 1 + arch/m32r/include/asm/pgtable.h | 5 ----- arch/m68k/include/asm/motorola_pgtable.h | 5 ----- arch/m68k/include/asm/sun3_pgtable.h | 5 ----- arch/m68k/mm/kmap.c | 1 + arch/mips/include/asm/pgtable-32.h | 10 +--------- arch/mips/include/asm/pgtable-64.h | 10 +--------- arch/mips/mm/tlb-r4k.c | 1 + arch/mips/mm/tlb-r8k.c | 1 + arch/mn10300/include/asm/pgtable.h | 6 ------ arch/mn10300/mm/cache.c | 1 + arch/parisc/include/asm/pgtable.h | 7 ------- arch/parisc/kernel/cache.c | 1 + arch/parisc/kernel/pci-dma.c | 2 ++ arch/powerpc/Kconfig | 4 ++++ arch/powerpc/include/asm/pgtable-ppc32.h | 8 -------- arch/powerpc/include/asm/pgtable-ppc64.h | 5 ----- arch/powerpc/mm/pgtable_32.c | 1 + arch/powerpc/mm/pgtable_64.c | 1 + arch/powerpc/mm/subpage-prot.c | 1 + arch/s390/include/asm/pgtable.h | 4 ---- arch/s390/lib/uaccess_pt.c | 1 + arch/sh/include/asm/pgtable_32.h | 5 ----- arch/sh/include/asm/pgtable_64.h | 5 ----- arch/sh/mm/cache-sh5.c | 1 + arch/sh/mm/hugetlbpage.c | 1 + arch/sparc/include/asm/pgtable_32.h | 15 --------------- arch/sparc/include/asm/pgtable_64.h | 14 +++++--------- arch/sparc/kernel/signal32.c | 1 + arch/sparc/mm/fault_64.c | 1 + arch/sparc/mm/generic_64.c | 1 + arch/sparc/mm/hugetlbpage.c | 1 + arch/sparc/mm/io-unit.c | 1 + arch/sparc/mm/iommu.c | 1 + arch/um/include/asm/pgtable.h | 6 ------ arch/um/kernel/tlb.c | 1 + arch/x86/include/asm/pgtable_32.h | 17 ----------------- arch/x86/include/asm/pgtable_64.h | 6 ------ arch/x86/kernel/vm86_32.c | 1 + arch/x86/mm/gup.c | 1 + arch/xtensa/include/asm/pgtable.h | 6 ------ fs/proc/task_mmu.c | 1 + include/linux/mm.h | 26 -------------------------- lib/ioremap.c | 1 + mm/fremap.c | 1 + mm/memory.c | 1 + mm/mempolicy.c | 1 + mm/migrate.c | 1 + mm/mincore.c | 1 + mm/mprotect.c | 1 + mm/mremap.c | 1 + mm/pagewalk.c | 1 + mm/rmap.c | 1 + mm/swapfile.c | 1 + mm/vmalloc.c | 1 + 67 files changed, 62 insertions(+), 196 deletions(-)
RFC PATCH 1/35 rename arm and frv's __pte_index()
The arm and frv __pte_index()es are the exact same as everyone else's pte_index(). So, remove the __ and give them the same name as all the other implementations.
---
linux-2.6.git-dave/arch/arm/include/asm/pgtable.h | 8 ++++---- linux-2.6.git-dave/arch/frv/include/asm/pgtable.h | 2 +- linux-2.6.git-dave/arch/frv/kernel/gdb-stub.c | 2 +- linux-2.6.git-dave/arch/frv/mm/fault.c | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-)
arch/arm/include/asm/pgtable.h renamed from arch/arm/include/asm/pgtable.h~rename-arm-__pte_index +4 -4
@@ -263,9 +263,9 @@ extern struct page *empty_zero_page;#define pte_none (pte) (!pte_val(pte))#define pte_clear (mm,addr,ptep) set_pte_ext(ptep, __pte(0), 0)#define pte_page (pte) (pfn_to_page(pte_pfn(pte))) -#define pte_offset_kernel (dir,addr) (pmd_page_vaddr(*(dir)) + __pte_index(addr)) -#define pte_offset_map (dir,addr) (pmd_page_vaddr(*(dir)) + __pte_index(addr)) -#define pte_offset_map_nested (dir,addr) (pmd_page_vaddr(*(dir)) + __pte_index(addr)) +#define pte_offset_kernel (dir,addr) (pmd_page_vaddr(*(dir)) + pte_index(addr)) +#define pte_offset_map (dir,addr) (pmd_page_vaddr(*(dir)) + pte_index(addr)) +#define pte_offset_map_nested (dir,addr) (pmd_page_vaddr(*(dir)) + pte_index(addr))#define pte_unmap (pte) do { } while (0)#define pte_unmap_nested (pte) do { } while (0)
@@ -373,7 +373,7 @@ static inline pte_t *pmd_page_vaddr(pmd_#define pmd_offset (dir, addr) ((pmd_t *)(dir))/* Find an entry in the third-level page table.. */ -#define __pte_index (addr) (((addr) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)) +#define pte_index (addr) (((addr) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))static inline pte_t pte_modify (pte_t pte,pgprot_t newprot) {
arch/frv/include/asm/pgtable.h renamed from arch/frv/include/asm/pgtable.h~rename-arm-__pte_index +1 -1
@@ -436,7 +436,7 @@ static inline pte_t pte_modify(pte_t pte#define pgd_index_k (addr) pgd_index(addr)/* Find an entry in the bottom-level page table.. */ -#define __pte_index (address) (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)) +#define pte_index (address) (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))/* * the pte page can be thought of an array like this: pte_t[PTRS_PER_PTE]
arch/frv/kernel/gdb-stub.c renamed from arch/frv/kernel/gdb-stub.c~rename-arm-__pte_index +1 -1
@@ -465,7 +465,7 @@ static inline unsigned long gdbstub_virt__set_DAMPR (5 , val | xAMPRx_L | xAMPRx_SS_16Kb | xAMPRx_S | xAMPRx_C | xAMPRx_V);/* now its safe to access pmd */ - pte = (pte_t *)__get_DAMLR (5 ) +__pte_index (vaddr); + pte = (pte_t *)__get_DAMLR (5 ) +pte_index (vaddr);if (pte_present (*pte)) val =pte_val (*pte);else
arch/frv/mm/fault.c renamed from arch/frv/mm/fault.c~rename-arm-__pte_index +1 -1
@@ -240,7 +240,7 @@ asmlinkage void do_page_fault(int datamm : "r" (_pme | xAMPRx_L|xAMPRx_SS_16Kb|xAMPRx_S|xAMPRx_C|xAMPRx_V) ); - pte = (pte_t *) damlr +__pte_index (ear0); + pte = (pte_t *) damlr +pte_index (ear0); val =pte_val (*pte); asmvolatile ("movgs %0,dampr2" ::"r" (dampr));
_
RFC PATCH 2/35 rework sparc pte functions to be consistent with other arches
In reply to Dave Hansensparc64 has a unique unusual pte_index(). All other architectures just take a virtual address and give back the offset inside the pte page of that address's pte.
The sparc64 one actually takes both the pmd_t and the virtual address and returns the pte_t itself. This is more akin to what pte_offset_map() does on all the other implementations.
This patch adds a new implementations of pte_index() and pmd_page_vaddr() which are pretty straighforward and just copied from other architectures.
Then, we use the new functions in pte_offset_kernel(). We use pte_offset_kernel() as the base from which we define pte_offset_map() and pte_offset_map_nested().
All of this brings sparc64 back inline with what all the other architectures are doing and prepares it for things to come. :)
---
linux-2.6.git-dave/arch/sparc/include/asm/pgtable_64.h | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
arch/sparc/include/asm/pgtable_64.h renamed from arch/sparc/include/asm/pgtable_64.h~rename-sparc-pte_index +7 -6
@@ -619,6 +619,7 @@ static inline int pte_special(pte_t pte)#define __pmd_page (pmd) \ ((unsigned long) __va((((unsigned long)pmd_val(pmd))<<11UL)))#define pmd_page (pmd) virt_to_page((void *)__pmd_page(pmd)) +#define pmd_page_vaddr (pmd) ((unsigned long) __va(pmd_val(pmd) & PAGE_MASK))#define pud_page_vaddr (pud) \ ((unsigned long) __va((((unsigned long)pud_val(pud))<<11UL)))#define pud_page (pud) virt_to_page((void *)pud_page_vaddr(pud))
@@ -646,13 +647,13 @@ static inline int pte_special(pte_t pte) ((pmd_t *)pud_page_vaddr (*(pudp)) + \ (((address) >> PMD_SHIFT) & (PTRS_PER_PMD-1))) +#define pte_index (address) (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)) +/* Find an entry in the third-level page table.. */ -#define pte_index (dir, address) \ - ((pte_t *) __pmd_page(*(dir)) + \ - ((address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))) -#define pte_offset_kernel pte_index -#define pte_offset_map pte_index -#define pte_offset_map_nested pte_index +#define pte_offset_kernel (dir, address) \ + ((pte_t *)pmd_page_vaddr(*(dir)) + pte_index(address)) +#define pte_offset_map (dir, address) pte_offset_kernel((dir), (address)) +#define pte_offset_map_nested (dir, address) pte_offset_kernel((dir), (address))#define pte_unmap (pte) do { } while (0)#define pte_unmap_nested (pte) do { } while (0)
_
RFC PATCH 3/35 alpha: create ptemap.h
In reply to Dave Hansen---
linux-2.6.git-dave/arch/alpha/include/asm/pgtable.h | 5 +---- linux-2.6.git-dave/arch/alpha/include/asm/ptemap.h | 9 +++++++++ 2 files changed, 10 insertions(+), 4 deletions(-)
arch/alpha/include/asm/pgtable.h renamed from arch/alpha/include/asm/pgtable.h~alpha-ptemaph +1 -4
@@ -317,10 +317,7 @@ extern inline pte_t * pte_offset_kernel(return ret; } -#define pte_offset_map (dir,addr) pte_offset_kernel((dir),(addr)) -#define pte_offset_map_nested (dir,addr) pte_offset_kernel((dir),(addr)) -#define pte_unmap (pte) do { } while (0) -#define pte_unmap_nested (pte) do { } while (0) +#inclue <asm/ptemap.h>extern pgd_t swapper_pg_dir[1024 ];
arch/alpha/include/asm/ptemap.h new file +9 -0
@@ -0,0 +1,9 @@ +#ifndef _ALPHA_ASM_PTEMAP_H +#define _ALPHA_ASM_PTEMAP_H + +#define pte_offset_map (dir,addr) pte_offset_kernel((dir),(addr)) +#define pte_offset_map_nested (dir,addr) pte_offset_kernel((dir),(addr)) +#define pte_unmap (pte) do { } while (0) +#define pte_unmap_nested (pte) do { } while (0) + +#endif /* _ALPHA_ASM_PTEMAP_H */
_
RFC PATCH 4/35 arm: create ptemap.h
In reply to Dave Hansen---
linux-2.6.git-dave/arch/arm/include/asm/pgtable.h | 6 ++---- linux-2.6.git-dave/arch/arm/include/asm/ptemap.h | 9 +++++++++ 2 files changed, 11 insertions(+), 4 deletions(-)
arch/arm/include/asm/pgtable.h renamed from arch/arm/include/asm/pgtable.h~arm-ptemaph +2 -4
@@ -264,10 +264,8 @@ extern struct page *empty_zero_page;#define pte_clear (mm,addr,ptep) set_pte_ext(ptep, __pte(0), 0)#define pte_page (pte) (pfn_to_page(pte_pfn(pte)))#define pte_offset_kernel (dir,addr) (pmd_page_vaddr(*(dir)) + pte_index(addr)) -#define pte_offset_map (dir,addr) (pmd_page_vaddr(*(dir)) + pte_index(addr)) -#define pte_offset_map_nested (dir,addr) (pmd_page_vaddr(*(dir)) + pte_index(addr)) -#define pte_unmap (pte) do { } while (0) -#define pte_unmap_nested (pte) do { } while (0) + +#include <asm/ptemap.h> #define set_pte_ext (ptep,pte,ext) cpu_set_pte_ext(ptep,pte,ext)
arch/arm/include/asm/ptemap.h new file +9 -0
@@ -0,0 +1,9 @@ +#ifndef _ARM_ASM_PTEMAP_H +#define _ARM_ASM_PTEMAP_H + +#define pte_offset_map (dir,addr) (pmd_page_vaddr(*(dir)) + pte_index(addr)) +#define pte_offset_map_nested (dir,addr) (pmd_page_vaddr(*(dir)) + pte_index(addr)) +#define pte_unmap (pte) do { } while (0) +#define pte_unmap_nested (pte) do { } while (0) + +#endif /* _ARM_ASM_PTEMAP_H */
_
RFC PATCH 5/35 avr32: create ptemap.h
In reply to Dave Hansen---
linux-2.6.git-dave/arch/avr32/include/asm/ptemap.h | 9 +++++++++ 1 file changed, 9 insertions(+)
arch/avr32/include/asm/ptemap.h new file +9 -0
@@ -0,0 +1,9 @@ +#ifndef _AVR32_ASM_PTEMAP_H +#define _AVR32_ASM_PTEMAP_H + +#define pte_offset_map (dir, address) pte_offset_kernel(dir, address) +#define pte_offset_map_nested (dir, address) pte_offset_kernel(dir, address) +#define pte_unmap (pte) do { } while (0) +#define pte_unmap_nested (pte) do { } while (0) + +#endif /* _AVR32_ASM_PTEMAP_H */
_
RFC PATCH 6/35 cris: create ptemap.h
In reply to Dave Hansen---
linux-2.6.git-dave/arch/cris/include/asm/pgtable.h | 7 +------ linux-2.6.git-dave/arch/cris/include/asm/ptemap.h | 11 +++++++++++ 2 files changed, 12 insertions(+), 6 deletions(-)
arch/cris/include/asm/pgtable.h renamed from arch/cris/include/asm/pgtable.h~cris-ptemaph +1 -6
@@ -244,12 +244,7 @@ static inline pgd_t * pgd_offset(const s (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))#define pte_offset_kernel (dir, address) \ ((pte_t *) pmd_page_vaddr(*(dir)) + __pte_offset(address)) -#define pte_offset_map (dir, address) \ - ((pte_t *)page_address(pmd_page(*(dir))) + __pte_offset(address)) -#define pte_offset_map_nested (dir, address) pte_offset_map(dir, address) - -#define pte_unmap (pte) do { } while (0) -#define pte_unmap_nested (pte) do { } while (0) +#include <asm/ptemap.h> #define pte_pfn (x) ((unsigned long)(__va((x).pte)) >> PAGE_SHIFT)#define pfn_pte (pfn, prot) __pte(((pfn) << PAGE_SHIFT) | pgprot_val(prot))
arch/cris/include/asm/ptemap.h renamed from arch/cris/include/asm/ptemap.h~cris-ptemaph +11 -0
@@ -0,0 +1,11 @@ +#ifndef _CRIS_ASM_PTEMAP_H +#define _CRIS_ASM_PTEMAP_H + +#define pte_offset_map (dir, address) \ + ((pte_t *)page_address(pmd_page(*(dir))) + __pte_offset(address)) +#define pte_offset_map_nested (dir, address) pte_offset_map(dir, address) + +#define pte_unmap (pte) do { } while (0) +#define pte_unmap_nested (pte) do { } while (0) + +#endif /* _CRIS_ASM_PTEMAP_H */
_
RFC PATCH 7/35 frv: create ptemap.h
In reply to Dave Hansen---
linux-2.6.git-dave/arch/frv/include/asm/pgtable.h | 15 +-------------- linux-2.6.git-dave/arch/frv/include/asm/ptemap.h | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 14 deletions(-)
arch/frv/include/asm/pgtable.h renamed from arch/frv/include/asm/pgtable.h~frv-ptemaph +1 -14
@@ -449,20 +449,7 @@ static inline pte_t pte_modify(pte_t pte#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(pmd_page(*(dir)),KM_PTE0) + pte_index(address)) -#define pte_offset_map_nested (dir, address) \ - ((pte_t *)kmap_atomic(pmd_page(*(dir)),KM_PTE1) + pte_index(address)) -#define pte_unmap (pte) kunmap_atomic(pte, KM_PTE0) -#define pte_unmap_nested (pte) kunmap_atomic((pte), KM_PTE1) -#else -#define pte_offset_map (dir, address) \ - ((pte_t *)page_address(pmd_page(*(dir))) + pte_index(address)) -#define pte_offset_map_nested (dir, address) pte_offset_map((dir), (address)) -#define pte_unmap (pte) do { } while (0) -#define pte_unmap_nested (pte) do { } while (0) -#endif +#include <asm/ptemap.h> /* * Handle swap and file entries
arch/frv/include/asm/ptemap.h renamed from arch/frv/include/asm/ptemap.h~frv-ptemaph +19 -0
@@ -0,0 +1,19 @@ +#ifndef _FRV_ASM_PTEMAP_H +#define _FRV_ASM_PTEMAP_H + +#if defined(CONFIG_HIGHPTE ) +#define pte_offset_map (dir, address) \ + ((pte_t *)kmap_atomic(pmd_page(*(dir)),KM_PTE0) + pte_index(address)) +#define pte_offset_map_nested (dir, address) \ + ((pte_t *)kmap_atomic(pmd_page(*(dir)),KM_PTE1) + pte_index(address)) +#define pte_unmap (pte) kunmap_atomic(pte, KM_PTE0) +#define pte_unmap_nested (pte) kunmap_atomic((pte), KM_PTE1) +#else +#define pte_offset_map (dir, address) \ + ((pte_t *)page_address(pmd_page(*(dir))) + pte_index(address)) +#define pte_offset_map_nested (dir, address) pte_offset_map((dir), (address)) +#define pte_unmap (pte) do { } while (0) +#define pte_unmap_nested (pte) do { } while (0) +#endif + +#endif /* _FRV_ASM_PTEMAP_H */
_
RFC PATCH 8/35 ia64: create ptemap.h
In reply to Dave Hansen---
linux-2.6.git-dave/arch/ia64/include/asm/pgtable.h | 6 ++---- linux-2.6.git-dave/arch/ia64/include/asm/ptemap.h | 9 +++++++++ 2 files changed, 11 insertions(+), 4 deletions(-)
arch/ia64/include/asm/pgtable.h renamed from arch/ia64/include/asm/pgtable.h~ia64-ptemaph +2 -4
@@ -405,10 +405,8 @@ pgd_offset (const struct mm_struct *mm,*/ #define pte_index (addr) (((addr) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))#define pte_offset_kernel (dir,addr) ((pte_t *) pmd_page_vaddr(*(dir)) + pte_index(addr)) -#define pte_offset_map (dir,addr) pte_offset_kernel(dir, addr) -#define pte_offset_map_nested (dir,addr) pte_offset_map(dir, addr) -#define pte_unmap (pte) do { } while (0) -#define pte_unmap_nested (pte) do { } while (0) + +#include <asm/ptemap.h> /* atomic versions of the some PTE manipulations: */
arch/ia64/include/asm/ptemap.h renamed from arch/ia64/include/asm/ptemap.h~ia64-ptemaph +9 -0
@@ -0,0 +1,9 @@ +#ifndef _IA64_ASM_PTEMAP_H +#define _IA64_ASM_PTEMAP_H + +#define pte_offset_map (dir,addr) pte_offset_kernel(dir, addr) +#define pte_offset_map_nested (dir,addr) pte_offset_map(dir, addr) +#define pte_unmap (pte) do { } while (0) +#define pte_unmap_nested (pte) do { } while (0) + +#endif /* _IA64_ASM_PTEMAP_H */
_
RFC PATCH 9/35 m32r: create ptemap.h
In reply to Dave Hansen---
linux-2.6.git-dave/arch/m32r/include/asm/pgtable.h | 6 +----- linux-2.6.git-dave/arch/m32r/include/asm/ptemap.h | 10 ++++++++++ 2 files changed, 11 insertions(+), 5 deletions(-)
arch/m32r/include/asm/pgtable.h renamed from arch/m32r/include/asm/pgtable.h~m32r-ptemaph +1 -5
@@ -330,11 +330,7 @@ static inline void pmd_set(pmd_t * pmdp, (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))#define pte_offset_kernel (dir, address) \ ((pte_t *)pmd_page_vaddr(*(dir)) + pte_index(address)) -#define pte_offset_map (dir, address) \ - ((pte_t *)page_address(pmd_page(*(dir))) + pte_index(address)) -#define pte_offset_map_nested (dir, address) pte_offset_map(dir, address) -#define pte_unmap (pte) do { } while (0) -#define pte_unmap_nested (pte) do { } while (0) +#include <asm/ptemap.h> /* Encode and de-code a swap entry */ #define __swp_type (x) (((x).val >> 2) & 0x1f)
arch/m32r/include/asm/ptemap.h renamed from arch/m32r/include/asm/ptemap.h~m32r-ptemaph +10 -0
@@ -0,0 +1,10 @@ +#ifndef _M32R_ASM_PTEMAP_H +#define _M32R_ASM_PTEMAP_H + +#define pte_offset_map (dir, address) \ + ((pte_t *)page_address(pmd_page(*(dir))) + pte_index(address)) +#define pte_offset_map_nested (dir, address) pte_offset_map(dir, address) +#define pte_unmap (pte) do { } while (0) +#define pte_unmap_nested (pte) do { } while (0) + +#endif /* _M32R_ASM_PTEMAP_H */
_
RFC PATCH 10/35 m68k: create ptemap.h
In reply to Dave Hansen---
linux-2.6.git-dave/arch/m68k/include/asm/motorola_pgtable.h | 5 -- linux-2.6.git-dave/arch/m68k/include/asm/ptemap.h | 22 ++++++++++++ linux-2.6.git-dave/arch/m68k/include/asm/sun3_pgtable.h | 6 +-- 3 files changed, 25 insertions(+), 8 deletions(-)
arch/m68k/include/asm/motorola_pgtable.h renamed from arch/m68k/include/asm/motorola_pgtable.h~m68k-ptemaph +1 -4
@@ -220,10 +220,7 @@ static inline pte_t *pte_offset_kernel(preturn (pte_t *)__pmd_page (*pmdp) + ((address >>PAGE_SHIFT ) & (PTRS_PER_PTE -1 )); } -#define pte_offset_map (pmdp,address) ((pte_t *)__pmd_page(*pmdp) + (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))) -#define pte_offset_map_nested (pmdp, address) pte_offset_map(pmdp, address) -#define pte_unmap (pte) ((void)0) -#define pte_unmap_nested (pte) ((void)0) +#include <asm/ptemap.h> /* * Allocate and free page tables. The xxx_kernel() versions are
arch/m68k/include/asm/ptemap.h new file +22 -0
@@ -0,0 +1,22 @@ +#ifndef _M68K_ASM_PTEMAP_H +#define _M68K_ASM_PTEMAP_H + +#ifdef CONFIG_SUN3 + +#include <linux/mm.h> + +#define pte_offset_map (pmd, address) ((pte_t *)kmap(pmd_page(*pmd)) + pte_index(address)) +#define pte_offset_map_nested (pmd, address) pte_offset_map(pmd, address) +#define pte_unmap (pte) kunmap(pte) +#define pte_unmap_nested (pte) kunmap(pte) + +#else /* !CONFIG_SUN3, Motorola */ + +#define pte_offset_map (pmdp,address) ((pte_t *)__pmd_page(*pmdp) + (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))) +#define pte_offset_map_nested (pmdp, address) pte_offset_map(pmdp, address) +#define pte_unmap (pte) ((void)0) +#define pte_unmap_nested (pte) ((void)0) + +#endif /* CONFIG_SUN3 */ + +#endif /* _M68K_ASM_PTEMAP_H */
arch/m68k/include/asm/sun3_pgtable.h renamed from arch/m68k/include/asm/sun3_pgtable.h~m68k-ptemaph +2 -4
@@ -218,10 +218,8 @@ static inline pte_t pgoff_to_pte(unsigne#define pte_index (address) ((address >> PAGE_SHIFT) & (PTRS_PER_PTE-1))#define pte_offset_kernel (pmd, address) ((pte_t *) __pmd_page(*pmd) + pte_index(address))/* FIXME: should we bother with kmap() here? */ -#define pte_offset_map (pmd, address) ((pte_t *)kmap(pmd_page(*pmd)) + pte_index(address)) -#define pte_offset_map_nested (pmd, address) pte_offset_map(pmd, address) -#define pte_unmap (pte) kunmap(pte) -#define pte_unmap_nested (pte) kunmap(pte) + +#include <asm/ptemap.h> /* Macros to (de)construct the fake PTEs representing swap pages. */ #define __swp_type (x) ((x).val & 0x7F)
_
RFC PATCH 11/35 mips: create ptemap.h
In reply to Dave Hansen---
linux-2.6.git-dave/arch/mips/include/asm/pgtable-32.h | 8 ------ linux-2.6.git-dave/arch/mips/include/asm/pgtable-64.h | 8 ------ linux-2.6.git-dave/arch/mips/include/asm/ptemap.h | 22 ++++++++++++++++++ 3 files changed, 24 insertions(+), 14 deletions(-)
arch/mips/include/asm/pgtable-32.h renamed from arch/mips/include/asm/pgtable-32.h~mips-ptemaph +1 -7
@@ -151,13 +151,7 @@ pfn_pte(unsigned long pfn, pgprot_t prot ((pte_t *) pmd_page_vaddr(*(dir)) + __pte_offset(address))#define pte_offset_kernel (dir, address) \ ((pte_t *) pmd_page_vaddr(*(dir)) + __pte_offset(address)) - -#define pte_offset_map (dir, address) \ - ((pte_t *)page_address(pmd_page(*(dir))) + __pte_offset(address)) -#define pte_offset_map_nested (dir, address) \ - ((pte_t *)page_address(pmd_page(*(dir))) + __pte_offset(address)) -#define pte_unmap (pte) ((void)(pte)) -#define pte_unmap_nested (pte) ((void)(pte)) +#include <asm/ptemap.h> #if defined(CONFIG_CPU_R3000 ) || defined(CONFIG_CPU_TX39XX )
arch/mips/include/asm/pgtable-64.h renamed from arch/mips/include/asm/pgtable-64.h~mips-ptemaph +1 -7
@@ -215,13 +215,7 @@ static inline pmd_t *pmd_offset(pud_t * ((pte_t *) pmd_page_vaddr(*(dir)) + __pte_offset(address))#define pte_offset_kernel (dir, address) \ ((pte_t *) pmd_page_vaddr(*(dir)) + __pte_offset(address)) -#define pte_offset_map (dir, address) \ - ((pte_t *)page_address(pmd_page(*(dir))) + __pte_offset(address)) -#define pte_offset_map_nested (dir, address) \ - ((pte_t *)page_address(pmd_page(*(dir))) + __pte_offset(address)) -#define pte_unmap (pte) ((void)(pte)) -#define pte_unmap_nested (pte) ((void)(pte)) - +#include <asm/ptemap.h> /* * Initialize a new pgd / pmd table with invalid pointers. */
arch/mips/include/asm/ptemap.h new file +22 -0
@@ -0,0 +1,22 @@ +#ifndef _MIPS_ASM_PTEMAP_H +#define _MIPS_ASM_PTEMAP_H + +#ifdef CONFIG_32BIT +#define pte_offset_map (dir, address) \ + ((pte_t *)page_address(pmd_page(*(dir))) + __pte_offset(address)) +#define pte_offset_map_nested (dir, address) \ + ((pte_t *)page_address(pmd_page(*(dir))) + __pte_offset(address)) +#define pte_unmap (pte) ((void)(pte)) +#define pte_unmap_nested (pte) ((void)(pte)) +#endif + +#ifdef CONFIG_64BIT +#define pte_offset_map (dir, address) \ + ((pte_t *)page_address(pmd_page(*(dir))) + __pte_offset(address)) +#define pte_offset_map_nested (dir, address) \ + ((pte_t *)page_address(pmd_page(*(dir))) + __pte_offset(address)) +#define pte_unmap (pte) ((void)(pte)) +#define pte_unmap_nested (pte) ((void)(pte)) +#endif + +#endif /* _MIPS_ASM_PTEMAP_H */
_
RFC PATCH 12/35 mn10300: create ptemap.h
In reply to Dave Hansen---
linux-2.6.git-dave/arch/mn10300/include/asm/pgtable.h | 6 +----- linux-2.6.git-dave/arch/mn10300/include/asm/ptemap.h | 10 ++++++++++ 2 files changed, 11 insertions(+), 5 deletions(-)
arch/mn10300/include/asm/pgtable.h renamed from arch/mn10300/include/asm/pgtable.h~mn10300-ptemaph +1 -5
@@ -455,11 +455,7 @@ static inline int set_kernel_exec(unsignreturn 0 ; } -#define pte_offset_map (dir, address) \ - ((pte_t *) page_address(pmd_page(*(dir))) + pte_index(address)) -#define pte_offset_map_nested (dir, address) pte_offset_map(dir, address) -#define pte_unmap (pte) do {} while (0) -#define pte_unmap_nested (pte) do {} while (0) +#include <asm/ptemap.h> /* * The MN10300 has external MMU info in the form of a TLB: this is adapted from
arch/mn10300/include/asm/ptemap.h renamed from arch/mn10300/include/asm/ptemap.h~mn10300-ptemaph +10 -0
@@ -0,0 +1,10 @@ +#ifndef _MN10300_ASM_PTEMAP_H +#define _MN10300_ASM_PTEMAP_H + +#define pte_offset_map (dir, address) \ + ((pte_t *) page_address(pmd_page(*(dir))) + pte_index(address)) +#define pte_offset_map_nested (dir, address) pte_offset_map(dir, address) +#define pte_unmap (pte) do {} while (0) +#define pte_unmap_nested (pte) do {} while (0) + +#endif /* _MN10300_ASM_PTEMAP_H */
_
RFC PATCH 13/35 parisc: create ptemap.h
In reply to Dave Hansen---
linux-2.6.git-dave/arch/parisc/include/asm/pgtable.h | 7 +------ linux-2.6.git-dave/arch/parisc/include/asm/ptemap.h | 12 ++++++++++++ 2 files changed, 13 insertions(+), 6 deletions(-)
arch/parisc/include/asm/pgtable.h renamed from arch/parisc/include/asm/pgtable.h~parisc-ptemaph +1 -6
@@ -396,13 +396,8 @@ static inline pte_t pte_modify(pte_t pte#define pte_index (address) (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE-1))#define pte_offset_kernel (pmd, address) \ ((pte_t *) pmd_page_vaddr(*(pmd)) + pte_index(address)) -#define pte_offset_map (pmd, address) pte_offset_kernel(pmd, address) -#define pte_offset_map_nested (pmd, address) pte_offset_kernel(pmd, address) -#define pte_unmap (pte) do { } while (0) -#define pte_unmap_nested (pte) do { } while (0) -#define pte_unmap (pte) do { } while (0) -#define pte_unmap_nested (pte) do { } while (0) +#include <asm/ptemap.h> extern void paging_init (void );
arch/parisc/include/asm/ptemap.h renamed from arch/parisc/include/asm/ptemap.h~parisc-ptemaph +12 -0
@@ -0,0 +1,12 @@ +#ifndef _PARISC_ASM_PTEMAP_H +#define _PARISC_ASM_PTEMAP_H + +#define pte_offset_map (pmd, address) pte_offset_kernel(pmd, address) +#define pte_offset_map_nested (pmd, address) pte_offset_kernel(pmd, address) +#define pte_unmap (pte) do { } while (0) +#define pte_unmap_nested (pte) do { } while (0) + +#define pte_unmap (pte) do { } while (0) +#define pte_unmap_nested (pte) do { } while (0) + +#endif /* _PARISC_ASM_PTEMAP_H */
_
Re: [RFC][PATCH 13/35] parisc: create ptemap.h
arch/parisc/include/asm/ptemap.h line 12
Quoted 12 lines · Dave Hansen
arch/parisc/include/asm/ptemap.h renamed from arch/parisc/include/asm/ptemap.h~parisc-ptemaph +12
-0+#ifndef _PARISC_ASM_PTEMAP_H +#define _PARISC_ASM_PTEMAP_H + +#define pte_offset_map (pmd, address) pte_offset_kernel(pmd, address) +#define pte_offset_map_nested (pmd, address) pte_offset_kernel(pmd, address) +#define pte_unmap (pte) do { } while (0) +#define pte_unmap_nested (pte) do { } while (0) + +#define pte_unmap (pte) do { } while (0) +#define pte_unmap_nested (pte) do { } while (0) + +#endif /* _PARISC_ASM_PTEMAP_H */
You have duplicate definitiosn of pte_unmap{,_nested}?
cheers, Kyle
Re: [RFC][PATCH 13/35] parisc: create ptemap.h
Quoted 15 lines · Kyle McMartin
arch/parisc/include/asm/ptemap.h line 12
Quoted 12 lines · Dave Hansen
arch/parisc/include/asm/ptemap.h renamed from arch/parisc/include/asm/ptemap.h~parisc-ptemaph +12
-0+#ifndef _PARISC_ASM_PTEMAP_H +#define _PARISC_ASM_PTEMAP_H + +#define pte_offset_map (pmd, address) pte_offset_kernel(pmd, address) +#define pte_offset_map_nested (pmd, address) pte_offset_kernel(pmd, address) +#define pte_unmap (pte) do { } while (0) +#define pte_unmap_nested (pte) do { } while (0) + +#define pte_unmap (pte) do { } while (0) +#define pte_unmap_nested (pte) do { } while (0) + +#endif /* _PARISC_ASM_PTEMAP_H */ You have duplicate definitiosn of pte_unmap{,_nested}?
Heh. I actually just copied this verbatim from the existing parisc header. It already had a duplicate. :)
Anyway, I've made sure not to copy the dup and added a note in the patch description so that it is much more clear. I'll show up in the next post. Thanks for the review!
-- Dave
RFC PATCH 14/35 powerpc: create ptemap.h
In reply to Dave Hansen---
linux-2.6.git-dave/arch/powerpc/include/asm/pgtable-ppc32.h | 8 ---- linux-2.6.git-dave/arch/powerpc/include/asm/pgtable-ppc64.h | 5 -- linux-2.6.git-dave/arch/powerpc/include/asm/ptemap.h | 23 ++++++++++++ 3 files changed, 24 insertions(+), 12 deletions(-)
arch/powerpc/include/asm/pgtable-ppc32.h renamed from arch/powerpc/include/asm/pgtable-ppc32.h~powerpc-ptemaph +0 -8
@@ -284,14 +284,6 @@ static inline void __ptep_set_access_fla (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))#define pte_offset_kernel (dir, addr) \ ((pte_t *) pmd_page_vaddr(*(dir)) + pte_index(addr)) -#define pte_offset_map (dir, addr) \ - ((pte_t *) kmap_atomic(pmd_page(*(dir)), KM_PTE0) + pte_index(addr)) -#define pte_offset_map_nested (dir, addr) \ - ((pte_t *) kmap_atomic(pmd_page(*(dir)), KM_PTE1) + pte_index(addr)) - -#define pte_unmap (pte) kunmap_atomic(pte, KM_PTE0) -#define pte_unmap_nested (pte) kunmap_atomic(pte, KM_PTE1) -/* * Encode and decode a swap entry. * Note that the bits we use in a PTE for representing a swap entry
arch/powerpc/include/asm/pgtable-ppc64.h renamed from arch/powerpc/include/asm/pgtable-ppc64.h~powerpc-ptemaph +1 -4
@@ -162,10 +162,7 @@#define pte_offset_kernel (dir,addr) \ (((pte_t *) pmd_page_vaddr(*(dir))) + (((addr) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))) -#define pte_offset_map (dir,addr) pte_offset_kernel((dir), (addr)) -#define pte_offset_map_nested (dir,addr) pte_offset_kernel((dir), (addr)) -#define pte_unmap (pte) do { } while(0) -#define pte_unmap_nested (pte) do { } while(0) +#include <asm/ptemap.h> /* to find an entry in a kernel page-table-directory */ /* This now only contains the vmalloc pages */
arch/powerpc/include/asm/ptemap.h new file +23 -0
@@ -0,0 +1,23 @@ +#ifndef _POWERPC_ASM_PTEMAP_H +#define _POWERPC_ASM_PTEMAP_H + +#ifndef __powerpc64__ + +#define pte_offset_map (dir, addr) \ + ((pte_t *) kmap_atomic(pmd_page(*(dir)), KM_PTE0) + pte_index(addr)) +#define pte_offset_map_nested (dir, addr) \ + ((pte_t *) kmap_atomic(pmd_page(*(dir)), KM_PTE1) + pte_index(addr)) + +#define pte_unmap (pte) kunmap_atomic(pte, KM_PTE0) +#define pte_unmap_nested (pte) kunmap_atomic(pte, KM_PTE1) + +#else /* __powerpc64__ */ + +#define pte_offset_map (dir,addr) pte_offset_kernel((dir), (addr)) +#define pte_offset_map_nested (dir,addr) pte_offset_kernel((dir), (addr)) +#define pte_unmap (pte) do { } while(0) +#define pte_unmap_nested (pte) do { } while(0) + +#endif + +#endif /* _POWERPC_ASM_PTEMAP_H */
_
RFC PATCH 15/35 s390: create ptemap.h
In reply to Dave Hansen---
linux-2.6.git-dave/arch/s390/include/asm/pgtable.h | 6 ++---- linux-2.6.git-dave/arch/s390/include/asm/ptemap.h | 9 +++++++++ 2 files changed, 11 insertions(+), 4 deletions(-)
arch/s390/include/asm/pgtable.h renamed from arch/s390/include/asm/pgtable.h~s390-ptemaph +2 -4
@@ -1040,10 +1040,8 @@ static inline pmd_t *pmd_offset(pud_t *p/* Find an entry in the lowest level page table.. */ #define pte_offset (pmd, addr) ((pte_t *) pmd_deref(*(pmd)) + pte_index(addr))#define pte_offset_kernel (pmd, address) pte_offset(pmd,address) -#define pte_offset_map (pmd, address) pte_offset_kernel(pmd, address) -#define pte_offset_map_nested (pmd, address) pte_offset_kernel(pmd, address) -#define pte_unmap (pte) do { } while (0) -#define pte_unmap_nested (pte) do { } while (0) + +#include <asm/ptemap.h> /* * 31 bit swap entry format:
arch/s390/include/asm/ptemap.h renamed from arch/s390/include/asm/ptemap.h~s390-ptemaph +9 -0
@@ -0,0 +1,9 @@ +#ifndef _S390_ASM_PTEMAP_H +#define _S390_ASM_PTEMAP_H + +#define pte_offset_map (pmd, address) pte_offset_kernel(pmd, address) +#define pte_offset_map_nested (pmd, address) pte_offset_kernel(pmd, address) +#define pte_unmap (pte) do { } while (0) +#define pte_unmap_nested (pte) do { } while (0) + +#endif /* _S390_ASM_PTEMAP_H */
_
RFC PATCH 16/35 sh: create ptemap.h
In reply to Dave Hansen---
linux-2.6.git-dave/arch/sh/include/asm/pgtable_32.h | 6 +----- linux-2.6.git-dave/arch/sh/include/asm/pgtable_64.h | 5 +---- linux-2.6.git-dave/arch/sh/include/asm/ptemap.h | 9 +++++++++ 3 files changed, 11 insertions(+), 9 deletions(-)
arch/sh/include/asm/pgtable_32.h renamed from arch/sh/include/asm/pgtable_32.h~sh-ptemaph +1 -5
@@ -403,11 +403,7 @@ static inline pte_t pte_modify(pte_t pte#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)) -#define pte_offset_map (dir, address) pte_offset_kernel(dir, address) -#define pte_offset_map_nested (dir, address) pte_offset_kernel(dir, address) - -#define pte_unmap (pte) do { } while (0) -#define pte_unmap_nested (pte) do { } while (0) +#include <asm/ptemap.h> #ifdef CONFIG_X2TLB #define pte_ERROR (e) \
arch/sh/include/asm/pgtable_64.h renamed from arch/sh/include/asm/pgtable_64.h~sh-ptemaph +1 -4
@@ -83,10 +83,7 @@ static __inline__ void pmd_set(pmd_t *pm#define pte_offset_kernel (dir, addr) \ ((pte_t *) ((pmd_val(*(dir))) & PAGE_MASK) + pte_index((addr))) -#define pte_offset_map (dir,addr) pte_offset_kernel(dir, addr) -#define pte_offset_map_nested (dir,addr) pte_offset_kernel(dir, addr) -#define pte_unmap (pte) do { } while (0) -#define pte_unmap_nested (pte) do { } while (0) +#include <asm/ptemap.h> #ifndef __ASSEMBLY__#define IOBASE_VADDR 0xff000000
arch/sh/include/asm/ptemap.h new file +9 -0
@@ -0,0 +1,9 @@ +#ifndef _SH_ASM_PTEMAP_H +#define _SH_ASM_PTEMAP_H + +#define pte_offset_map (dir, address) pte_offset_kernel(dir, address) +#define pte_offset_map_nested (dir, address) pte_offset_kernel(dir, address) +#define pte_unmap (pte) do { } while (0) +#define pte_unmap_nested (pte) do { } while (0) + +#endif /* _SH_ASM_PTEMAP_H */
_
RFC PATCH 17/35 sparc: create ptemap.h
In reply to Dave Hansen---
linux-2.6.git-dave/arch/sparc/include/asm/pgtable_32.h | 15 -------- linux-2.6.git-dave/arch/sparc/include/asm/pgtable_64.h | 5 -- linux-2.6.git-dave/arch/sparc/include/asm/ptemap.h | 29 +++++++++++++++++ 3 files changed, 31 insertions(+), 18 deletions(-)
arch/sparc/include/asm/pgtable_32.h renamed from arch/sparc/include/asm/pgtable_32.h~sparc-ptemaph +1 -14
@@ -300,20 +300,7 @@ BTFIXUPDEF_CALL(pmd_t *, pmd_offset, pgd BTFIXUPDEF_CALL(pte_t *, pte_offset_kernel, pmd_t *, unsigned long)#define pte_offset_kernel (dir,addr) BTFIXUP_CALL(pte_offset_kernel)(dir,addr) -/* -* This shortcut works on sun4m (and sun4d) because the nocache area is static, -* and sun4c is guaranteed to have no highmem anyway. -*/ -#define pte_offset_map (d, a) pte_offset_kernel(d,a) -#define pte_offset_map_nested (d, a) pte_offset_kernel(d,a) - -#define pte_unmap (pte) do{}while(0) -#define pte_unmap_nested (pte) do{}while(0) - -/* Certain architectures need to do special things when pte's -* within a page table are directly modified. Thus, the following -* hook is made available. -*/ +#include <asm/ptemap.h> BTFIXUPDEF_CALL(void, set_pte, pte_t *, pte_t)
arch/sparc/include/asm/pgtable_64.h renamed from arch/sparc/include/asm/pgtable_64.h~sparc-ptemaph +1 -4
@@ -652,10 +652,7 @@ static inline int pte_special(pte_t pte)/* Find an entry in the third-level page table.. */ #define pte_offset_kernel (dir, address) \ ((pte_t *)pmd_page_vaddr(*(dir)) + pte_index(address)) -#define pte_offset_map (dir, address) pte_offset_kernel((dir), (address)) -#define pte_offset_map_nested (dir, address) pte_offset_kernel((dir), (address)) -#define pte_unmap (pte) do { } while (0) -#define pte_unmap_nested (pte) do { } while (0) +#include <asm/ptemap.h> /* Actual page table PTE updates. */ extern void tlb_batch_add (struct mm_struct *mm,unsigned long vaddr,pte_t *ptep,pte_t orig);
arch/sparc/include/asm/ptemap.h new file +29 -0
@@ -0,0 +1,29 @@ +#ifndef _SPARC_ASM_PTEMAP_H +#define _SPARC_ASM_PTEMAP_H + +#if defined(__sparc__) && defined(__arch64__) + +/* Certain architectures need to do special things when pte's +* within a page table are directly modified. Thus, the following +* hook is made available. +*/ + +#define pte_offset_map (dir, address) pte_offset_kernel((dir), (address)) +#define pte_offset_map_nested (dir, address) pte_offset_kernel((dir), (address)) +#define pte_unmap (pte) do { } while (0) +#define pte_unmap_nested (pte) do { } while (0) + +#else + + * This shortcut works on sun4m (and sun4d) because the nocache area is static, + * and sun4c is guaranteed to have no highmem anyway. + */ +#define pte_offset_map (d, a) pte_offset_kernel(d,a) +#define pte_offset_map_nested (d, a) pte_offset_kernel(d,a) + +#define pte_unmap (pte) do{}while(0) +#define pte_unmap_nested (pte) do{}while(0) + +#endif + +#endif /* _SPARC_ASM_PTEMAP_H *//*
_
Re: [RFC][PATCH 17/35] sparc: create ptemap.h
Quoted 19 lines · Dave Hansen
Signed-off-by Dave Hansen <[email protected]>---
linux-2.6.git-dave/arch/sparc/include/asm/pgtable_32.h | 15 -------- linux-2.6.git-dave/arch/sparc/include/asm/pgtable_64.h | 5 -- linux-2.6.git-dave/arch/sparc/include/asm/ptemap.h | 29 +++++++++++++++++ 3 files changed, 31 insertions(+), 18 deletions(-)diff -puN
arch/sparc/include/asm/pgtable_32.h~sparc-ptemapharch/sparc/include/asm/pgtable_32.harch/sparc/include/asm/pgtable_32.h renamed from arch/sparc/include/asm/pgtable_32.h~sparc-ptemaph +0
-4@@ -300,20 +300,7 @@ BTFIXUPDEF_CALL(pmd_t *, pmd_offset, pgd BTFIXUPDEF_CALL(pte_t *, pte_offset_kernel, pmd_t *, unsigned long)#define pte_offset_kernel (dir,addr) BTFIXUP_CALL(pte_offset_kernel)(dir,addr) -/* -* This shortcut works on sun4m (and sun4d) because the nocache area is static, -* and sun4c is guaranteed to have no highmem anyway. -*/
arch/sparc/include/asm/pgtable_32.h BTFIXUPDEF_CALL(pmd_t *, pmd_offset, pgd · line 316
Quoted 10 lines
arch/sparc/include/asm/pgtable_32.h renamed from arch/sparc/include/asm/pgtable_32.h~sparc-ptemaph +0
-10-#define pte_offset_map (d, a) pte_offset_kernel(d,a) -#define pte_offset_map_nested (d, a) pte_offset_kernel(d,a) - -#define pte_unmap (pte) do{}while(0) -#define pte_unmap_nested (pte) do{}while(0) - -/* Certain architectures need to do special things when pte's -* within a page table are directly modified. Thus, the following -* hook is made available. -*/
This is FUBAR'ed, The comment refers to the BTFIXUPDEF_CALL below, and should not be moved to asm/ptemap.h
Quoted 33 lines
arch/sparc/include/asm/pgtable_32.h renamed from arch/sparc/include/asm/pgtable_32.h~sparc-ptemaph +1
-0+#include <asm/ptemap.h> BTFIXUPDEF_CALL(void, set_pte, pte_t *, pte_t)diff -puN
arch/sparc/include/asm/pgtable_64.h~sparc-ptemapharch/sparc/include/asm/pgtable_64.harch/sparc/include/asm/pgtable_64.h renamed from arch/sparc/include/asm/pgtable_64.h~sparc-ptemaph +1
-4@@ -652,10 +652,7 @@ static inline int pte_special(pte_t pte)/* Find an entry in the third-level page table.. */ #define pte_offset_kernel (dir, address) \ ((pte_t *)pmd_page_vaddr(*(dir)) + pte_index(address)) -#define pte_offset_map (dir, address) pte_offset_kernel((dir), (address)) -#define pte_offset_map_nested (dir, address) pte_offset_kernel((dir), (address)) -#define pte_unmap (pte) do { } while (0) -#define pte_unmap_nested (pte) do { } while (0) +#include <asm/ptemap.h> /* Actual page table PTE updates. */ extern void tlb_batch_add (struct mm_struct *mm,unsigned long vaddr,pte_t *ptep,pte_t orig);diff -puN
/dev/nullarch/sparc/include/asm/ptemap.harch/sparc/include/asm/ptemap.h new file +10
-0@@ -0,0 +1,29 @@ +#ifndef _SPARC_ASM_PTEMAP_H +#define _SPARC_ASM_PTEMAP_H + +#if defined(__sparc__) && defined(__arch64__) + +/* Certain architectures need to do special things when pte's +* within a page table are directly modified. Thus, the following +* hook is made available. +*/ +
arch/sparc/include/asm/ptemap.h line 20
Quoted 10 lines
arch/sparc/include/asm/ptemap.h new file +10
-0+#define pte_offset_map(dir, address) pte_offset_kernel((dir), (address)) +#define pte_offset_map_nested(dir, address) pte_offset_kernel((dir), (address)) +#define pte_unmap(pte) do { } while (0) +#define pte_unmap_nested(pte) do { } while (0) + +#else + +* This shortcut works on sun4m (and sun4d) because the nocache area is static, +* and sun4c is guaranteed to have no highmem anyway. +*/
Broken comment.
arch/sparc/include/asm/ptemap.h line 29
Quoted 9 lines
arch/sparc/include/asm/ptemap.h new file +9
-0+#define pte_offset_map (d, a) pte_offset_kernel(d,a) +#define pte_offset_map_nested (d, a) pte_offset_kernel(d,a) + +#define pte_unmap (pte) do{}while(0) +#define pte_unmap_nested (pte) do{}while(0) + +#endif + +#endif /* _SPARC_ASM_PTEMAP_H *//*
Broken comment.
I realize this is going away in the end, but all the interim steps should compile, to aid bisection.
Daniel K.
Re: [RFC][PATCH 17/35] sparc: create ptemap.h
Quoted 8 lines · Daniel K.
Quoted 4 lines · Dave Hansen
-/* Certain architectures need to do special things when pte's
- * within a page table are directly modified. Thus, the following
- * hook is made available.
- */This is FUBAR'ed, The comment refers to the
BTFIXUPDEF_CALLbelow, and should not be moved toasm/ptemap.h
Thanks for looking through this. I've fixed this up in my most recent version.
Quoted 18 lines
Quoted 3 lines
+ * This shortcut works on sun4m (and sun4d) because the nocache area is static,
+ * and sun4c is guaranteed to have no highmem anyway.
+ */Broken comment.
arch/sparc/include/asm/ptemap.h line 29
Quoted 9 lines
arch/sparc/include/asm/ptemap.h new file +9
-0+#define pte_offset_map (d, a) pte_offset_kernel(d,a) +#define pte_offset_map_nested (d, a) pte_offset_kernel(d,a) + +#define pte_unmap (pte) do{}while(0) +#define pte_unmap_nested (pte) do{}while(0) + +#endif + +#endif /* _SPARC_ASM_PTEMAP_H *//* Broken comment.
Quoted 2 lines
I realize this is going away in the end, but all the interim steps should compile, to aid bisection.
Yup, absolutely. This is fixed up now, too.
-- Dave
RFC PATCH 18/35 um: create ptemap.h
In reply to Dave Hansen---
linux-2.6.git-dave/arch/um/include/asm/pgtable.h | 7 +------ linux-2.6.git-dave/arch/um/include/asm/ptemap.h | 10 ++++++++++ 2 files changed, 11 insertions(+), 6 deletions(-)
arch/um/include/asm/pgtable.h renamed from arch/um/include/asm/pgtable.h~um-ptemaph +1 -6
@@ -331,12 +331,7 @@ static inline pte_t pte_modify(pte_t pte#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)) -#define pte_offset_map (dir, address) \ - ((pte_t *)page_address(pmd_page(*(dir))) + pte_index(address)) -#define pte_offset_map_nested (dir, address) pte_offset_map(dir, address) -#define pte_unmap (pte) do { } while (0) -#define pte_unmap_nested (pte) do { } while (0) - +#include <asm/ptemap.h> struct mm_struct ;extern pte_t *virt_to_pte (struct mm_struct *mm,unsigned long addr);
arch/um/include/asm/ptemap.h renamed from arch/um/include/asm/ptemap.h~um-ptemaph +10 -0
@@ -0,0 +1,10 @@ +#ifndef _UM_ASM_PTEMAP_H +#define _UM_ASM_PTEMAP_H + +#define pte_offset_map (dir, address) \ + ((pte_t *)page_address(pmd_page(*(dir))) + pte_index(address)) +#define pte_offset_map_nested (dir, address) pte_offset_map(dir, address) +#define pte_unmap (pte) do { } while (0) +#define pte_unmap_nested (pte) do { } while (0) + +#endif /* _UM_ASM_PTEMAP_H */
_
RFC PATCH 19/35 x86: create ptemap.h
In reply to Dave Hansen---
linux-2.6.git-dave/arch/x86/include/asm/pgtable_32.h | 17 --------- linux-2.6.git-dave/arch/x86/include/asm/pgtable_64.h | 6 --- linux-2.6.git-dave/arch/x86/include/asm/ptemap.h | 34 +++++++++++++++++++ 3 files changed, 36 insertions(+), 21 deletions(-)
arch/x86/include/asm/pgtable_32.h renamed from arch/x86/include/asm/pgtable_32.h~x86-ptemaph +1 -16
@@ -48,22 +48,7 @@ extern void set_pmd_pfn(unsigned long, u# include <asm/pgtable-2level.h> #endif -#if defined(CONFIG_HIGHPTE ) -#define pte_offset_map (dir, address) \ - ((pte_t *)kmap_atomic_pte(pmd_page(*(dir)), KM_PTE0) + \ - pte_index((address))) -#define pte_offset_map_nested (dir, address) \ - ((pte_t *)kmap_atomic_pte(pmd_page(*(dir)), KM_PTE1) + \ - pte_index((address))) -#define pte_unmap (pte) kunmap_atomic((pte), KM_PTE0) -#define pte_unmap_nested (pte) kunmap_atomic((pte), KM_PTE1) -#else -#define pte_offset_map (dir, address) \ - ((pte_t *)page_address(pmd_page(*(dir))) + pte_index((address))) -#define pte_offset_map_nested (dir, address) pte_offset_map((dir), (address)) -#define pte_unmap (pte) do { } while (0) -#define pte_unmap_nested (pte) do { } while (0) -#endif +#include <asm/ptemap.h> /* Clear a kernel PTE and flush it from the TLB */ #define kpte_clear_flush (ptep, vaddr) \
arch/x86/include/asm/pgtable_64.h renamed from arch/x86/include/asm/pgtable_64.h~x86-ptemaph +1 -5
@@ -127,11 +127,7 @@ static inline int pgd_large(pgd_t pgd) {/* PTE - Level 1 access. */ -/* 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)) -#define pte_unmap (pte)/* NOP */ -#define pte_unmap_nested (pte)/* NOP */ +#include <asm/ptemap.h> #define update_mmu_cache (vma, address, pte) do { } while (0)
arch/x86/include/asm/ptemap.h new file +34 -0
@@ -0,0 +1,34 @@ +#ifndef _X86_ASM_PTEMAP_H +#define _X86_ASM_PTEMAP_H + +#ifdef CONFIG_X86_32 + +#if defined(CONFIG_HIGHPTE ) + +#define pte_offset_map (dir, address) \ + ((pte_t *)kmap_atomic_pte(pmd_page(*(dir)), KM_PTE0) + \ + pte_index((address))) +#define pte_offset_map_nested (dir, address) \ + ((pte_t *)kmap_atomic_pte(pmd_page(*(dir)), KM_PTE1) + \ + pte_index((address))) +#define pte_unmap (pte) kunmap_atomic((pte), KM_PTE0) +#define pte_unmap_nested (pte) kunmap_atomic((pte), KM_PTE1) +#else +#define pte_offset_map (dir, address) \ + ((pte_t *)page_address(pmd_page(*(dir))) + pte_index((address))) +#define pte_offset_map_nested (dir, address) pte_offset_map((dir), (address)) +#define pte_unmap (pte) do { } while (0) +#define pte_unmap_nested (pte) do { } while (0) +#endif + +#else /* x86-64 */ + +/* 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)) +#define pte_unmap (pte)/* NOP */ +#define pte_unmap_nested (pte)/* NOP */ + +#endif + +#endif /* _X86_ASM_PTEMAP_H */
_
RFC PATCH 20/35 xtensa: create ptemap.h
In reply to Dave Hansen---
linux-2.6.git-dave/arch/xtensa/include/asm/pgtable.h | 6 ------ linux-2.6.git-dave/arch/xtensa/include/asm/ptemap.h | 10 ++++++++++ 2 files changed, 10 insertions(+), 6 deletions(-)
arch/xtensa/include/asm/pgtable.h renamed from arch/xtensa/include/asm/pgtable.h~xtensa-ptemaph +0 -6
@@ -323,12 +323,6 @@ ptep_set_wrprotect(struct mm_struct *mm,#define pte_index (address) (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))#define pte_offset_kernel (dir,addr) \ ((pte_t*) pmd_page_vaddr(*(dir)) + pte_index(addr)) -#define pte_offset_map (dir,addr) pte_offset_kernel((dir),(addr)) -#define pte_offset_map_nested (dir,addr) pte_offset_kernel((dir),(addr)) - -#define pte_unmap (pte) do { } while (0) -#define pte_unmap_nested (pte) do { } while (0) -/* * Encode and decode a swap entry.
arch/xtensa/include/asm/ptemap.h new file +10 -0
@@ -0,0 +1,10 @@ +#ifndef _XTENSA_ASM_PTEMAP_H +#define _XTENSA_ASM_PTEMAP_H + +#define pte_offset_map (dir,addr) pte_offset_kernel((dir),(addr)) +#define pte_offset_map_nested (dir,addr) pte_offset_kernel((dir),(addr)) + +#define pte_unmap (pte) do { } while (0) +#define pte_unmap_nested (pte) do { } while (0) + +#endif /* _XTENSA_ASM_PTEMAP_H */
_
RFC PATCH 21/35 create linux/ptemap.h for arch-independent pte mapping funcs
In reply to Dave Hansenlinux/mm.h has a couple of completely arch-independent pte mapping functions. Let's move them to their own header to help separate out their dependencies from the rest of mm.h.
I'll get the callsites in the next patch. For now, just include the new header where its functions used to be. I'll remove this in the next patch.
---
linux-2.6.git-dave/include/linux/mm.h | 26 ---------------------- linux-2.6.git-dave/include/linux/ptemap.h | 34 ++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 26 deletions(-)
include/linux/mm.h renamed from include/linux/mm.h~linux-ptemap-h +0 -26
@@ -969,32 +969,6 @@ static inline void pgtable_page_dtor(strdec_zone_page_state (page,NR_PAGETABLE ); } -#define pte_offset_map_lock (mm, pmd, address, ptlp) \ -({ \ - spinlock_t *__ptl = pte_lockptr(mm, pmd); \ - pte_t *__pte = pte_offset_map(pmd, address); \ - *(ptlp) = __ptl; \ - spin_lock(__ptl); \ - __pte; \ -}) - -#define pte_unmap_unlock (pte, ptl) do { \ - spin_unlock(ptl); \ - pte_unmap(pte); \ -} while (0) - -#define pte_alloc_map (mm, pmd, address) \ - ((unlikely(!pmd_present(*(pmd))) && __pte_alloc(mm, pmd, address))? \ - NULL: pte_offset_map(pmd, address)) - -#define pte_alloc_map_lock (mm, pmd, address, ptlp) \ - ((unlikely(!pmd_present(*(pmd))) && __pte_alloc(mm, pmd, address))? \ - NULL: pte_offset_map_lock(mm, pmd, address, ptlp)) - -#define pte_alloc_kernel (pmd, address) \ - ((unlikely(!pmd_present(*(pmd))) && __pte_alloc_kernel(pmd, address))? \ - NULL: pte_offset_kernel(pmd, address)) -extern void free_area_init (unsigned long * zones_size);extern void free_area_init_node (int nid,unsigned long * zones_size,unsigned long zone_start_pfn,unsigned long *zholes_size);
include/linux/ptemap.h renamed from include/linux/ptemap.h~linux-ptemap-h +34 -0
@@ -0,0 +1,34 @@ +#ifndef _LINUX_PTE_MAP_H +#define _LINUX_PTE_MAP_H + +#include <linux/mm.h> +#include <asm/ptemap.h> + +#define pte_offset_map_lock (mm, pmd, address, ptlp) \ +({ \ + spinlock_t *__ptl = pte_lockptr(mm, pmd); \ + pte_t *__pte = pte_offset_map(pmd, address); \ + *(ptlp) = __ptl; \ + spin_lock(__ptl); \ + __pte; \ +}) + +#define pte_unmap_unlock (pte, ptl) do { \ + spin_unlock(ptl); \ + pte_unmap(pte); \ +} while (0) + +#define pte_alloc_map (mm, pmd, address) \ + ((unlikely(!pmd_present(*(pmd))) && __pte_alloc(mm, pmd, address))? \ + NULL: pte_offset_map(pmd, address)) + +#define pte_alloc_map_lock (mm, pmd, address, ptlp) \ + ((unlikely(!pmd_present(*(pmd))) && __pte_alloc(mm, pmd, address))? \ + NULL: pte_offset_map_lock(mm, pmd, address, ptlp)) + +#define pte_alloc_kernel (pmd, address) \ + ((unlikely(!pmd_present(*(pmd))) && __pte_alloc_kernel(pmd, address))? \ + NULL: pte_offset_kernel(pmd, address)) + + +#endif /* _LINUX_PTE_MAP_H */
_
RFC PATCH 22/35 include linux/ptemap.h at all use sites
In reply to Dave HansenDESC
ptemaph-compile-fix-2
EDESC
---
linux-2.6.git-dave/arch/arm/kernel/traps.c | 1 + linux-2.6.git-dave/arch/arm/mm/fault-armv.c | 1 + linux-2.6.git-dave/arch/arm/mm/fault.c | 1 + linux-2.6.git-dave/arch/arm/mm/pgd.c | 1 + linux-2.6.git-dave/arch/ia64/mm/hugetlbpage.c | 1 + linux-2.6.git-dave/arch/m68k/mm/kmap.c | 1 + linux-2.6.git-dave/arch/mips/mm/tlb-r4k.c | 1 + linux-2.6.git-dave/arch/mips/mm/tlb-r8k.c | 1 + linux-2.6.git-dave/arch/mn10300/mm/cache.c | 1 + linux-2.6.git-dave/arch/parisc/kernel/cache.c | 1 + linux-2.6.git-dave/arch/parisc/kernel/pci-dma.c | 2 ++ linux-2.6.git-dave/arch/powerpc/mm/pgtable_32.c | 1 + linux-2.6.git-dave/arch/powerpc/mm/pgtable_64.c | 1 + linux-2.6.git-dave/arch/powerpc/mm/subpage-prot.c | 1 + linux-2.6.git-dave/arch/s390/lib/uaccess_pt.c | 1 + linux-2.6.git-dave/arch/sh/mm/cache-sh5.c | 1 + linux-2.6.git-dave/arch/sh/mm/hugetlbpage.c | 1 + linux-2.6.git-dave/arch/sparc/kernel/signal32.c | 1 + linux-2.6.git-dave/arch/sparc/mm/fault_64.c | 1 + linux-2.6.git-dave/arch/sparc/mm/generic_64.c | 1 + linux-2.6.git-dave/arch/sparc/mm/hugetlbpage.c | 1 + linux-2.6.git-dave/arch/sparc/mm/io-unit.c | 1 + linux-2.6.git-dave/arch/sparc/mm/iommu.c | 1 + linux-2.6.git-dave/arch/um/kernel/tlb.c | 1 + linux-2.6.git-dave/arch/x86/kernel/vm86_32.c | 1 + linux-2.6.git-dave/arch/x86/mm/gup.c | 1 + linux-2.6.git-dave/fs/proc/task_mmu.c | 1 + linux-2.6.git-dave/lib/ioremap.c | 1 + linux-2.6.git-dave/mm/fremap.c | 1 + linux-2.6.git-dave/mm/memory.c | 1 + linux-2.6.git-dave/mm/mempolicy.c | 1 + linux-2.6.git-dave/mm/migrate.c | 1 + linux-2.6.git-dave/mm/mincore.c | 1 + linux-2.6.git-dave/mm/mprotect.c | 1 + linux-2.6.git-dave/mm/mremap.c | 1 + linux-2.6.git-dave/mm/pagewalk.c | 1 + linux-2.6.git-dave/mm/rmap.c | 1 + linux-2.6.git-dave/mm/swapfile.c | 1 + linux-2.6.git-dave/mm/vmalloc.c | 1 + 39 files changed, 40 insertions(+)
arch/arm/kernel/traps.c renamed from arch/arm/kernel/traps.c~include-linux-ptemaph-at-all-call-sites +1 -0
@@ -21,6 +21,7 @@#include <linux/hardirq.h> #include <linux/init.h> #include <linux/uaccess.h> +#include <linux/ptemap.h> #include <asm/atomic.h> #include <asm/cacheflush.h>
arch/arm/mm/fault-armv.c renamed from arch/arm/mm/fault-armv.c~include-linux-ptemaph-at-all-call-sites +1 -0
@@ -16,6 +16,7 @@#include <linux/vmalloc.h> #include <linux/init.h> #include <linux/pagemap.h> +#include <linux/ptemap.h> #include <asm/bugs.h> #include <asm/cacheflush.h>
arch/arm/mm/fault.c renamed from arch/arm/mm/fault.c~include-linux-ptemaph-at-all-call-sites +1 -0
@@ -16,6 +16,7 @@#include <linux/kprobes.h> #include <linux/uaccess.h> #include <linux/page-flags.h> +#include <linux/ptemap.h> #include <asm/system.h> #include <asm/pgtable.h>
arch/arm/mm/pgd.c renamed from arch/arm/mm/pgd.c~include-linux-ptemaph-at-all-call-sites +1 -0
@@ -9,6 +9,7 @@*/ #include <linux/mm.h> #include <linux/highmem.h> +#include <linux/ptemap.h> #include <asm/pgalloc.h> #include <asm/page.h>
arch/ia64/mm/hugetlbpage.c renamed from arch/ia64/mm/hugetlbpage.c~include-linux-ptemaph-at-all-call-sites +1 -0
@@ -17,6 +17,7 @@#include <linux/slab.h> #include <linux/sysctl.h> #include <linux/log2.h> +#include <linux/ptemap.h> #include <asm/mman.h> #include <asm/pgalloc.h> #include <asm/tlb.h>
arch/m68k/mm/kmap.c renamed from arch/m68k/mm/kmap.c~include-linux-ptemaph-at-all-call-sites +1 -0
@@ -14,6 +14,7 @@#include <linux/types.h> #include <linux/slab.h> #include <linux/vmalloc.h> +#include <linux/ptemap.h> #include <asm/setup.h> #include <asm/segment.h>
arch/mips/mm/tlb-r4k.c renamed from arch/mips/mm/tlb-r4k.c~include-linux-ptemaph-at-all-call-sites +1 -0
@@ -11,6 +11,7 @@#include <linux/init.h> #include <linux/sched.h> #include <linux/mm.h> +#include <linux/ptemap.h> #include <asm/cpu.h> #include <asm/bootinfo.h>
arch/mips/mm/tlb-r8k.c renamed from arch/mips/mm/tlb-r8k.c~include-linux-ptemaph-at-all-call-sites +1 -0
@@ -11,6 +11,7 @@#include <linux/init.h> #include <linux/sched.h> #include <linux/mm.h> +#include <linux/ptemap.h> #include <asm/cpu.h> #include <asm/bootinfo.h>
arch/mn10300/mm/cache.c renamed from arch/mn10300/mm/cache.c~include-linux-ptemaph-at-all-call-sites +1 -0
@@ -12,6 +12,7 @@#include <linux/mm.h> #include <linux/mman.h> #include <linux/threads.h> +#include <linux/ptemap.h> #include <asm/page.h> #include <asm/pgtable.h> #include <asm/processor.h>
arch/parisc/kernel/cache.c renamed from arch/parisc/kernel/cache.c~include-linux-ptemaph-at-all-call-sites +1 -0
@@ -19,6 +19,7 @@#include <linux/seq_file.h> #include <linux/pagemap.h> #include <linux/sched.h> +#include <linux/ptemap.h> #include <asm/pdc.h> #include <asm/cache.h> #include <asm/cacheflush.h>
arch/parisc/kernel/pci-dma.c renamed from arch/parisc/kernel/pci-dma.c~include-linux-ptemaph-at-all-call-sites +2 -0
@@ -21,11 +21,13 @@#include <linux/mm.h> #include <linux/pci.h> #include <linux/proc_fs.h> +#include <linux/ptemap.h> #include <linux/seq_file.h> #include <linux/slab.h> #include <linux/string.h> #include <linux/types.h> #include <linux/scatterlist.h> +#include <linux/ptemap.h> #include <asm/cacheflush.h> #include <asm/dma.h> /* for DMA_CHUNK_SIZE */
arch/powerpc/mm/pgtable_32.c renamed from arch/powerpc/mm/pgtable_32.c~include-linux-ptemaph-at-all-call-sites +1 -0
@@ -26,6 +26,7 @@#include <linux/vmalloc.h> #include <linux/init.h> #include <linux/highmem.h> +#include <linux/ptemap.h> #include <asm/pgtable.h> #include <asm/pgalloc.h>
arch/powerpc/mm/pgtable_64.c renamed from arch/powerpc/mm/pgtable_64.c~include-linux-ptemaph-at-all-call-sites +1 -0
@@ -33,6 +33,7 @@#include <linux/stddef.h> #include <linux/vmalloc.h> #include <linux/init.h> +#include <linux/ptemap.h> #include <asm/pgalloc.h> #include <asm/page.h>
arch/powerpc/mm/subpage-prot.c renamed from arch/powerpc/mm/subpage-prot.c~include-linux-ptemaph-at-all-call-sites +1 -0
@@ -14,6 +14,7 @@#include <linux/types.h> #include <linux/mm.h> #include <linux/hugetlb.h> +#include <linux/ptemap.h> #include <asm/pgtable.h> #include <asm/uaccess.h>
arch/s390/lib/uaccess_pt.c renamed from arch/s390/lib/uaccess_pt.c~include-linux-ptemaph-at-all-call-sites +1 -0
@@ -11,6 +11,7 @@#include <linux/errno.h> #include <linux/hardirq.h> #include <linux/mm.h> +#include <linux/ptemap.h> #include <asm/uaccess.h> #include <asm/futex.h> #include "uaccess.h"
arch/sh/mm/cache-sh5.c renamed from arch/sh/mm/cache-sh5.c~include-linux-ptemaph-at-all-call-sites +1 -0
@@ -13,6 +13,7 @@#include <linux/init.h> #include <linux/mman.h> #include <linux/mm.h> +#include <linux/ptemap.h> #include <asm/tlb.h> #include <asm/processor.h> #include <asm/cache.h>
arch/sh/mm/hugetlbpage.c renamed from arch/sh/mm/hugetlbpage.c~include-linux-ptemaph-at-all-call-sites +1 -0
@@ -15,6 +15,7 @@#include <linux/pagemap.h> #include <linux/slab.h> #include <linux/sysctl.h> +#include <linux/ptemap.h> #include <asm/mman.h> #include <asm/pgalloc.h>
arch/sparc/kernel/signal32.c renamed from arch/sparc/kernel/signal32.c~include-linux-ptemaph-at-all-call-sites +1 -0
@@ -20,6 +20,7 @@#include <linux/compat.h> #include <linux/bitops.h> #include <linux/tracehook.h> +#include <linux/ptemap.h> #include <asm/uaccess.h> #include <asm/ptrace.h>
arch/sparc/mm/fault_64.c renamed from arch/sparc/mm/fault_64.c~include-linux-ptemaph-at-all-call-sites +1 -0
@@ -20,6 +20,7 @@#include <linux/kprobes.h> #include <linux/kdebug.h> #include <linux/percpu.h> +#include <linux/ptemap.h> #include <asm/page.h> #include <asm/pgtable.h>
arch/sparc/mm/generic_64.c renamed from arch/sparc/mm/generic_64.c~include-linux-ptemaph-at-all-call-sites +1 -0
@@ -9,6 +9,7 @@#include <linux/mm.h> #include <linux/swap.h> #include <linux/pagemap.h> +#include <linux/ptemap.h> #include <asm/pgalloc.h> #include <asm/pgtable.h>
arch/sparc/mm/hugetlbpage.c renamed from arch/sparc/mm/hugetlbpage.c~include-linux-ptemaph-at-all-call-sites +1 -0
@@ -12,6 +12,7 @@#include <linux/pagemap.h> #include <linux/slab.h> #include <linux/sysctl.h> +#include <linux/ptemap.h> #include <asm/mman.h> #include <asm/pgalloc.h>
arch/sparc/mm/iommu.c renamed from arch/sparc/mm/iommu.c~include-linux-ptemaph-at-all-call-sites +1 -0
@@ -15,6 +15,7 @@#include <linux/scatterlist.h> #include <linux/of.h> #include <linux/of_device.h> +#include <linux/ptemap.h> #include <asm/pgalloc.h> #include <asm/pgtable.h>
arch/sparc/mm/io-unit.c renamed from arch/sparc/mm/io-unit.c~include-linux-ptemaph-at-all-call-sites +1 -0
@@ -14,6 +14,7 @@#include <linux/scatterlist.h> #include <linux/of.h> #include <linux/of_device.h> +#include <linux/ptemap.h> #include <asm/pgalloc.h> #include <asm/pgtable.h>
arch/um/kernel/tlb.c renamed from arch/um/kernel/tlb.c~include-linux-ptemaph-at-all-call-sites +1 -0
@@ -5,6 +5,7 @@#include <linux/mm.h> #include <linux/sched.h> +#include <linux/ptemap.h> #include <asm/pgtable.h> #include <asm/tlbflush.h> #include "as-layout.h"
arch/x86/kernel/vm86_32.c renamed from arch/x86/kernel/vm86_32.c~include-linux-ptemaph-at-all-call-sites +1 -0
@@ -41,6 +41,7 @@#include <linux/ptrace.h> #include <linux/audit.h> #include <linux/stddef.h> +#include <linux/ptemap.h> #include <asm/uaccess.h> #include <asm/io.h>
arch/x86/mm/gup.c renamed from arch/x86/mm/gup.c~include-linux-ptemaph-at-all-call-sites +1 -0
@@ -10,6 +10,7 @@#include <linux/highmem.h> #include <asm/pgtable.h> +#include <asm/ptemap.h> static inline pte_t gup_get_pte (pte_t *ptep) {
fs/proc/task_mmu.c renamed from fs/proc/task_mmu.c~include-linux-ptemaph-at-all-call-sites +1 -0
@@ -8,6 +8,7 @@#include <linux/mempolicy.h> #include <linux/swap.h> #include <linux/swapops.h> +#include <linux/ptemap.h> #include <asm/elf.h> #include <asm/uaccess.h>
lib/ioremap.c renamed from lib/ioremap.c~include-linux-ptemaph-at-all-call-sites +1 -0
@@ -9,6 +9,7 @@#include <linux/mm.h> #include <linux/sched.h> #include <linux/io.h> +#include <linux/ptemap.h> #include <asm/cacheflush.h> #include <asm/pgtable.h>
mm/fremap.c renamed from mm/fremap.c~include-linux-ptemaph-at-all-call-sites +1 -0
@@ -16,6 +16,7 @@#include <linux/module.h> #include <linux/syscalls.h> #include <linux/mmu_notifier.h> +#include <linux/ptemap.h> #include <asm/mmu_context.h> #include <asm/cacheflush.h>
mm/memory.c renamed from mm/memory.c~include-linux-ptemaph-at-all-call-sites +1 -0
@@ -55,6 +55,7 @@#include <linux/kallsyms.h> #include <linux/swapops.h> #include <linux/elf.h> +#include <linux/ptemap.h> #include <asm/pgalloc.h> #include <asm/uaccess.h>
mm/mempolicy.c renamed from mm/mempolicy.c~include-linux-ptemaph-at-all-call-sites +1 -0
@@ -89,6 +89,7 @@#include <linux/security.h> #include <linux/syscalls.h> #include <linux/ctype.h> +#include <linux/ptemap.h> #include <asm/tlbflush.h> #include <asm/uaccess.h>
mm/migrate.c renamed from mm/migrate.c~include-linux-ptemaph-at-all-call-sites +1 -0
@@ -31,6 +31,7 @@#include <linux/security.h> #include <linux/memcontrol.h> #include <linux/syscalls.h> +#include <linux/ptemap.h> #include "internal.h"
mm/mincore.c renamed from mm/mincore.c~include-linux-ptemaph-at-all-call-sites +1 -0
@@ -14,6 +14,7 @@#include <linux/syscalls.h> #include <linux/swap.h> #include <linux/swapops.h> +#include <linux/ptemap.h> #include <asm/uaccess.h> #include <asm/pgtable.h>
mm/mprotect.c renamed from mm/mprotect.c~include-linux-ptemaph-at-all-call-sites +1 -0
@@ -23,6 +23,7 @@#include <linux/swapops.h> #include <linux/mmu_notifier.h> #include <linux/migrate.h> +#include <linux/ptemap.h> #include <asm/uaccess.h> #include <asm/pgtable.h> #include <asm/cacheflush.h>
mm/mremap.c renamed from mm/mremap.c~include-linux-ptemaph-at-all-call-sites +1 -0
@@ -19,6 +19,7 @@#include <linux/security.h> #include <linux/syscalls.h> #include <linux/mmu_notifier.h> +#include <linux/ptemap.h> #include <asm/uaccess.h> #include <asm/cacheflush.h>
mm/pagewalk.c renamed from mm/pagewalk.c~include-linux-ptemaph-at-all-call-sites +1 -0
@@ -1,6 +1,7 @@#include <linux/mm.h> #include <linux/highmem.h> #include <linux/sched.h> +#include <linux/ptemap.h> static int walk_pte_range (pmd_t *pmd,unsigned long addr,unsigned long end,struct mm_walk *walk)
mm/rmap.c renamed from mm/rmap.c~include-linux-ptemaph-at-all-call-sites +1 -0
@@ -50,6 +50,7 @@#include <linux/memcontrol.h> #include <linux/mmu_notifier.h> #include <linux/migrate.h> +#include <linux/ptemap.h> #include <asm/tlbflush.h>
mm/swapfile.c renamed from mm/swapfile.c~include-linux-ptemaph-at-all-call-sites +1 -0
@@ -29,6 +29,7 @@#include <linux/capability.h> #include <linux/syscalls.h> #include <linux/memcontrol.h> +#include <linux/ptemap.h> #include <asm/pgtable.h> #include <asm/tlbflush.h>
mm/vmalloc.c renamed from mm/vmalloc.c~include-linux-ptemaph-at-all-call-sites +1 -0
@@ -25,6 +25,7 @@#include <linux/rcupdate.h> #include <linux/bootmem.h> #include <linux/pfn.h> +#include <linux/ptemap.h> #include <asm/atomic.h> #include <asm/uaccess.h>
_
RFC PATCH 23/35 factor x86 pte mapping code
In reply to Dave Hansenx86 contains three separate pte_offset_map() implementations:
1. 32-bit highpte
2. 32-bit direct mapped
3. 64-bit direct mapped
This patch consolidates the 32-bit direct map and 64-bit implementations. You can look back at the 00 patch in this series to see a bit of proof about why
#define pte_offset_map(dir, address) \ ((pte_t *)page_address(pmd_page(*(dir))) + pte_index((address)))
and
#define pte_offset_map(dir, address) pte_offset_kernel((dir), (address))
are actually interchangable.
---
linux-2.6.git-dave/arch/x86/include/asm/ptemap.h | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-)
arch/x86/include/asm/ptemap.h renamed from arch/x86/include/asm/ptemap.h~factor-x86 +3 -14
@@ -1,10 +1,7 @@#ifndef _X86_ASM_PTEMAP_H#define _X86_ASM_PTEMAP_H -#ifdef CONFIG_X86_32 -#if defined(CONFIG_HIGHPTE ) -#define pte_offset_map (dir, address) \ ((pte_t *)kmap_atomic_pte(pmd_page(*(dir)), KM_PTE0) + \ pte_index((address)))
@@ -13,21 +10,13 @@ pte_index((address)))#define pte_unmap (pte) kunmap_atomic((pte), KM_PTE0)#define pte_unmap_nested (pte) kunmap_atomic((pte), KM_PTE1) -#else -#define pte_offset_map (dir, address) \ - ((pte_t *)page_address(pmd_page(*(dir))) + pte_index((address))) -#define pte_offset_map_nested (dir, address) pte_offset_map((dir), (address)) -#define pte_unmap (pte) do { } while (0) -#define pte_unmap_nested (pte) do { } while (0) -#endif -#else /* x86-64 */ +#else /* !CONFIG_HIGHPTE */ -/* 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)) -#define pte_unmap (pte)/* NOP */ -#define pte_unmap_nested (pte)/* NOP */ +#define pte_unmap (pte) do { } while (0) +#define pte_unmap_nested (pte) do { } while (0)#endif
_
RFC PATCH 24/35 arm: use pte_offset_kernel() as base for pte_offset_map*()
In reply to Dave HansenSome architectures use pte_offset_map() as a basis for pte_offset_kernel(). Others do the inverse.
Although arbitrary, Using pte_offset_kernel() as the base seems a wee bit more popular and it also fits in well with the way I'm breaking out the headers.
Instead of coding the same implementation twice, this makes pte_offset_map{,_nested}() call pte_offset_kernel() directly.
---
linux-2.6.git-dave/arch/arm/include/asm/ptemap.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/include/asm/ptemap.h renamed from arch/arm/include/asm/ptemap.h~arm-pte_offset_kernel +2 -2
@@ -1,8 +1,8 @@#ifndef _ARM_ASM_PTEMAP_H#define _ARM_ASM_PTEMAP_H -#define pte_offset_map (dir,addr) (pmd_page_vaddr(*(dir)) + pte_index(addr)) -#define pte_offset_map_nested (dir,addr) (pmd_page_vaddr(*(dir)) + pte_index(addr)) +#define pte_offset_map (dir,addr) pte_offset_kernel(dir,addr) +#define pte_offset_map_nested (dir,addr) pte_offset_kernel(dir,addr)#define pte_unmap (pte) do { } while (0)#define pte_unmap_nested (pte) do { } while (0)
_
RFC PATCH 25/35 cris: use pte_offset_kernel() as base for pte_offset_map*()
In reply to Dave HansenSome architectures use pte_offset_map() as a basis for pte_offset_kernel(). Others do the inverse.
Although arbitrary, Using pte_offset_kernel() as the base seems a wee bit more popular and it also fits in well with the way I'm breaking out the headers.
Instead of coding the same implementation twice, this makes pte_offset_map{,_nested}() call pte_offset_kernel() directly.
---
linux-2.6.git-dave/arch/cris/include/asm/ptemap.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
arch/cris/include/asm/ptemap.h renamed from arch/cris/include/asm/ptemap.h~cris-pte_offset_kernel +2 -4
@@ -1,10 +1,8 @@#ifndef _CRIS_ASM_PTEMAP_H#define _CRIS_ASM_PTEMAP_H -#define pte_offset_map (dir, address) \ - ((pte_t *)page_address(pmd_page(*(dir))) + __pte_offset(address)) -#define pte_offset_map_nested (dir, address) pte_offset_map(dir, address) - +#define pte_offset_map (dir, address) pte_offset_kernel(dir, address) +#define pte_offset_map_nested (dir, address) pte_offset_kernel(dir, address)#define pte_unmap (pte) do { } while (0)#define pte_unmap_nested (pte) do { } while (0)
_
RFC PATCH 26/35 frv: use pte_offset_kernel() as base for pte_offset_map*()
In reply to Dave HansenSome architectures use pte_offset_map() as a basis for pte_offset_kernel(). Others do the inverse.
Although arbitrary, Using pte_offset_kernel() as the base seems a wee bit more popular and it also fits in well with the way I'm breaking out the headers.
Instead of coding the same implementation twice, this makes pte_offset_map{,_nested}() call pte_offset_kernel() directly.
---
linux-2.6.git-dave/arch/frv/include/asm/highmem.h | 5 +++++ linux-2.6.git-dave/arch/frv/include/asm/ptemap.h | 5 ++--- 2 files changed, 7 insertions(+), 3 deletions(-)
arch/frv/include/asm/highmem.h renamed from arch/frv/include/asm/highmem.h~frv-pte_offset_kernel +5 -0
@@ -42,6 +42,11 @@ extern unsigned long highstart_pfn, high#define kmap_prot PAGE_KERNEL#define kmap_pte ______kmap_pte_in_TLB +/* +* This lets us share the highpte pte_offset_map() +* with x86 +*/ +#define kmap_atomic_pte (page, type) kmap_atomic(page, type)extern pte_t *pkmap_page_table;#define flush_cache_kmaps () do { } while (0)
arch/frv/include/asm/ptemap.h renamed from arch/frv/include/asm/ptemap.h~frv-pte_offset_kernel +2 -3
@@ -9,9 +9,8 @@#define pte_unmap (pte) kunmap_atomic(pte, KM_PTE0)#define pte_unmap_nested (pte) kunmap_atomic((pte), KM_PTE1)#else -#define pte_offset_map (dir, address) \ - ((pte_t *)page_address(pmd_page(*(dir))) + pte_index(address)) -#define pte_offset_map_nested (dir, address) pte_offset_map((dir), (address)) +#define pte_offset_map (dir, address) pte_offset_kernel(dir, address) +#define pte_offset_map_nested (dir, address) pte_offset_kernel(dir, address)#define pte_unmap (pte) do { } while (0)#define pte_unmap_nested (pte) do { } while (0)#endif
_
RFC PATCH 27/35 m32r: use pte_offset_kernel() as base for pte_offset_map*()
In reply to Dave HansenSome architectures use pte_offset_map() as a basis for pte_offset_kernel(). Others do the inverse.
Although arbitrary, Using pte_offset_kernel() as the base seems a wee bit more popular and it also fits in well with the way I'm breaking out the headers.
Instead of coding the same implementation twice, this makes pte_offset_map{,_nested}() call pte_offset_kernel() directly.
---
linux-2.6.git-dave/arch/m32r/include/asm/ptemap.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
arch/m32r/include/asm/ptemap.h renamed from arch/m32r/include/asm/ptemap.h~m32r-pte_offset_kernel +2 -3
@@ -1,9 +1,8 @@#ifndef _M32R_ASM_PTEMAP_H#define _M32R_ASM_PTEMAP_H -#define pte_offset_map (dir, address) \ - ((pte_t *)page_address(pmd_page(*(dir))) + pte_index(address)) -#define pte_offset_map_nested (dir, address) pte_offset_map(dir, address) +#define pte_offset_map (dir, address) pte_offset_kernel(dir, address) +#define pte_offset_map_nested (dir, address) pte_offset_kernel(dir, address)#define pte_unmap (pte) do { } while (0)#define pte_unmap_nested (pte) do { } while (0)
_
RFC PATCH 28/35 mips: use pte_offset_kernel() as base for pte_offset_map*()
In reply to Dave HansenSome architectures use pte_offset_map() as a basis for pte_offset_kernel(). Others do the inverse.
Although arbitrary, Using pte_offset_kernel() as the base seems a wee bit more popular and it also fits in well with the way I'm breaking out the headers.
Instead of coding the same implementation twice, this makes pte_offset_map{,_nested}() call pte_offset_kernel() directly.
On MIPS, it is also obvious at this point that the 32 and 64-bit implementations are identical. Coalesce them.
---
linux-2.6.git-dave/arch/mips/include/asm/pgtable-32.h | 3 +-- linux-2.6.git-dave/arch/mips/include/asm/pgtable-64.h | 3 +-- linux-2.6.git-dave/arch/mips/include/asm/ptemap.h | 17 ++--------------- 3 files changed, 4 insertions(+), 19 deletions(-)
arch/mips/include/asm/pgtable-32.h renamed from arch/mips/include/asm/pgtable-32.h~mips-pte_offset_kernel +1 -2
@@ -149,8 +149,7 @@ pfn_pte(unsigned long pfn, pgprot_t prot (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))#define pte_offset (dir, address) \ ((pte_t *) pmd_page_vaddr(*(dir)) + __pte_offset(address)) -#define pte_offset_kernel (dir, address) \ - ((pte_t *) pmd_page_vaddr(*(dir)) + __pte_offset(address)) +#define pte_offset_kernel (dir, address) pte_offset(dir, address)#include <asm/ptemap.h> #if defined(CONFIG_CPU_R3000 ) || defined(CONFIG_CPU_TX39XX )
arch/mips/include/asm/pgtable-64.h renamed from arch/mips/include/asm/pgtable-64.h~mips-pte_offset_kernel +1 -2
@@ -213,8 +213,7 @@ static inline pmd_t *pmd_offset(pud_t * (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))#define pte_offset (dir, address) \ ((pte_t *) pmd_page_vaddr(*(dir)) + __pte_offset(address)) -#define pte_offset_kernel (dir, address) \ - ((pte_t *) pmd_page_vaddr(*(dir)) + __pte_offset(address)) +#define pte_offset_kernel (dir, address) pte_offset(dir, address)#include <asm/ptemap.h> /* * Initialize a new pgd / pmd table with invalid pointers.
arch/mips/include/asm/ptemap.h renamed from arch/mips/include/asm/ptemap.h~mips-pte_offset_kernel +2 -15
@@ -1,22 +1,9 @@#ifndef _MIPS_ASM_PTEMAP_H#define _MIPS_ASM_PTEMAP_H -#ifdef CONFIG_32BIT -#define pte_offset_map (dir, address) \ - ((pte_t *)page_address(pmd_page(*(dir))) + __pte_offset(address)) -#define pte_offset_map_nested (dir, address) \ - ((pte_t *)page_address(pmd_page(*(dir))) + __pte_offset(address)) +#define pte_offset_map (dir, address) pte_offset_kernel(dir, address) +#define pte_offset_map_nested (dir, address) pte_offset_kernel(dir, address)#define pte_unmap (pte) ((void)(pte))#define pte_unmap_nested (pte) ((void)(pte)) -#endif - -#ifdef CONFIG_64BIT -#define pte_offset_map (dir, address) \ - ((pte_t *)page_address(pmd_page(*(dir))) + __pte_offset(address)) -#define pte_offset_map_nested (dir, address) \ - ((pte_t *)page_address(pmd_page(*(dir))) + __pte_offset(address)) -#define pte_unmap (pte) ((void)(pte)) -#define pte_unmap_nested (pte) ((void)(pte)) -#endif #endif /* _MIPS_ASM_PTEMAP_H */
_
RFC PATCH 29/35 um: use pte_offset_kernel() as base for pte_offset_map*()
In reply to Dave HansenSome architectures use pte_offset_map() as a basis for pte_offset_kernel(). Others do the inverse.
Although arbitrary, Using pte_offset_kernel() as the base seems a wee bit more popular and it also fits in well with the way I'm breaking out the headers.
Instead of coding the same implementation twice, this makes pte_offset_map{,_nested}() call pte_offset_kernel() directly.
---
linux-2.6.git-dave/arch/um/include/asm/ptemap.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
arch/um/include/asm/ptemap.h renamed from arch/um/include/asm/ptemap.h~um-pte_offset_kernel +2 -3
@@ -1,9 +1,8 @@#ifndef _UM_ASM_PTEMAP_H#define _UM_ASM_PTEMAP_H -#define pte_offset_map (dir, address) \ - ((pte_t *)page_address(pmd_page(*(dir))) + pte_index(address)) -#define pte_offset_map_nested (dir, address) pte_offset_map(dir, address) +#define pte_offset_map (dir, address) pte_offset_kernel(dir, address) +#define pte_offset_map_nested (dir, address) pte_offset_kernel(dir, address)#define pte_unmap (pte) do { } while (0)#define pte_unmap_nested (pte) do { } while (0)
_
RFC PATCH 30/35 m68k: use pte_offset_kernel() as base for pte_offset_map*()
In reply to Dave HansenSome architectures use pte_offset_map() as a basis for pte_offset_kernel(). Others do the inverse.
Although arbitrary, Using pte_offset_kernel() as the base seems a wee bit more popular and it also fits in well with the way I'm breaking out the headers.
Instead of coding the same implementation twice, this makes pte_offset_map{,_nested}() call pte_offset_kernel() directly.
---
linux-2.6.git-dave/arch/m68k/include/asm/ptemap.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/m68k/include/asm/ptemap.h renamed from arch/m68k/include/asm/ptemap.h~m68k-pte_offset_kernel +2 -2
@@ -12,8 +12,8 @@#else /* !CONFIG_SUN3, Motorola */ -#define pte_offset_map (pmdp,address) ((pte_t *)__pmd_page(*pmdp) + (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))) -#define pte_offset_map_nested (pmdp, address) pte_offset_map(pmdp, address) +#define pte_offset_map (pmdp,address) pte_offset_kernel(pmdp, address) +#define pte_offset_map_nested (pmdp, address) pte_offset_kernel(pmdp, address)#define pte_unmap (pte) ((void)0)#define pte_unmap_nested (pte) ((void)0)
_
RFC PATCH 31/35 mn10300: use pte_offset_kernel() as base for pte_offset_map*()
In reply to Dave HansenSome architectures use pte_offset_map() as a basis for pte_offset_kernel(). Others do the inverse.
Although arbitrary, Using pte_offset_kernel() as the base seems a wee bit more popular and it also fits in well with the way I'm breaking out the headers.
Instead of coding the same implementation twice, this makes pte_offset_map{,_nested}() call pte_offset_kernel() directly.
---
linux-2.6.git-dave/arch/mn10300/include/asm/ptemap.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
arch/mn10300/include/asm/ptemap.h renamed from arch/mn10300/include/asm/ptemap.h~mn10300-pte_offset_kernel +2 -3
@@ -1,9 +1,8 @@#ifndef _MN10300_ASM_PTEMAP_H#define _MN10300_ASM_PTEMAP_H -#define pte_offset_map (dir, address) \ - ((pte_t *) page_address(pmd_page(*(dir))) + pte_index(address)) -#define pte_offset_map_nested (dir, address) pte_offset_map(dir, address) +#define pte_offset_map (dir, address) pte_offset_kernel(dir, address) +#define pte_offset_map_nested (dir, address) pte_offset_kernel(dir, address)#define pte_unmap (pte) do {} while (0)#define pte_unmap_nested (pte) do {} while (0)
_
RFC PATCH 32/35 Move users to asm-generic/ptemap.h
In reply to Dave HansenNow that we have everyone using pte_offset_kernel(), we can plainy see that almost all the users are exactly the same.
This takes all of those users and moves them over to using asm-generic/ptemap.h instead.
---
linux-2.6.git-dave/arch/alpha/include/asm/ptemap.h | 10 ------ linux-2.6.git-dave/arch/arm/include/asm/ptemap.h | 10 ------ linux-2.6.git-dave/arch/avr32/include/asm/ptemap.h | 10 ------ linux-2.6.git-dave/arch/cris/include/asm/ptemap.h | 10 ------ linux-2.6.git-dave/arch/frv/include/asm/ptemap.h | 5 --- linux-2.6.git-dave/arch/ia64/include/asm/ptemap.h | 10 ------ linux-2.6.git-dave/arch/m32r/include/asm/ptemap.h | 10 ------ linux-2.6.git-dave/arch/m68k/include/asm/ptemap.h | 5 --- linux-2.6.git-dave/arch/mips/include/asm/ptemap.h | 10 ------ linux-2.6.git-dave/arch/mn10300/include/asm/ptemap.h | 10 ------ linux-2.6.git-dave/arch/parisc/include/asm/ptemap.h | 13 -------- linux-2.6.git-dave/arch/powerpc/include/asm/ptemap.h | 5 --- linux-2.6.git-dave/arch/s390/include/asm/ptemap.h | 10 ------ linux-2.6.git-dave/arch/sh/include/asm/ptemap.h | 10 ------ linux-2.6.git-dave/arch/sparc/include/asm/ptemap.h | 30 ------------------- linux-2.6.git-dave/arch/um/include/asm/ptemap.h | 10 ------ linux-2.6.git-dave/arch/x86/include/asm/ptemap.h | 5 --- linux-2.6.git-dave/arch/xtensa/include/asm/ptemap.h | 11 ------ linux-2.6.git-dave/include/asm-generic/ptemap.h | 9 +++++ 19 files changed, 27 insertions(+), 166 deletions(-)
arch/alpha/include/asm/ptemap.h renamed from arch/alpha/include/asm/ptemap.h~asm-generic-ptemap-h +1 -9
@@ -1,9 +1 @@ -#ifndef _ALPHA_ASM_PTEMAP_H -#define _ALPHA_ASM_PTEMAP_H - -#define pte_offset_map (dir,addr) pte_offset_kernel((dir),(addr)) -#define pte_offset_map_nested (dir,addr) pte_offset_kernel((dir),(addr)) -#define pte_unmap (pte) do { } while (0) -#define pte_unmap_nested (pte) do { } while (0) - -#endif /* _ALPHA_ASM_PTEMAP_H */ +#include <asm-generic/ptemap.h>
arch/arm/include/asm/ptemap.h renamed from arch/arm/include/asm/ptemap.h~asm-generic-ptemap-h +1 -9
@@ -1,9 +1 @@ -#ifndef _ARM_ASM_PTEMAP_H -#define _ARM_ASM_PTEMAP_H - -#define pte_offset_map (dir,addr) pte_offset_kernel(dir,addr) -#define pte_offset_map_nested (dir,addr) pte_offset_kernel(dir,addr) -#define pte_unmap (pte) do { } while (0) -#define pte_unmap_nested (pte) do { } while (0) - -#endif /* _ARM_ASM_PTEMAP_H */ +#include <asm-generic/ptemap.h>
arch/avr32/include/asm/ptemap.h renamed from arch/avr32/include/asm/ptemap.h~asm-generic-ptemap-h +1 -9
@@ -1,9 +1 @@ -#ifndef _AVR32_ASM_PTEMAP_H -#define _AVR32_ASM_PTEMAP_H - -#define pte_offset_map (dir, address) pte_offset_kernel(dir, address) -#define pte_offset_map_nested (dir, address) pte_offset_kernel(dir, address) -#define pte_unmap (pte) do { } while (0) -#define pte_unmap_nested (pte) do { } while (0) - -#endif /* _AVR32_ASM_PTEMAP_H */ +#include <asm-generic/ptemap.h>
arch/cris/include/asm/ptemap.h renamed from arch/cris/include/asm/ptemap.h~asm-generic-ptemap-h +1 -9
@@ -1,9 +1 @@ -#ifndef _CRIS_ASM_PTEMAP_H -#define _CRIS_ASM_PTEMAP_H - -#define pte_offset_map (dir, address) pte_offset_kernel(dir, address) -#define pte_offset_map_nested (dir, address) pte_offset_kernel(dir, address) -#define pte_unmap (pte) do { } while (0) -#define pte_unmap_nested (pte) do { } while (0) - -#endif /* _CRIS_ASM_PTEMAP_H */ +#include <asm-generic/ptemap.h>
arch/frv/include/asm/ptemap.h renamed from arch/frv/include/asm/ptemap.h~asm-generic-ptemap-h +1 -4
@@ -9,10 +9,7 @@#define pte_unmap (pte) kunmap_atomic(pte, KM_PTE0)#define pte_unmap_nested (pte) kunmap_atomic((pte), KM_PTE1)#else -#define pte_offset_map (dir, address) pte_offset_kernel(dir, address) -#define pte_offset_map_nested (dir, address) pte_offset_kernel(dir, address) -#define pte_unmap (pte) do { } while (0) -#define pte_unmap_nested (pte) do { } while (0) +#include <asm-generic/ptemap.h> #endif #endif /* _FRV_ASM_PTEMAP_H */
arch/ia64/include/asm/ptemap.h renamed from arch/ia64/include/asm/ptemap.h~asm-generic-ptemap-h +1 -9
@@ -1,9 +1 @@ -#ifndef _IA64_ASM_PTEMAP_H -#define _IA64_ASM_PTEMAP_H - -#define pte_offset_map (dir,addr) pte_offset_kernel(dir, addr) -#define pte_offset_map_nested (dir,addr) pte_offset_map(dir, addr) -#define pte_unmap (pte) do { } while (0) -#define pte_unmap_nested (pte) do { } while (0) - -#endif /* _IA64_ASM_PTEMAP_H */ +#include <asm-generic/ptemap.h>
arch/m32r/include/asm/ptemap.h renamed from arch/m32r/include/asm/ptemap.h~asm-generic-ptemap-h +1 -9
@@ -1,9 +1 @@ -#ifndef _M32R_ASM_PTEMAP_H -#define _M32R_ASM_PTEMAP_H - -#define pte_offset_map (dir, address) pte_offset_kernel(dir, address) -#define pte_offset_map_nested (dir, address) pte_offset_kernel(dir, address) -#define pte_unmap (pte) do { } while (0) -#define pte_unmap_nested (pte) do { } while (0) - -#endif /* _M32R_ASM_PTEMAP_H */ +#include <asm-generic/ptemap.h>
arch/m68k/include/asm/ptemap.h renamed from arch/m68k/include/asm/ptemap.h~asm-generic-ptemap-h +1 -4
@@ -12,10 +12,7 @@#else /* !CONFIG_SUN3, Motorola */ -#define pte_offset_map (pmdp,address) pte_offset_kernel(pmdp, address) -#define pte_offset_map_nested (pmdp, address) pte_offset_kernel(pmdp, address) -#define pte_unmap (pte) ((void)0) -#define pte_unmap_nested (pte) ((void)0) +#include <asm-generic/ptemap.h> #endif /* CONFIG_SUN3 */
arch/mips/include/asm/ptemap.h renamed from arch/mips/include/asm/ptemap.h~asm-generic-ptemap-h +1 -9
@@ -1,9 +1 @@ -#ifndef _MIPS_ASM_PTEMAP_H -#define _MIPS_ASM_PTEMAP_H - -#define pte_offset_map (dir, address) pte_offset_kernel(dir, address) -#define pte_offset_map_nested (dir, address) pte_offset_kernel(dir, address) -#define pte_unmap (pte) ((void)(pte)) -#define pte_unmap_nested (pte) ((void)(pte)) - -#endif /* _MIPS_ASM_PTEMAP_H */ +#include <asm-generic/ptemap.h>
arch/mn10300/include/asm/ptemap.h renamed from arch/mn10300/include/asm/ptemap.h~asm-generic-ptemap-h +1 -9
@@ -1,9 +1 @@ -#ifndef _MN10300_ASM_PTEMAP_H -#define _MN10300_ASM_PTEMAP_H - -#define pte_offset_map (dir, address) pte_offset_kernel(dir, address) -#define pte_offset_map_nested (dir, address) pte_offset_kernel(dir, address) -#define pte_unmap (pte) do {} while (0) -#define pte_unmap_nested (pte) do {} while (0) - -#endif /* _MN10300_ASM_PTEMAP_H */ +#include <asm-generic/ptemap.h>
arch/parisc/include/asm/ptemap.h renamed from arch/parisc/include/asm/ptemap.h~asm-generic-ptemap-h +1 -12
@@ -1,12 +1 @@ -#ifndef _PARISC_ASM_PTEMAP_H -#define _PARISC_ASM_PTEMAP_H - -#define pte_offset_map (pmd, address) pte_offset_kernel(pmd, address) -#define pte_offset_map_nested (pmd, address) pte_offset_kernel(pmd, address) -#define pte_unmap (pte) do { } while (0) -#define pte_unmap_nested (pte) do { } while (0) - -#define pte_unmap (pte) do { } while (0) -#define pte_unmap_nested (pte) do { } while (0) - -#endif /* _PARISC_ASM_PTEMAP_H */ +#include <asm-generic/ptemap.h>
arch/powerpc/include/asm/ptemap.h renamed from arch/powerpc/include/asm/ptemap.h~asm-generic-ptemap-h +1 -4
@@ -13,10 +13,7 @@#else /* __powerpc64__ */ -#define pte_offset_map (dir,addr) pte_offset_kernel((dir), (addr)) -#define pte_offset_map_nested (dir,addr) pte_offset_kernel((dir), (addr)) -#define pte_unmap (pte) do { } while(0) -#define pte_unmap_nested (pte) do { } while(0) +#include <asm-generic/ptemap.h> #endif
arch/s390/include/asm/ptemap.h renamed from arch/s390/include/asm/ptemap.h~asm-generic-ptemap-h +1 -9
@@ -1,9 +1 @@ -#ifndef _S390_ASM_PTEMAP_H -#define _S390_ASM_PTEMAP_H - -#define pte_offset_map (pmd, address) pte_offset_kernel(pmd, address) -#define pte_offset_map_nested (pmd, address) pte_offset_kernel(pmd, address) -#define pte_unmap (pte) do { } while (0) -#define pte_unmap_nested (pte) do { } while (0) - -#endif /* _S390_ASM_PTEMAP_H */ +#include <asm-generic/ptemap.h>
arch/sh/include/asm/ptemap.h renamed from arch/sh/include/asm/ptemap.h~asm-generic-ptemap-h +1 -9
@@ -1,9 +1 @@ -#ifndef _SH_ASM_PTEMAP_H -#define _SH_ASM_PTEMAP_H - -#define pte_offset_map (dir, address) pte_offset_kernel(dir, address) -#define pte_offset_map_nested (dir, address) pte_offset_kernel(dir, address) -#define pte_unmap (pte) do { } while (0) -#define pte_unmap_nested (pte) do { } while (0) - -#endif /* _SH_ASM_PTEMAP_H */ +#include <asm-generic/ptemap.h>
arch/sparc/include/asm/ptemap.h renamed from arch/sparc/include/asm/ptemap.h~asm-generic-ptemap-h +1 -29
@@ -1,29 +1 @@ -#ifndef _SPARC_ASM_PTEMAP_H -#define _SPARC_ASM_PTEMAP_H - -#if defined(__sparc__) && defined(__arch64__) - -/* Certain architectures need to do special things when pte's -* within a page table are directly modified. Thus, the following -* hook is made available. -*/ - -#define pte_offset_map (dir, address) pte_offset_kernel((dir), (address)) -#define pte_offset_map_nested (dir, address) pte_offset_kernel((dir), (address)) -#define pte_unmap (pte) do { } while (0) -#define pte_unmap_nested (pte) do { } while (0) - -#else - - * This shortcut works on sun4m (and sun4d) because the nocache area is static, - * and sun4c is guaranteed to have no highmem anyway. - */ -#define pte_offset_map (d, a) pte_offset_kernel(d,a) -#define pte_offset_map_nested (d, a) pte_offset_kernel(d,a) - -#define pte_unmap (pte) do{}while(0) -#define pte_unmap_nested (pte) do{}while(0) - -#endif - -#endif /* _SPARC_ASM_PTEMAP_H *//* +#include <asm-generic/ptemap.h>
arch/um/include/asm/ptemap.h renamed from arch/um/include/asm/ptemap.h~asm-generic-ptemap-h +1 -9
@@ -1,9 +1 @@ -#ifndef _UM_ASM_PTEMAP_H -#define _UM_ASM_PTEMAP_H - -#define pte_offset_map (dir, address) pte_offset_kernel(dir, address) -#define pte_offset_map_nested (dir, address) pte_offset_kernel(dir, address) -#define pte_unmap (pte) do { } while (0) -#define pte_unmap_nested (pte) do { } while (0) - -#endif /* _UM_ASM_PTEMAP_H */ +#include <asm-generic/ptemap.h>
arch/x86/include/asm/ptemap.h renamed from arch/x86/include/asm/ptemap.h~asm-generic-ptemap-h +1 -4
@@ -13,10 +13,7 @@#else /* !CONFIG_HIGHPTE */ -#define pte_offset_map (dir, address) pte_offset_kernel((dir), (address)) -#define pte_offset_map_nested (dir, address) pte_offset_kernel((dir), (address)) -#define pte_unmap (pte) do { } while (0) -#define pte_unmap_nested (pte) do { } while (0) +#include <asm-generic/ptemap.h> #endif
arch/xtensa/include/asm/ptemap.h renamed from arch/xtensa/include/asm/ptemap.h~asm-generic-ptemap-h +1 -10
@@ -1,10 +1 @@ -#ifndef _XTENSA_ASM_PTEMAP_H -#define _XTENSA_ASM_PTEMAP_H - -#define pte_offset_map (dir,addr) pte_offset_kernel((dir),(addr)) -#define pte_offset_map_nested (dir,addr) pte_offset_kernel((dir),(addr)) - -#define pte_unmap (pte) do { } while (0) -#define pte_unmap_nested (pte) do { } while (0) - -#endif /* _XTENSA_ASM_PTEMAP_H */ +#include <asm-generic/ptemap.h>
include/asm-generic/ptemap.h new file +9 -0
@@ -0,0 +1,9 @@ +#ifndef _ASM_GENERIC_PTEMAP_H +#define _ASM_GENERIC_PTEMAP_H + +#define pte_offset_map (dir,addr) pte_offset_kernel((dir),(addr)) +#define pte_offset_map_nested (dir,addr) pte_offset_kernel((dir),(addr)) +#define pte_unmap (pte) do { } while (0) +#define pte_unmap_nested (pte) do { } while (0) + +#endif /* _ASM_GENERIC_PTEMAP_H */
_
Re: [RFC][PATCH 32/35] Move users to asm-generic/ptemap.h
Quoted 7 lines · Dave Hansen
Now that we have everyone using
pte_offset_kernel(), we can plainy see that almost all the users are exactly the same.This takes all of those users and moves them over to using
asm-generic/ptemap.hinstead.
s/users/implementations/g ?
Also asm-generic/ptemap.h really wants a comment when architectures can use this generic version.
Re: [RFC][PATCH 32/35] Move users to asm-generic/ptemap.h
Quoted 9 lines · Christoph Hellwig
Quoted 6 lines · Dave Hansen
Now that we have everyone using
pte_offset_kernel(), we can plainy see that almost all the users are exactly the same.This takes all of those users and moves them over to using
asm-generic/ptemap.hinstead.s/users/implementations/g ?
Yeah, that's clearer.
Quoted 2 lines
Also
asm-generic/ptemap.hreally wants a comment when architectures can use this generic version.
/*
* If your architecture has direct-mapped PTE pages (no HIGHPTE)
* then you just need to implement pte_offset_kernel() and include
* this in your asm/ptemap.h.
*
* To support HIGHPTE, you need to have implementations of
* kmap_atomic_pte() (which usually just calls kmap_atomic()),
* pmd_page() and pmd_index().
*/
-- Dave
RFC PATCH 33/35 asm-generic/ptemap.h for HIGHPTE users
In reply to Dave Hansenx86 and frv have identical CONFIG_HIGHPTE implementations of the pte mapping functions. Consolidate and move these to asm-generic/ptemap.h.
---
linux-2.6.git-dave/arch/frv/include/asm/ptemap.h | 14 -------------- linux-2.6.git-dave/arch/x86/include/asm/ptemap.h | 19 ------------------- linux-2.6.git-dave/include/asm-generic/ptemap.h | 13 +++++++++++++ 3 files changed, 13 insertions(+), 33 deletions(-)
arch/frv/include/asm/ptemap.h renamed from arch/frv/include/asm/ptemap.h~asm-generic-ptemap-h-highpte +0 -14
@@ -1,15 +1 @@ -#ifndef _FRV_ASM_PTEMAP_H -#define _FRV_ASM_PTEMAP_H - -#if defined(CONFIG_HIGHPTE ) -#define pte_offset_map (dir, address) \ - ((pte_t *)kmap_atomic(pmd_page(*(dir)),KM_PTE0) + pte_index(address)) -#define pte_offset_map_nested (dir, address) \ - ((pte_t *)kmap_atomic(pmd_page(*(dir)),KM_PTE1) + pte_index(address)) -#define pte_unmap (pte) kunmap_atomic(pte, KM_PTE0) -#define pte_unmap_nested (pte) kunmap_atomic((pte), KM_PTE1) -#else #include <asm-generic/ptemap.h> -#endif - -#endif /* _FRV_ASM_PTEMAP_H */
arch/x86/include/asm/ptemap.h renamed from arch/x86/include/asm/ptemap.h~asm-generic-ptemap-h-highpte +0 -19
@@ -1,20 +1 @@ -#ifndef _X86_ASM_PTEMAP_H -#define _X86_ASM_PTEMAP_H - -#if defined(CONFIG_HIGHPTE ) -#define pte_offset_map (dir, address) \ - ((pte_t *)kmap_atomic_pte(pmd_page(*(dir)), KM_PTE0) + \ - pte_index((address))) -#define pte_offset_map_nested (dir, address) \ - ((pte_t *)kmap_atomic_pte(pmd_page(*(dir)), KM_PTE1) + \ - pte_index((address))) -#define pte_unmap (pte) kunmap_atomic((pte), KM_PTE0) -#define pte_unmap_nested (pte) kunmap_atomic((pte), KM_PTE1) - -#else /* !CONFIG_HIGHPTE */ -#include <asm-generic/ptemap.h> - -#endif - -#endif /* _X86_ASM_PTEMAP_H */
include/asm-generic/ptemap.h renamed from include/asm-generic/ptemap.h~asm-generic-ptemap-h-highpte +13 -0
@@ -1,6 +1,19 @@#ifndef _ASM_GENERIC_PTEMAP_H#define _ASM_GENERIC_PTEMAP_H +#include <linux/mm.h> + +#ifdef CONFIG_HIGHPTE +#include <asm/highmem.h> +#define pte_offset_map (dir, address) \ + ((pte_t *)kmap_atomic(pmd_page(*(dir)),KM_PTE0) + pte_index(address)) +#define pte_offset_map_nested (dir, address) \ + ((pte_t *)kmap_atomic(pmd_page(*(dir)),KM_PTE1) + pte_index(address)) +#define pte_unmap (pte) kunmap_atomic(pte, KM_PTE0) +#define pte_unmap_nested (pte) kunmap_atomic((pte), KM_PTE1) + +#else /* !CONFIG_HIGHPTE */ +#define pte_offset_map (dir,addr) pte_offset_kernel((dir),(addr))#define pte_offset_map_nested (dir,addr) pte_offset_kernel((dir),(addr))#define pte_unmap (pte) do { } while (0)
_
RE: [RFC][PATCH 33/35] asm-generic/ptemap.h for HIGHPTE users
Quoted 13 lines
diff -puN
include/asm-generic/ptemap.h~asm-generic-ptemap-h-highpteinclude/asm-generic/ptemap.hinclude/asm-generic/ptemap.h renamed from include/asm-generic/ptemap.h~asm-generic-ptemap-h-highpte +11
-0+#ifdef CONFIG_HIGHPTE +#include <asm/highmem.h> +#define pte_offset_map (dir, address) \ + ((pte_t *)kmap_atomic(pmd_page(*(dir)),KM_PTE0) + pte_index(address)) +#define pte_offset_map_nested (dir, address) \ + ((pte_t *)kmap_atomic(pmd_page(*(dir)),KM_PTE1) + pte_index(address)) +#define pte_unmap (pte) kunmap_atomic(pte, KM_PTE0) +#define pte_unmap_nested (pte) kunmap_atomic((pte), KM_PTE1) + +#else /* !CONFIG_HIGHPTE */ +
Quoted 3 lines
#define
pte_offset_map(dir,addr)pte_offset_kernel((dir),(addr))
#definepte_offset_map_nested(dir,addr)pte_offset_kernel((dir),(addr))
#definepte_unmap(pte)do { } while (0)
You need to add a closing #endif here.
-Tony
RE: [RFC][PATCH 33/35] asm-generic/ptemap.h for HIGHPTE users
Quoted 9 lines · Tony
Quoted 9 lines
diff -puN
include/asm-generic/ptemap.h~asm-generic-ptemap-h-highpteinclude/asm-generic/ptemap.hinclude/asm-generic/ptemap.h renamed from include/asm-generic/ptemap.h~asm-generic-ptemap-h-highpte +8
-0+#ifdef CONFIG_HIGHPTE +#include <asm/highmem.h> +#define pte_offset_map (dir, address) \ + ((pte_t *)kmap_atomic(pmd_page(*(dir)),KM_PTE0) + pte_index(address)) +#define pte_offset_map_nested (dir, address) \ + ((pte_t *)kmap_atomic(pmd_page(*(dir)),KM_PTE1) + pte_index(address)) +#define pte_unmap (pte) kunmap_atomic(pte, KM_PTE0) +#define pte_unmap_nested (pte) kunmap_atomic((pte), KM_PTE1)
Quoted 8 lines
Quoted 6 lines
include/asm-generic/ptemap.h renamed from include/asm-generic/ptemap.h~asm-generic-ptemap-h-highpte +3
-0+ +#else /* !CONFIG_HIGHPTE */ +#define
pte_offset_map(dir,addr)pte_offset_kernel((dir),(addr))
#definepte_offset_map_nested(dir,addr)pte_offset_kernel((dir),(addr))
#definepte_unmap(pte)do { } while (0)You need to add a closing #endif here.
Fixed, thanks.
-- Dave
RE: [RFC][PATCH 33/35] asm-generic/ptemap.h for HIGHPTE users
Quoted 3 lines
Quoted 1 line
You need to add a closing #endif here.
Fixed, thanks.
ia64 build fails with:
arch/ia64/mm/init.c: In function 'put_kernel_page':arch/ia64/mm/init.c:248: error: implicit declaration of function 'pte_alloc_kernel' arch/ia64/mm/init.c:248: warning: assignment makes pointer from integer without a cast make[1]: *** [arch/ia64/mm/init.o] Error 1
Which I fixed by adding a #include <linux/ptemap.h> to init.c
-Tony
RE: [RFC][PATCH 33/35] asm-generic/ptemap.h for HIGHPTE users
Quoted 11 lines · Tony
Quoted 2 lines
Quoted 1 line
You need to add a closing #endif here.
Fixed, thanks.
ia64 build fails with:
arch/ia64/mm/init.c: In function 'put_kernel_page':arch/ia64/mm/init.c:248: error: implicit declaration of function 'pte_alloc_kernel'arch/ia64/mm/init.c:248: warning: assignment makes pointer from integer without a cast make[1]: *** [arch/ia64/mm/init.o] Error 1Which I fixed by adding a #include <
linux/ptemap.h> toinit.c
I need to get a working ia64 compiler. :)
I'll add that to my 'include linux/ptemap.h at all use sites' patch.
-- Dave
RFC PATCH 34/35 powerpc use generic ptemap.h
In reply to Dave Hansenpowerpc is a bid of an oddball here. It seems to have CONFIG_HIGHPTE behavior at all times when compiled as 32-bit. There's even an #ifdef CONFIG_HIGHPTE in arch/powerpc/mm/pgtable_32.c, but there's no trace of HIGHPTE in Kconfig anywhere.
This gives ppc32 an explicit HIGHPTE in Kconfig so that we can use the #ifdef in asm-generic/ptemap.h and let ppc use the generic code with x86 and frv.
---
linux-2.6.git-dave/arch/powerpc/Kconfig | 4 ++++ linux-2.6.git-dave/arch/powerpc/include/asm/ptemap.h | 18 ++++++------------ 2 files changed, 10 insertions(+), 12 deletions(-)
arch/powerpc/include/asm/ptemap.h renamed from arch/powerpc/include/asm/ptemap.h~powerpc-pte_offset_kernel +6 -12
@@ -2,19 +2,13 @@#define _POWERPC_ASM_PTEMAP_H#ifndef __powerpc64__ - -#define pte_offset_map (dir, addr) \ - ((pte_t *) kmap_atomic(pmd_page(*(dir)), KM_PTE0) + pte_index(addr)) -#define pte_offset_map_nested (dir, addr) \ - ((pte_t *) kmap_atomic(pmd_page(*(dir)), KM_PTE1) + pte_index(addr)) - -#define pte_unmap (pte) kunmap_atomic(pte, KM_PTE0) -#define pte_unmap_nested (pte) kunmap_atomic(pte, KM_PTE1) - -#else /* __powerpc64__ */ +/* +* This lets us use the x86 implementation +* in the generic ptemap.h +*/ +#define kmap_atomic_pte (page, type) kmap_atomic(page, type) +#endif #include <asm-generic/ptemap.h> -#endif -#endif /* _POWERPC_ASM_PTEMAP_H */
arch/powerpc/Kconfig renamed from arch/powerpc/Kconfig~powerpc-pte_offset_kernel +4 -0
@@ -244,6 +244,10 @@ config HIGHMEM bool "High memory support" depends on PPC32 +config HIGHPTE + def_bool y + depends on HIGHMEM + source kernel/time/Kconfig source kernel/Kconfig.hz source kernel/Kconfig.preempt
_
Re: [RFC][PATCH 34/35] powerpc use generic ptemap.h
Quoted 9 lines · Dave Hansen
powerpc is a bid of an oddball here. It seems to have
CONFIG_HIGHPTEbehavior at all times when compiled as 32-bit. There's even an #ifdefCONFIG_HIGHPTEinarch/powerpc/mm/pgtable_32.c, but there's no trace of HIGHPTE inKconfiganywhere.This gives ppc32 an explicit HIGHPTE in
Kconfigso that we can use the #ifdef inasm-generic/ptemap.hand let ppc use the generic code with x86 and frv.
But if you enabled HIGHPTE you need to remove that ifdef in pgtable_32.c because it didn't get triggered before.
arch/powerpc/include/asm/ptemap.h line 10
Quoted 9 lines
#define
_POWERPC_ASM_PTEMAP_H#ifndef
__powerpc64__arch/powerpc/include/asm/ptemap.h renamed from arch/powerpc/include/asm/ptemap.h~powerpc-pte_offset_kernel +6
-0+/* +* This lets us use the x86 implementation +* in the generic ptemap.h +*/ +#define kmap_atomic_pte (page, type) kmap_atomic(page, type) +#endif
That comment doesn't make any sense to me, x86 should have nothing to do with it. Also the comment would comfortably fit into a single line instead of two.
Re: [RFC][PATCH 34/35] powerpc use generic ptemap.h
Quoted 7 lines · Christoph Hellwig
Quoted 5 lines · Dave Hansen
powerpc is a bid of an oddball here. It seems to have
CONFIG_HIGHPTEbehavior at all times when compiled as 32-bit. There's even an #ifdefCONFIG_HIGHPTEinarch/powerpc/mm/pgtable_32.c, but there's no trace of HIGHPTE inKconfiganywhere.
Quoted 6 lines
Quoted 3 lines
This gives ppc32 an explicit HIGHPTE in
Kconfigso that we can use the #ifdef inasm-generic/ptemap.hand let ppc use the generic code with x86 and frv.But if you enabled HIGHPTE you need to remove that ifdef in
pgtable_32.cbecause it didn't get triggered before.
OK, that makes sense.
Quoted 13 lines
arch/powerpc/include/asm/ptemap.h line 10
Quoted 9 lines
#define
_POWERPC_ASM_PTEMAP_H#ifndef
__powerpc64__arch/powerpc/include/asm/ptemap.h renamed from arch/powerpc/include/asm/ptemap.h~powerpc-pte_offset_kernel +6
-0+/* +* This lets us use the x86 implementation +* in the generic ptemap.h +*/ +#define kmap_atomic_pte (page, type) kmap_atomic(page, type) +#endif That comment doesn't make any sense to me, x86 should have nothing to do with it. Also the comment would comfortably fit into a single line instead of two.
You're right, that is more of a changelog thing. I'll fix it up.
-- Dave
Re: [RFC][PATCH 34/35] powerpc use generic ptemap.h
In reply to Dave HansenQuoted 8 lines · Dave Hansen
powerpc is a bid of an oddball here. It seems to have
CONFIG_HIGHPTEbehavior at all times when compiled as 32-bit. There's even an #ifdefCONFIG_HIGHPTEinarch/powerpc/mm/pgtable_32.c, but there's no trace of HIGHPTE inKconfiganywhere.This gives ppc32 an explicit HIGHPTE in
Kconfigso that we can use the #ifdef inasm-generic/ptemap.hand let ppc use the generic code with x86 and frv.
With a bit of lag as I was away...
arch/powerpc/Kconfig config HIGHMEM · line 250
Quoted 4 lines
arch/powerpc/Kconfig renamed from arch/powerpc/Kconfig~powerpc-pte_offset_kernel +4
-0+config HIGHPTE + def_bool y + depends on HIGHMEM +
Make this a selectable option and mark it EXPERIMENTAL or something. I wouldn't be surprised if some of our stuff bitrotted. Also I very much doubt BookE 32-bit will cope with HIGHPTE since the TLB miss code runs in virtual mode with only the linear mapping guaranteed to be available and it's not re-entrant.
So at the very least, make it depends on 6xx and also mark it EXPERIMENTAL.
Also, iirc (I'll have to dbl check), our recent changes to enable freeing of PTE pages using RCU may have broken HIGHPTE due to abuse of page_address() on PTE pages. Nothing unfixable but another reason not to unconditionally enable it.
Cheers,
Ben.
RFC PATCH 35/35 remove old ptemap.h includes
In reply to Dave HansenNow that we're directly including ptemap.h everywhere we need it we no longer need the includes from all the various arch headers. Kill them.
---
linux-2.6.git-dave/arch/alpha/include/asm/pgtable.h | 2 +- linux-2.6.git-dave/arch/arm/include/asm/pgtable.h | 2 -- linux-2.6.git-dave/arch/cris/include/asm/pgtable.h | 1 - linux-2.6.git-dave/arch/frv/include/asm/pgtable.h | 2 -- linux-2.6.git-dave/arch/ia64/include/asm/pgtable.h | 2 -- linux-2.6.git-dave/arch/m32r/include/asm/pgtable.h | 1 - linux-2.6.git-dave/arch/m68k/include/asm/motorola_pgtable.h | 2 -- linux-2.6.git-dave/arch/m68k/include/asm/sun3_pgtable.h | 3 --- linux-2.6.git-dave/arch/mips/include/asm/pgtable-32.h | 1 - linux-2.6.git-dave/arch/mips/include/asm/pgtable-64.h | 1 - linux-2.6.git-dave/arch/mn10300/include/asm/pgtable.h | 2 -- linux-2.6.git-dave/arch/parisc/include/asm/pgtable.h | 2 -- linux-2.6.git-dave/arch/powerpc/include/asm/pgtable-ppc64.h | 2 -- linux-2.6.git-dave/arch/s390/include/asm/pgtable.h | 2 -- linux-2.6.git-dave/arch/sh/include/asm/pgtable_32.h | 1 - linux-2.6.git-dave/arch/sh/include/asm/pgtable_64.h | 2 -- linux-2.6.git-dave/arch/sparc/include/asm/pgtable_32.h | 2 -- linux-2.6.git-dave/arch/sparc/include/asm/pgtable_64.h | 2 -- linux-2.6.git-dave/arch/um/include/asm/pgtable.h | 1 - linux-2.6.git-dave/arch/x86/include/asm/pgtable_32.h | 2 -- linux-2.6.git-dave/arch/x86/include/asm/pgtable_64.h | 2 -- 21 files changed, 1 insertion(+), 36 deletions(-)
arch/alpha/include/asm/pgtable.h renamed from arch/alpha/include/asm/pgtable.h~remove-old-ptemap-includes +1 -1
@@ -317,7 +317,7 @@ extern inline pte_t * pte_offset_kernel(return ret; } -#inclue <asm/ptemap.h> +#include <asm/ptemap.h> extern pgd_t swapper_pg_dir[1024 ];
arch/arm/include/asm/pgtable.h renamed from arch/arm/include/asm/pgtable.h~remove-old-ptemap-includes +0 -2
@@ -265,8 +265,6 @@ extern struct page *empty_zero_page;#define pte_page (pte) (pfn_to_page(pte_pfn(pte)))#define pte_offset_kernel (dir,addr) (pmd_page_vaddr(*(dir)) + pte_index(addr)) -#include <asm/ptemap.h> -#define set_pte_ext (ptep,pte,ext) cpu_set_pte_ext(ptep,pte,ext)#define set_pte_at (mm,addr,ptep,pteval) do { \
arch/cris/include/asm/pgtable.h renamed from arch/cris/include/asm/pgtable.h~remove-old-ptemap-includes +0 -1
@@ -244,7 +244,6 @@ static inline pgd_t * pgd_offset(const s (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))#define pte_offset_kernel (dir, address) \ ((pte_t *) pmd_page_vaddr(*(dir)) + __pte_offset(address)) -#include <asm/ptemap.h> #define pte_pfn (x) ((unsigned long)(__va((x).pte)) >> PAGE_SHIFT)#define pfn_pte (pfn, prot) __pte(((pfn) << PAGE_SHIFT) | pgprot_val(prot))
arch/frv/include/asm/pgtable.h renamed from arch/frv/include/asm/pgtable.h~remove-old-ptemap-includes +0 -2
@@ -449,8 +449,6 @@ static inline pte_t pte_modify(pte_t pte#define pte_offset_kernel (dir, address) \ ((pte_t *) pmd_page_vaddr(*(dir)) + pte_index(address)) -#include <asm/ptemap.h> -/* * Handle swap and file entries * - the PTE is encoded in the following format:
arch/ia64/include/asm/pgtable.h renamed from arch/ia64/include/asm/pgtable.h~remove-old-ptemap-includes +0 -2
@@ -406,8 +406,6 @@ pgd_offset (const struct mm_struct *mm,#define pte_index (addr) (((addr) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))#define pte_offset_kernel (dir,addr) ((pte_t *) pmd_page_vaddr(*(dir)) + pte_index(addr)) -#include <asm/ptemap.h> -/* atomic versions of the some PTE manipulations: */ static inline int
arch/m32r/include/asm/pgtable.h renamed from arch/m32r/include/asm/pgtable.h~remove-old-ptemap-includes +0 -1
@@ -330,7 +330,6 @@ static inline void pmd_set(pmd_t * pmdp, (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))#define pte_offset_kernel (dir, address) \ ((pte_t *)pmd_page_vaddr(*(dir)) + pte_index(address)) -#include <asm/ptemap.h> /* Encode and de-code a swap entry */ #define __swp_type (x) (((x).val >> 2) & 0x1f)
arch/m68k/include/asm/motorola_pgtable.h renamed from arch/m68k/include/asm/motorola_pgtable.h~remove-old-ptemap-includes +0 -2
@@ -220,8 +220,6 @@ static inline pte_t *pte_offset_kernel(preturn (pte_t *)__pmd_page (*pmdp) + ((address >>PAGE_SHIFT ) & (PTRS_PER_PTE -1 )); } -#include <asm/ptemap.h> -/* * Allocate and free page tables. The xxx_kernel() versions are * used to allocate a kernel page table - this turns on ASN bits
arch/m68k/include/asm/sun3_pgtable.h renamed from arch/m68k/include/asm/sun3_pgtable.h~remove-old-ptemap-includes +0 -3
@@ -217,9 +217,6 @@ static inline pte_t pgoff_to_pte(unsigne/* Find an entry in the third-level pagetable. */ #define pte_index (address) ((address >> PAGE_SHIFT) & (PTRS_PER_PTE-1))#define pte_offset_kernel (pmd, address) ((pte_t *) __pmd_page(*pmd) + pte_index(address)) -/* FIXME: should we bother with kmap() here? */ - -#include <asm/ptemap.h> /* Macros to (de)construct the fake PTEs representing swap pages. */ #define __swp_type (x) ((x).val & 0x7F)
arch/mips/include/asm/pgtable-32.h renamed from arch/mips/include/asm/pgtable-32.h~remove-old-ptemap-includes +0 -1
@@ -150,7 +150,6 @@ pfn_pte(unsigned long pfn, pgprot_t prot#define pte_offset (dir, address) \ ((pte_t *) pmd_page_vaddr(*(dir)) + __pte_offset(address))#define pte_offset_kernel (dir, address) pte_offset(dir, address) -#include <asm/ptemap.h> #if defined(CONFIG_CPU_R3000 ) || defined(CONFIG_CPU_TX39XX )
arch/mips/include/asm/pgtable-64.h renamed from arch/mips/include/asm/pgtable-64.h~remove-old-ptemap-includes +0 -1
@@ -214,7 +214,6 @@ static inline pmd_t *pmd_offset(pud_t *#define pte_offset (dir, address) \ ((pte_t *) pmd_page_vaddr(*(dir)) + __pte_offset(address))#define pte_offset_kernel (dir, address) pte_offset(dir, address) -#include <asm/ptemap.h> /* * Initialize a new pgd / pmd table with invalid pointers. */
arch/mn10300/include/asm/pgtable.h renamed from arch/mn10300/include/asm/pgtable.h~remove-old-ptemap-includes +0 -2
@@ -455,8 +455,6 @@ static inline int set_kernel_exec(unsignreturn 0 ; } -#include <asm/ptemap.h> -/* * The MN10300 has external MMU info in the form of a TLB: this is adapted from * the kernel page tables containing the necessary information by tlb-mn10300.S
arch/parisc/include/asm/pgtable.h renamed from arch/parisc/include/asm/pgtable.h~remove-old-ptemap-includes +0 -2
@@ -397,8 +397,6 @@ static inline pte_t pte_modify(pte_t pte#define pte_offset_kernel (pmd, address) \ ((pte_t *) pmd_page_vaddr(*(pmd)) + pte_index(address)) -#include <asm/ptemap.h> -extern void paging_init (void );/* Used for deferring calls to flush_dcache_page() */
arch/powerpc/include/asm/pgtable-ppc64.h renamed from arch/powerpc/include/asm/pgtable-ppc64.h~remove-old-ptemap-includes +0 -2
@@ -162,8 +162,6 @@#define pte_offset_kernel (dir,addr) \ (((pte_t *) pmd_page_vaddr(*(dir))) + (((addr) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))) -#include <asm/ptemap.h> -/* to find an entry in a kernel page-table-directory */ /* This now only contains the vmalloc pages */ #define pgd_offset_k (address) pgd_offset(&init_mm, address)
arch/s390/include/asm/pgtable.h renamed from arch/s390/include/asm/pgtable.h~remove-old-ptemap-includes +0 -2
@@ -1041,8 +1041,6 @@ static inline pmd_t *pmd_offset(pud_t *p#define pte_offset (pmd, addr) ((pte_t *) pmd_deref(*(pmd)) + pte_index(addr))#define pte_offset_kernel (pmd, address) pte_offset(pmd,address) -#include <asm/ptemap.h> -/* * 31 bit swap entry format: * A page-table entry has some bits we have to treat in a special way.
arch/sh/include/asm/pgtable_32.h renamed from arch/sh/include/asm/pgtable_32.h~remove-old-ptemap-includes +0 -1
@@ -403,7 +403,6 @@ static inline pte_t pte_modify(pte_t pte#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)) -#include <asm/ptemap.h> #ifdef CONFIG_X2TLB #define pte_ERROR (e) \
arch/sh/include/asm/pgtable_64.h renamed from arch/sh/include/asm/pgtable_64.h~remove-old-ptemap-includes +0 -2
@@ -83,8 +83,6 @@ static __inline__ void pmd_set(pmd_t *pm#define pte_offset_kernel (dir, addr) \ ((pte_t *) ((pmd_val(*(dir))) & PAGE_MASK) + pte_index((addr))) -#include <asm/ptemap.h> -#ifndef __ASSEMBLY__#define IOBASE_VADDR 0xff000000#define IOBASE_END 0xffffffff
arch/sparc/include/asm/pgtable_32.h renamed from arch/sparc/include/asm/pgtable_32.h~remove-old-ptemap-includes +0 -2
@@ -300,8 +300,6 @@ BTFIXUPDEF_CALL(pmd_t *, pmd_offset, pgd BTFIXUPDEF_CALL(pte_t *, pte_offset_kernel, pmd_t *, unsigned long)#define pte_offset_kernel (dir,addr) BTFIXUP_CALL(pte_offset_kernel)(dir,addr) -#include <asm/ptemap.h> - BTFIXUPDEF_CALL(void, set_pte, pte_t *, pte_t)#define set_pte (ptep,pteval) BTFIXUP_CALL(set_pte)(ptep,pteval)
arch/sparc/include/asm/pgtable_64.h renamed from arch/sparc/include/asm/pgtable_64.h~remove-old-ptemap-includes +0 -2
@@ -652,8 +652,6 @@ static inline int pte_special(pte_t pte)/* Find an entry in the third-level page table.. */ #define pte_offset_kernel (dir, address) \ ((pte_t *)pmd_page_vaddr(*(dir)) + pte_index(address)) -#include <asm/ptemap.h> -/* Actual page table PTE updates. */ extern void tlb_batch_add (struct mm_struct *mm,unsigned long vaddr,pte_t *ptep,pte_t orig);
arch/um/include/asm/pgtable.h renamed from arch/um/include/asm/pgtable.h~remove-old-ptemap-includes +0 -1
@@ -331,7 +331,6 @@ static inline pte_t pte_modify(pte_t pte#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)) -#include <asm/ptemap.h> struct mm_struct ;extern pte_t *virt_to_pte (struct mm_struct *mm,unsigned long addr);
arch/x86/include/asm/pgtable_32.h renamed from arch/x86/include/asm/pgtable_32.h~remove-old-ptemap-includes +0 -2
@@ -48,8 +48,6 @@ extern void set_pmd_pfn(unsigned long, u# include <asm/pgtable-2level.h> #endif -#include <asm/ptemap.h> -/* Clear a kernel PTE and flush it from the TLB */ #define kpte_clear_flush (ptep, vaddr) \ do { \
arch/x86/include/asm/pgtable_64.h renamed from arch/x86/include/asm/pgtable_64.h~remove-old-ptemap-includes +0 -2
@@ -127,8 +127,6 @@ static inline int pgd_large(pgd_t pgd) {/* PTE - Level 1 access. */ -#include <asm/ptemap.h> -#define update_mmu_cache (vma, address, pte) do { } while (0)extern int direct_gbpages;
_
Re: [RFC][PATCH 35/35] remove old ptemap.h includes
arch/alpha/include/asm/pgtable.h extern inline pte_t * pte_offset_kernel( · line 320
Quoted 7 lines · Dave Hansen
+++
linux-2.6.git-dave/arch/alpha/include/asm/pgtable.h2009-04-30 15:11:13.000000000 -0700arch/alpha/include/asm/pgtable.h renamed from arch/alpha/include/asm/pgtable.h~remove-old-ptemap-includes +1
-1@@ -317,7 +317,7 @@ extern inline pte_t * pte_offset_kernel(return ret; } -#inclue <asm/ptemap.h> +#include <asm/ptemap.h>
that typo fix should be backmerged to earlier in the series i guess.
Ingo
Re: [RFC][PATCH 35/35] remove old ptemap.h includes
Quoted 4 lines · Ingo Molnar
Quoted 1 line · Dave Hansen
+++
linux-2.6.git-dave/arch/alpha/include/asm/pgtable.h2009-04-30
15:11:13.000000000 -0700
Quoted 8 lines
arch/alpha/include/asm/pgtable.h extern inline pte_t * pte_offset_kernel( · line 320
Quoted 6 lines
arch/alpha/include/asm/pgtable.h renamed from arch/alpha/include/asm/pgtable.h~remove-old-ptemap-includes +1
-1@@ -317,7 +317,7 @@ extern inline pte_t * pte_offset_kernel(return ret; } -#inclue <asm/ptemap.h> +#include <asm/ptemap.h> that typo fix should be backmerged to earlier in the series i guess.
Whoops. Got it now, thanks.
-- Dave