ARC: mm: remove __ARCH_USE_5LEVEL_HACK
Subsystems (2)
PATCH 1/1 ARC: mm: remove __ARCH_USE_5LEVEL_HACK
Add the intermediate p4d accessors to make it 5 level compliant.
Thi sis non-functional change anyways since ARC has software page walker with 2 lookup levels (pgd -> pte)
--- arch/arc/include/asm/pgtable.h | 1 - arch/arc/mm/fault.c | 10 ++++++++-- 2 files changed, 8 insertions(+), 3 deletions(-)
arch/arc/include/asm/pgtable.h +0 -1
@@ -33,7 +33,6 @@#define _ASM_ARC_PGTABLE_H#include <linux/bits.h> -#define __ARCH_USE_5LEVEL_HACK#include <asm-generic/pgtable-nopmd.h> #include <asm/page.h> #include <asm/mmu.h> /* to propagate CONFIG_ARC_MMU_VER <n> */
arch/arc/mm/fault.c +8 -2
@@ -30,6 +30,7 @@ noinline static int handle_kernel_vaddr_fault(unsigned long address)* with the 'reference' page table. */ pgd_t *pgd, *pgd_k; +p4d_t *p4d, *p4d_k;pud_t *pud, *pud_k;pmd_t *pmd, *pmd_k;
@@ -39,8 +40,13 @@ noinline static int handle_kernel_vaddr_fault(unsigned long address)if (!pgd_present (*pgd_k)) goto bad_area; - pud =pud_offset (pgd, address); - pud_k =pud_offset (pgd_k, address); + p4d =p4d_offset (pgd, address); + p4d_k =p4d_offset (pgd_k, address); +if (!p4d_present (*p4d_k)) + goto bad_area; + + pud =pud_offset (p4d, address); + pud_k =pud_offset (p4d_k, address);if (!pud_present (*pud_k)) goto bad_area;
Signature · 1 line
2.20.1
Quoted 3 lines · Vineet Gupta
Add the intermediate p4d accessors to make it 5 level compliant.
Thi sis non-functional change anyways since ARC has software page walker
^
Typo.Quoted 7 lines
with 2 lookup levels (pgd -> pte)
Signed-off-by Vineet Gupta <vgupta at synopsys.com>--- arch/arc/include/asm/pgtable.h | 1 - arch/arc/mm/fault.c | 10 ++++++++-- 2 files changed, 8 insertions(+), 3 deletions(-)
Have you tested it with CONFIG_HIGHMEM=y? alloc_kmap_pgtable() has to be converted too.
Signature · 1 line
Kirill A. Shutemov
Quoted 6 lines · Kirill A. Shutemov
Quoted 3 lines · Vineet Gupta
Add the intermediate p4d accessors to make it 5 level compliant.
Thi sis non-functional change anyways since ARC has software page walker
^ Typo.
Oops, fixed now !
...
Quoted 2 lines
Have you tested it with
CONFIG_HIGHMEM=y?alloc_kmap_pgtable()has to be converted too.
No I didn't. Fixed that as well.
Thx for looking
-Vineet
PATCH v2 1/1 ARC: mm: remove __ARCH_USE_5LEVEL_HACK
Add the intermediate p4d accessors to make it 5 level compliant.
This is a non-functional change anyways since ARC has software page walker with 2 lookup levels (pgd -> pte)
There is slight code bloat due to pulling in needless p*d_free_tlb() macros which needs to be addressed seperately.
| bloat-o-meter2 vmlinux-with-5LEVEL_HACK vmlinux-patched | add/remove: 0/0 grow/shrink: 2/0 up/down: 128/0 (128) | function old new delta | free_pgd_range 546 656 +110 | p4d_clear_bad 2 20 +18 | Total: Before=4137148, After=4137276, chg 0.000000%
---
v2 <- v1:
- fix highmem code
--- arch/arc/include/asm/pgtable.h | 1 - arch/arc/mm/fault.c | 10 ++++++++-- arch/arc/mm/highmem.c | 4 +++- 3 files changed, 11 insertions(+), 4 deletions(-)
arch/arc/include/asm/pgtable.h +0 -1
@@ -33,7 +33,6 @@#define _ASM_ARC_PGTABLE_H#include <linux/bits.h> -#define __ARCH_USE_5LEVEL_HACK#include <asm-generic/pgtable-nopmd.h> #include <asm/page.h> #include <asm/mmu.h> /* to propagate CONFIG_ARC_MMU_VER <n> */
arch/arc/mm/fault.c +8 -2
@@ -30,6 +30,7 @@ noinline static int handle_kernel_vaddr_fault(unsigned long address)* with the 'reference' page table. */ pgd_t *pgd, *pgd_k; +p4d_t *p4d, *p4d_k;pud_t *pud, *pud_k;pmd_t *pmd, *pmd_k;
@@ -39,8 +40,13 @@ noinline static int handle_kernel_vaddr_fault(unsigned long address)if (!pgd_present (*pgd_k)) goto bad_area; - pud =pud_offset (pgd, address); - pud_k =pud_offset (pgd_k, address); + p4d =p4d_offset (pgd, address); + p4d_k =p4d_offset (pgd_k, address); +if (!p4d_present (*p4d_k)) + goto bad_area; + + pud =pud_offset (p4d, address); + pud_k =pud_offset (p4d_k, address);if (!pud_present (*pud_k)) goto bad_area;
arch/arc/mm/highmem.c +3 -1
@@ -111,12 +111,14 @@ EXPORT_SYMBOL(__kunmap_atomic); static noinline pte_t * __init alloc_kmap_pgtable(unsigned long kvaddr) {pgd_t *pgd_k; +p4d_t *p4d_k;pud_t *pud_k;pmd_t *pmd_k;pte_t *pte_k; pgd_k =pgd_offset_k (kvaddr); - pud_k =pud_offset (pgd_k, kvaddr); + p4d_k =p4d_offset (pgd_k, address); + pud_k =pud_offset (p4d_k, kvaddr); pmd_k =pmd_offset (pud_k, kvaddr); pte_k = (pte_t *)memblock_alloc_low (PAGE_SIZE ,PAGE_SIZE );
Signature · 1 line
2.20.1
PATCH v3 1/1 ARC: mm: remove __ARCH_USE_5LEVEL_HACK
Add the intermediate p4d accessors to make it 5 level compliant.
This is a non-functional change anyways since ARC has software page walker with 2 lookup levels (pgd -> pte)
There is slight code bloat due to pulling in needless p*d_free_tlb() macros which needs to be addressed seperately.
| bloat-o-meter2 vmlinux-with-5LEVEL_HACK vmlinux-patched | add/remove: 0/0 grow/shrink: 2/0 up/down: 128/0 (128) | function old new delta | free_pgd_range 546 656 +110 | p4d_clear_bad 2 20 +18 | Total: Before=4137148, After=4137276, chg 0.000000%
---
v3 <- v2
- fix highmem build error
v2 <- v1
- fix highmem code
--- arch/arc/include/asm/pgtable.h | 1 - arch/arc/mm/fault.c | 10 ++++++++-- arch/arc/mm/highmem.c | 4 +++- 3 files changed, 11 insertions(+), 4 deletions(-)
arch/arc/include/asm/pgtable.h +0 -1
@@ -33,7 +33,6 @@#define _ASM_ARC_PGTABLE_H#include <linux/bits.h> -#define __ARCH_USE_5LEVEL_HACK#include <asm-generic/pgtable-nopmd.h> #include <asm/page.h> #include <asm/mmu.h> /* to propagate CONFIG_ARC_MMU_VER <n> */
arch/arc/mm/fault.c +8 -2
@@ -30,6 +30,7 @@ noinline static int handle_kernel_vaddr_fault(unsigned long address)* with the 'reference' page table. */ pgd_t *pgd, *pgd_k; +p4d_t *p4d, *p4d_k;pud_t *pud, *pud_k;pmd_t *pmd, *pmd_k;
@@ -39,8 +40,13 @@ noinline static int handle_kernel_vaddr_fault(unsigned long address)if (!pgd_present (*pgd_k)) goto bad_area; - pud =pud_offset (pgd, address); - pud_k =pud_offset (pgd_k, address); + p4d =p4d_offset (pgd, address); + p4d_k =p4d_offset (pgd_k, address); +if (!p4d_present (*p4d_k)) + goto bad_area; + + pud =pud_offset (p4d, address); + pud_k =pud_offset (p4d_k, address);if (!pud_present (*pud_k)) goto bad_area;
arch/arc/mm/highmem.c +3 -1
@@ -111,12 +111,14 @@ EXPORT_SYMBOL(__kunmap_atomic); static noinline pte_t * __init alloc_kmap_pgtable(unsigned long kvaddr) {pgd_t *pgd_k; +p4d_t *p4d_k;pud_t *pud_k;pmd_t *pmd_k;pte_t *pte_k; pgd_k =pgd_offset_k (kvaddr); - pud_k =pud_offset (pgd_k, kvaddr); + p4d_k =p4d_offset (pgd_k, kvaddr); + pud_k =pud_offset (p4d_k, kvaddr); pmd_k =pmd_offset (pud_k, kvaddr); pte_k = (pte_t *)memblock_alloc_low (PAGE_SIZE ,PAGE_SIZE );
Signature · 1 line
2.20.1
Quoted 15 lines · Vineet Gupta
Add the intermediate p4d accessors to make it 5 level compliant.
This is a non-functional change anyways since ARC has software page walker with 2 lookup levels (pgd -> pte)
There is slight code bloat due to pulling in needless p*d_free_tlb() macros which needs to be addressed seperately.
| bloat-o-meter2 vmlinux-with-5LEVEL_HACK vmlinux-patched | add/remove: 0/0 grow/shrink: 2/0 up/down: 128/0 (128) | function old new delta | free_pgd_range 546 656 +110 | p4d_clear_bad 2 20 +18 | Total: Before=4137148, After=4137276, chg 0.000000%
Quoted 2 lines
Cc Kirill A. Shutemov <kirill.shutemov at linux.intel.com>Signed-off-by Vineet Gupta <vgupta at synopsys.com>
Signature · 1 line
Kirill A. Shutemov
Quoted 15 lines · Vineet Gupta
Add the intermediate p4d accessors to make it 5 level compliant.
This is a non-functional change anyways since ARC has software page walker with 2 lookup levels (pgd -> pte)
There is slight code bloat due to pulling in needless p*d_free_tlb() macros which needs to be addressed seperately.
| bloat-o-meter2 vmlinux-with-5LEVEL_HACK vmlinux-patched | add/remove: 0/0 grow/shrink: 2/0 up/down: 128/0 (128) | function old new delta | free_pgd_range 546 656 +110 | p4d_clear_bad 2 20 +18 | Total: Before=4137148, After=4137276, chg 0.000000%
Quoted 2 lines
Cc Kirill A. Shutemov <[email protected]>Signed-off-by Vineet Gupta <[email protected]>
Quoted 76 lines
---
v3 <- v2
- fix highmem build errorv2 <- v1
- fix highmem code--- arch/arc/include/asm/pgtable.h | 1 - arch/arc/mm/fault.c | 10 ++++++++-- arch/arc/mm/highmem.c | 4 +++- 3 files changed, 11 insertions(+), 4 deletions(-)arch/arc/include/asm/pgtable.h +0
-1@@ -33,7 +33,6 @@#define _ASM_ARC_PGTABLE_H#include <linux/bits.h> -#define __ARCH_USE_5LEVEL_HACK#include <asm-generic/pgtable-nopmd.h> #include <asm/page.h> #include <asm/mmu.h> /* to propagate CONFIG_ARC_MMU_VER <n> */ arch/arc/mm/fault.c +8
-2@@ -30,6 +30,7 @@ noinline static int handle_kernel_vaddr_fault(unsigned long address)* with the 'reference' page table. */ pgd_t *pgd, *pgd_k; +p4d_t *p4d, *p4d_k;pud_t *pud, *pud_k;pmd_t *pmd, *pmd_k;@@ -39,8 +40,13 @@ noinline static int handle_kernel_vaddr_fault(unsigned long address)if (!pgd_present (*pgd_k)) goto bad_area; - pud =pud_offset (pgd, address); - pud_k =pud_offset (pgd_k, address); + p4d =p4d_offset (pgd, address); + p4d_k =p4d_offset (pgd_k, address); +if (!p4d_present (*p4d_k)) + goto bad_area; + + pud =pud_offset (p4d, address); + pud_k =pud_offset (p4d_k, address);if (!pud_present (*pud_k)) goto bad_area;arch/arc/mm/highmem.c +3
-1@@ -111,12 +111,14 @@ EXPORT_SYMBOL(__kunmap_atomic); static noinline pte_t * __init alloc_kmap_pgtable(unsigned long kvaddr) {pgd_t *pgd_k; +p4d_t *p4d_k;pud_t *pud_k;pmd_t *pmd_k;pte_t *pte_k; pgd_k =pgd_offset_k (kvaddr); - pud_k =pud_offset (pgd_k, kvaddr); + p4d_k =p4d_offset (pgd_k, kvaddr); + pud_k =pud_offset (p4d_k, kvaddr); pmd_k =pmd_offset (pud_k, kvaddr); pte_k = (pte_t *)memblock_alloc_low (PAGE_SIZE ,PAGE_SIZE );Signature · 1 line
2.20.1
Signature · 2 lines
Sincerely yours, Mike.