linux-stable/arch
Mike Rapoport 7bca5da005 alpha: register early reserved memory in memblock
commit 640b7ea5f8 upstream.

The memory reserved by console/PALcode or non-volatile memory is not added
to memblock.memory.

Since commit fa3354e4ea (mm: free_area_init: use maximal zone PFNs rather
than zone sizes) the initialization of the memory map relies on the
accuracy of memblock.memory to properly calculate zone sizes. The holes in
memblock.memory caused by absent regions reserved by the firmware cause
incorrect initialization of struct pages which leads to BUG() during the
initial page freeing:

BUG: Bad page state in process swapper  pfn:2ffc53
page:fffffc000ecf14c0 refcount:0 mapcount:1 mapping:0000000000000000 index:0x0
flags: 0x0()
raw: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
raw: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
page dumped because: nonzero mapcount
Modules linked in:
CPU: 0 PID: 0 Comm: swapper Not tainted 5.7.0-03841-gfa3354e4ea39-dirty #26
       fffffc0001b5bd68 fffffc0001b5be80 fffffc00011cd148 fffffc000ecf14c0
       fffffc00019803df fffffc0001b5be80 fffffc00011ce340 fffffc000ecf14c0
       0000000000000000 fffffc0001b5be80 fffffc0001b482c0 fffffc00027d6618
       fffffc00027da7d0 00000000002ff97a 0000000000000000 fffffc0001b5be80
       fffffc00011d1abc fffffc000ecf14c0 fffffc0002d00000 fffffc0001b5be80
       fffffc0001b2350c 0000000000300000 fffffc0001b48298 fffffc0001b482c0
Trace:
[<fffffc00011cd148>] bad_page+0x168/0x1b0
[<fffffc00011ce340>] free_pcp_prepare+0x1e0/0x290
[<fffffc00011d1abc>] free_unref_page+0x2c/0xa0
[<fffffc00014ee5f0>] cmp_ex_sort+0x0/0x30
[<fffffc00014ee5f0>] cmp_ex_sort+0x0/0x30
[<fffffc000101001c>] _stext+0x1c/0x20

Fix this by registering the reserved ranges in memblock.memory.

Link: https://lore.kernel.org/lkml/20210726192311.uffqnanxw3ac5wwi@ivybridge
Fixes: fa3354e4ea ("mm: free_area_init: use maximal zone PFNs rather than zone sizes")
Reported-by: Matt Turner <mattst88@gmail.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Mike Rapoport <rppt@linux.ibm.com>
Signed-off-by: Matt Turner <mattst88@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-08-04 12:46:40 +02:00
..
alpha alpha: register early reserved memory in memblock 2021-08-04 12:46:40 +02:00
arc sched/core: Initialize the idle task with preemption disabled 2021-07-14 16:55:50 +02:00
arm ARM: dts: versatile: Fix up interrupt controller node names 2021-07-31 08:16:13 +02:00
arm64 arm64: dts: marvell: armada-37xx: move firmware node to generic dtsi file 2021-07-25 14:36:17 +02:00
c6x
csky csky: syscache: Fixup duplicate cache flush 2021-07-14 16:56:52 +02:00
h8300
hexagon hexagon: use common DISCARDS macro 2021-07-20 16:05:53 +02:00
ia64 mm/page_alloc: fix memory map initialization for descending nodes 2021-07-25 14:36:18 +02:00
m68k m68k: atari: Fix ATARI_KBD_CORE kconfig unmet dependency warning 2021-07-14 16:56:05 +02:00
microblaze
mips MIPS: vdso: Invalid GIC access through VDSO 2021-07-20 16:05:59 +02:00
nds32 nds32: fix up stack guard gap 2021-07-28 14:35:46 +02:00
nios2
openrisc sched/core: Initialize the idle task with preemption disabled 2021-07-14 16:55:50 +02:00
parisc sched/core: Initialize the idle task with preemption disabled 2021-07-14 16:55:50 +02:00
powerpc KVM: PPC: Book3S HV Nested: Sanitise H_ENTER_NESTED TM state 2021-07-28 14:35:43 +02:00
riscv sched/core: Initialize the idle task with preemption disabled 2021-07-14 16:55:50 +02:00
s390 s390/boot: fix use of expolines in the DMA code 2021-07-28 14:35:42 +02:00
sh sched/core: Initialize the idle task with preemption disabled 2021-07-14 16:55:50 +02:00
sparc sched/core: Initialize the idle task with preemption disabled 2021-07-14 16:55:50 +02:00
um um: fix error return code in winch_tramp() 2021-07-20 16:05:51 +02:00
x86 x86/kvm: fix vcpu-id indexed array sizes 2021-08-04 12:46:39 +02:00
xtensa sched/core: Initialize the idle task with preemption disabled 2021-07-14 16:55:50 +02:00
.gitignore
Kconfig