linux/arch/loongarch/mm
Bibo Mao d2f8671045 LoongArch: Set initial pte entry with PAGE_GLOBAL for kernel space
There are two pages in one TLB entry on LoongArch system. For kernel
space, it requires both two pte entries (buddies) with PAGE_GLOBAL bit
set, otherwise HW treats it as non-global tlb, there will be potential
problems if tlb entry for kernel space is not global. Such as fail to
flush kernel tlb with the function local_flush_tlb_kernel_range() which
supposed only flush tlb with global bit.

Kernel address space areas include percpu, vmalloc, vmemmap, fixmap and
kasan areas. For these areas both two consecutive page table entries
should be enabled with PAGE_GLOBAL bit. So with function set_pte() and
pte_clear(), pte buddy entry is checked and set besides its own pte
entry. However it is not atomic operation to set both two pte entries,
there is problem with test_vmalloc test case.

So function kernel_pte_init() is added to init a pte table when it is
created for kernel address space, and the default initial pte value is
PAGE_GLOBAL rather than zero at beginning. Then only its own pte entry
need update with function set_pte() and pte_clear(), nothing to do with
the pte buddy entry.

Signed-off-by: Bibo Mao <maobibo@loongson.cn>
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
2024-10-21 22:11:19 +08:00
..
cache.c LoongArch: Remove shm_align_mask and use SHMLBA instead 2023-09-06 22:53:09 +08:00
extable.c LoongArch: BPF: Add BPF exception tables 2022-12-14 08:36:11 +08:00
fault.c LoongArch: Improve hardware page table walker 2024-09-24 15:32:20 +08:00
hugetlbpage.c LoongArch: Use accessors to page table entries instead of direct dereference 2024-08-07 17:37:11 +08:00
init.c LoongArch: Set initial pte entry with PAGE_GLOBAL for kernel space 2024-10-21 22:11:19 +08:00
ioremap.c LoongArch: Fix some build warnings with W=1 2023-09-20 14:26:28 +08:00
kasan_init.c LoongArch: Use accessors to page table entries instead of direct dereference 2024-08-07 17:37:11 +08:00
maccess.c
Makefile LoongArch: Add ARCH_HAS_SET_MEMORY support 2024-09-24 15:32:20 +08:00
mmap.c mm: make arch_get_unmapped_area() take vm_flags by default 2024-09-09 16:39:13 -07:00
page.S LoongArch: Replace #include <asm/export.h> with #include <linux/export.h> 2023-08-25 23:40:26 +08:00
pageattr.c LoongArch: Add ARCH_HAS_SET_DIRECT_MAP support 2024-09-24 15:32:20 +08:00
pgtable.c LoongArch: Set initial pte entry with PAGE_GLOBAL for kernel space 2024-10-21 22:11:19 +08:00
tlb.c LoongArch: Add ORC stack unwinder support 2024-03-11 22:23:47 +08:00
tlbex.S LoongArch: Give a chance to build with !CONFIG_SMP 2024-05-14 12:24:18 +08:00