linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/3] LoongArch: Fix vmalloc test issue
@ 2024-10-14  3:58 Bibo Mao
  2024-10-14  3:58 ` [PATCH v2 1/3] LoongArch: Set initial pte entry with PAGE_GLOBAL for kernel space Bibo Mao
                   ` (2 more replies)
  0 siblings, 3 replies; 21+ messages in thread
From: Bibo Mao @ 2024-10-14  3:58 UTC (permalink / raw)
  To: Huacai Chen, Andrey Ryabinin, Andrew Morton
  Cc: David Hildenbrand, Barry Song, loongarch, linux-kernel,
	kasan-dev, linux-mm

On LoongArch 3C5000 Dual-Way machine, there are 32 CPUs and 128G RAM,
there are some errors with run vmalloc test with command like this
  insmod test_vmalloc.ko   nr_threads=32  run_test_mask=0x3af

Here is part of error message and summary test report for failed cases:
 WARNING: CPU: 13 PID: 1457 at mm/vmalloc.c:503 vmap_small_pages_range_noflush+0x388/0x510
 CPU: 13 UID: 0 PID: 1457 Comm: vmalloc_test/15 Not tainted 6.12.0-rc2+ #93

 Trying to vfree() nonexistent vm area (000000004dec9ced)
 WARNING: CPU: 3 PID: 1444 at mm/vmalloc.c:3345 vfree+0x1e8/0x4c8
 CPU: 3 UID: 0 PID: 1444 Comm: vmalloc_test/2

 Trying to vfree() bad address (00000000fc7c9da5)
 WARNING: CPU: 10 PID: 1552 at mm/vmalloc.c:3210 remove_vm_area+0x88/0x98
 CPU: 10 UID: 0 PID: 1552 Comm: kworker/u144:3

Summary: long_busy_list_alloc_test passed: 0 failed: 1 repeat: 1 loops: 1000000
Summary: long_busy_list_alloc_test passed: 0 failed: 1 repeat: 1 loops: 1000000
Summary: random_size_alloc_test passed: 0 failed: 1 repeat: 1 loops: 1000000
Summary: random_size_align_alloc_test passed: 0 failed: 1 repeat: 1 loops: 1000000
Summary: kvfree_rcu_2_arg_vmalloc_test passed: 0 failed: 1 repeat: 1 loops: 1000000
Summary: long_busy_list_alloc_test passed: 0 failed: 1 repeat: 1 loops: 1000000
Summary: random_size_align_alloc_test passed: 0 failed: 1 repeat: 1 loops: 1000000
Summary: fix_size_alloc_test passed: 0 failed: 1 repeat: 1 loops: 1000000
Summary: random_size_alloc_test passed: 0 failed: 1 repeat: 1 loops: 1000000
Summary: random_size_align_alloc_test passed: 0 failed: 1 repeat: 1 loops: 1000000
Summary: long_busy_list_alloc_test passed: 0 failed: 1 repeat: 1 loops: 1000000
Summary: random_size_align_alloc_test passed: 0 failed: 1 repeat: 1 loops: 1000000
Summary: long_busy_list_alloc_test passed: 0 failed: 1 repeat: 1 loops: 1000000
Summary: long_busy_list_alloc_test passed: 0 failed: 1 repeat: 1 loops: 1000000
Summary: long_busy_list_alloc_test passed: 0 failed: 1 repeat: 1 loops: 1000000
Summary: kvfree_rcu_2_arg_vmalloc_test passed: 0 failed: 1 repeat: 1 loops: 1000000
Summary: long_busy_list_alloc_test passed: 0 failed: 1 repeat: 1 loops: 1000000
Summary: random_size_alloc_test passed: 0 failed: 1 repeat: 1 loops: 1000000
Summary: kvfree_rcu_1_arg_vmalloc_test passed: 0 failed: 1 repeat: 1 loops: 1000000
Summary: long_busy_list_alloc_test passed: 0 failed: 1 repeat: 1 loops: 1000000
Summary: fix_size_alloc_test passed: 0 failed: 1 repeat: 1 loops: 1000000
Summary: long_busy_list_alloc_test passed: 0 failed: 1 repeat: 1 loops: 1000000

The mainly problem is that function set_pte() and pte_free() is not atomic,
since these functions need modify two consecutive pte entries for kernel
space area to assure that both pte entries with PAGE_GLOBAL bit set. And
there is contension problem between them.

With this patchset, vmalloc test case passes to run with command
  insmod test_vmalloc.ko   nr_threads=32  run_test_mask=0x3af

---
  v1 ... v2:
    1. Solve compile warning issue by declaring function
       kernel_pte_init() in header file include/linux/mm.h
    2. Add kernel_pte_init() in function zero_pmd_populate() called by
       file mm/kasan/init.c
    3. Merge the first two patches into one since both these two patches
       set pte entry with PAGE_GLOBAL in different modules
    4. Remove amotic operation with pte_clear(), using generic read and
       clear operation, vmalloc test pass to run also
    5. refresh some comments description
---
Bibo Mao (3):
  LoongArch: Set initial pte entry with PAGE_GLOBAL for kernel space
  LoongArch: Add barrier between set_pte and memory access
  LoongArch: Remove pte buddy set with set_pte and pte_clear function

 arch/loongarch/include/asm/cacheflush.h | 14 +++++++++-
 arch/loongarch/include/asm/pgalloc.h    | 13 +++++++++
 arch/loongarch/include/asm/pgtable.h    | 36 +++++--------------------
 arch/loongarch/mm/init.c                |  4 ++-
 arch/loongarch/mm/kasan_init.c          |  4 ++-
 arch/loongarch/mm/pgtable.c             | 22 +++++++++++++++
 include/linux/mm.h                      |  1 +
 mm/kasan/init.c                         |  8 +++++-
 mm/sparse-vmemmap.c                     |  5 ++++
 9 files changed, 73 insertions(+), 34 deletions(-)


base-commit: 6485cf5ea253d40d507cd71253c9568c5470cd27
-- 
2.39.3



^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2024-10-22  1:57 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-10-14  3:58 [PATCH v2 0/3] LoongArch: Fix vmalloc test issue Bibo Mao
2024-10-14  3:58 ` [PATCH v2 1/3] LoongArch: Set initial pte entry with PAGE_GLOBAL for kernel space Bibo Mao
2024-10-18  3:14   ` Huacai Chen
2024-10-18  3:44     ` maobibo
2024-10-18  4:11       ` Huacai Chen
2024-10-18  4:16         ` maobibo
2024-10-18  4:23           ` Huacai Chen
2024-10-18  6:23             ` maobibo
2024-10-18  6:32               ` Huacai Chen
2024-10-21  1:22                 ` maobibo
2024-10-21 10:13                   ` Huacai Chen
2024-10-22  1:39                     ` maobibo
2024-10-22  1:56                       ` Huacai Chen
2024-10-14  3:58 ` [PATCH v2 2/3] LoongArch: Add barrier between set_pte and memory access Bibo Mao
2024-10-14  6:31   ` Huacai Chen
2024-10-15  2:53     ` maobibo
2024-10-15 12:27       ` Huacai Chen
2024-10-16  6:09         ` maobibo
2024-10-16  7:30           ` Huacai Chen
2024-10-14  3:58 ` [PATCH v2 3/3] LoongArch: Remove pte buddy set with set_pte and pte_clear function Bibo Mao
2024-10-14  6:33   ` Huacai Chen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox