android_kernel_xiaomi_sm8450/arch/x86
Mike Rapoport (IBM) a7aa2f1ca8 x86/mm: Drop the 4 MB restriction on minimal NUMA node memory size
[ Upstream commit a1e2b8b36820d8c91275f207e77e91645b7c6836 ]

Qi Zheng reported crashes in a production environment and provided a
simplified example as a reproducer:

 |  For example, if we use Qemu to start a two NUMA node kernel,
 |  one of the nodes has 2M memory (less than NODE_MIN_SIZE),
 |  and the other node has 2G, then we will encounter the
 |  following panic:
 |
 |    BUG: kernel NULL pointer dereference, address: 0000000000000000
 |    <...>
 |    RIP: 0010:_raw_spin_lock_irqsave+0x22/0x40
 |    <...>
 |    Call Trace:
 |      <TASK>
 |      deactivate_slab()
 |      bootstrap()
 |      kmem_cache_init()
 |      start_kernel()
 |      secondary_startup_64_no_verify()

The crashes happen because of inconsistency between the nodemask that
has nodes with less than 4MB as memoryless, and the actual memory fed
into the core mm.

The commit:

  9391a3f9c7 ("[PATCH] x86_64: Clear more state when ignoring empty node in SRAT parsing")

... that introduced minimal size of a NUMA node does not explain why
a node size cannot be less than 4MB and what boot failures this
restriction might fix.

Fixes have been submitted to the core MM code to tighten up the
memory topologies it accepts and to not crash on weird input:

  mm: page_alloc: skip memoryless nodes entirely
  mm: memory_hotplug: drop memoryless node from fallback lists

Andrew has accepted them into the -mm tree, but there are no
stable SHA1's yet.

This patch drops the limitation for minimal node size on x86:

  - which works around the crash without the fixes to the core MM.
  - makes x86 topologies less weird,
  - removes an arbitrary and undocumented limitation on NUMA topologies.

[ mingo: Improved changelog clarity. ]

Reported-by: Qi Zheng <zhengqi.arch@bytedance.com>
Tested-by: Mario Casquero <mcasquer@redhat.com>
Signed-off-by: Mike Rapoport (IBM) <rppt@kernel.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Acked-by: David Hildenbrand <david@redhat.com>
Acked-by: Michal Hocko <mhocko@suse.com>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: Rik van Riel <riel@surriel.com>
Link: https://lore.kernel.org/r/ZS+2qqjEO5/867br@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-11-28 16:54:49 +00:00
..
boot x86/sev: Check for user-space IOIO pointing to kernel space 2023-10-25 11:54:19 +02:00
configs x86/kbuild: Enable CONFIG_KALLSYMS_ALL=y in the defconfigs 2022-01-27 10:54:21 +01:00
crypto crypto: x86/ghash - fix unaligned access in ghash_setkey() 2023-03-11 16:39:19 +01:00
entry x86/mm: Fix VDSO and VVAR placement on 5-level paging machines 2023-08-16 18:21:00 +02:00
events x86: Share definition of __is_canonical_address() 2023-11-20 11:06:56 +01:00
hyperv x86/hyperv: Remove unregister syscore call from Hyper-V cleanup 2023-01-14 10:16:13 +01:00
ia32 x86: remove address space overrides using set_fs() 2020-09-08 22:21:36 -04:00
include x86/mm: Drop the 4 MB restriction on minimal NUMA node memory size 2023-11-28 16:54:49 +00:00
kernel x86/boot: Fix incorrect startup_gdt_descr.size 2023-11-20 11:06:44 +01:00
kvm x86: Share definition of __is_canonical_address() 2023-11-20 11:06:56 +01:00
lib iov_iter, x86: Be consistent about the __user tag on copy_mc_to_user() 2023-11-20 11:06:43 +01:00
math-emu x86: Prepare asm files for straight-line-speculation 2022-07-25 11:26:28 +02:00
mm x86/mm: Drop the 4 MB restriction on minimal NUMA node memory size 2023-11-28 16:54:49 +00:00
net x86/bpf: Use alternative RET encoding 2022-07-25 11:26:38 +02:00
oprofile
pci x86/PCI: Add quirk for AMD XHCI controller that loses MSI-X state in D3hot 2023-04-20 12:10:27 +02:00
platform x86/olpc: fix 'logical not is only applied to the left hand side' 2022-08-21 15:16:14 +02:00
power x86/pm: Add enumeration check before spec MSRs save/restore setup 2022-12-08 11:23:59 +01:00
purgatory x86/purgatory: remove PGO flags 2023-06-21 15:45:37 +02:00
ras treewide: replace '---help---' in Kconfig files with 'help' 2020-06-14 01:57:21 +09:00
realmode x86/mm: Flush global TLB when switching to trampoline page-table 2022-01-27 10:54:14 +01:00
tools x86/tools: Fix objdump version check again 2021-08-18 08:59:15 +02:00
um x86: um: vdso: Add '%rcx' and '%r11' to the syscall clobber list 2023-03-11 16:40:11 +01:00
video
xen x86/xen: Fix secondary processors' FPU initialization 2023-08-08 19:57:38 +02:00
.gitignore
Kbuild
Kconfig x86/srso: Add a Speculative RAS Overflow mitigation 2023-08-08 19:57:40 +02:00
Kconfig.assembler
Kconfig.cpu treewide: replace '---help---' in Kconfig files with 'help' 2020-06-14 01:57:21 +09:00
Kconfig.debug x86, powerpc: Rename memcpy_mcsafe() to copy_mc_to_{user, kernel}() 2020-10-06 11:18:04 +02:00
Makefile x86/realmode: build with -D__DISABLE_EXPORTS 2022-07-25 11:26:33 +02:00
Makefile_32.cpu
Makefile.um