Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

Commit cf53564

Browse files
kvaneeshmpe
authored andcommitted
powerpc/mm/book3s64/hash/4k: Add pmd_same callback for 4K page size
With commit 0d940a9 ("mm/pgtable: allow pte_offset_map[_lock]() to fail") the kernel is now using pmd_same to compare pmd values that are pointing to a level 4 page table page. Move the functions out of #ifdef CONFIG_TRANSPARENT_HUGEPAGE and add a variant that can work with both 4K and 64K page size. kernel BUG at arch/powerpc/include/asm/book3s/64/hash-4k.h:141! Oops: Exception in kernel mode, sig: 5 [#1] LE PAGE_SIZE=4K MMU=Hash SMP NR_CPUS=2048 NUMA pSeries ..... NIP [c00000000048aee0] __pte_offset_map_lock+0xf0/0x164 LR [c00000000048ae78] __pte_offset_map_lock+0x88/0x164 Call Trace: 0xc0003f000009a340 (unreliable) __handle_mm_fault+0x1340/0x1980 handle_mm_fault+0xbc/0x380 __get_user_pages+0x320/0x550 get_user_pages_remote+0x13c/0x520 get_arg_page+0x80/0x1d0 copy_string_kernel+0xc8/0x250 kernel_execve+0x11c/0x270 run_init_process+0xe4/0x10c kernel_init+0xbc/0x1a0 ret_from_kernel_user_thread+0x14/0x1c Reported-by: Michael Ellerman <[email protected]> Signed-off-by: "Aneesh Kumar K.V" <[email protected]> Acked-by: Hugh Dickins <[email protected]> Signed-off-by: Michael Ellerman <[email protected]> Link: https://msgid.link/[email protected]
1 parent cf65b12 commit cf53564

File tree

3 files changed

+5
-11
lines changed

3 files changed

+5
-11
lines changed

arch/powerpc/include/asm/book3s/64/hash-4k.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -136,12 +136,6 @@ static inline int hash__pmd_trans_huge(pmd_t pmd)
136136
return 0;
137137
}
138138

139-
static inline int hash__pmd_same(pmd_t pmd_a, pmd_t pmd_b)
140-
{
141-
BUG();
142-
return 0;
143-
}
144-
145139
static inline pmd_t hash__pmd_mkhuge(pmd_t pmd)
146140
{
147141
BUG();

arch/powerpc/include/asm/book3s/64/hash-64k.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -263,11 +263,6 @@ static inline int hash__pmd_trans_huge(pmd_t pmd)
263263
(_PAGE_PTE | H_PAGE_THP_HUGE));
264264
}
265265

266-
static inline int hash__pmd_same(pmd_t pmd_a, pmd_t pmd_b)
267-
{
268-
return (((pmd_raw(pmd_a) ^ pmd_raw(pmd_b)) & ~cpu_to_be64(_PAGE_HPTEFLAGS)) == 0);
269-
}
270-
271266
static inline pmd_t hash__pmd_mkhuge(pmd_t pmd)
272267
{
273268
return __pmd(pmd_val(pmd) | (_PAGE_PTE | H_PAGE_THP_HUGE));

arch/powerpc/include/asm/book3s/64/hash.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,11 @@ static inline int get_region_id(unsigned long ea)
132132
return region_id;
133133
}
134134

135+
static inline int hash__pmd_same(pmd_t pmd_a, pmd_t pmd_b)
136+
{
137+
return (((pmd_raw(pmd_a) ^ pmd_raw(pmd_b)) & ~cpu_to_be64(_PAGE_HPTEFLAGS)) == 0);
138+
}
139+
135140
#define hash__pmd_bad(pmd) (pmd_val(pmd) & H_PMD_BAD_BITS)
136141
#define hash__pud_bad(pud) (pud_val(pud) & H_PUD_BAD_BITS)
137142
static inline int hash__p4d_bad(p4d_t p4d)

0 commit comments

Comments
 (0)