linux-snapdragon/arch/alpha/kernel
Mike Rapoport 640b7ea5f8 alpha: register early reserved memory in memblock
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>
2021-07-28 20:49:18 -07:00
..
syscalls quota: Wire up quotactl_fd syscall 2021-06-07 12:11:24 +02:00
.gitignore .gitignore: add SPDX License Identifier 2020-03-25 11:50:48 +01:00
asm-offsets.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
audit.c alpha: Enable system-call auditing support. 2014-01-31 09:21:55 -08:00
binfmt_loader.c exec: Remove recursion from search_binary_handler 2020-05-21 10:16:57 -05:00
bugs.c alpha: Implement CPU vulnerabilities sysfs functions. 2018-04-07 15:04:04 -07:00
console.c vgacon: Set VGA struct resource types 2017-12-18 23:07:43 -06:00
core_apecs.c memblock: stop using implicit alignment to SMP_CACHE_BYTES 2018-10-31 08:54:16 -07:00
core_cia.c treewide: add checks for the return value of memblock_alloc*() 2019-03-12 10:04:02 -07:00
core_irongate.c mm: remove unneeded includes of <asm/pgalloc.h> 2020-08-07 11:33:26 -07:00
core_lca.c memblock: stop using implicit alignment to SMP_CACHE_BYTES 2018-10-31 08:54:16 -07:00
core_marvel.c alpha: remove DISCONTIGMEM and NUMA 2021-06-29 10:53:55 -07:00
core_mcpcia.c memblock: stop using implicit alignment to SMP_CACHE_BYTES 2018-10-31 08:54:16 -07:00
core_polaris.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
core_t2.c memblock: stop using implicit alignment to SMP_CACHE_BYTES 2018-10-31 08:54:16 -07:00
core_titan.c mm: remove unneeded includes of <asm/pgalloc.h> 2020-08-07 11:33:26 -07:00
core_tsunami.c memblock: stop using implicit alignment to SMP_CACHE_BYTES 2018-10-31 08:54:16 -07:00
core_wildfire.c alpha: remove DISCONTIGMEM and NUMA 2021-06-29 10:53:55 -07:00
entry.S alpha: add support for TIF_NOTIFY_SIGNAL 2020-12-12 09:16:34 -07:00
err_common.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
err_ev6.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
err_ev7.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
err_impl.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
err_marvel.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
err_titan.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
es1888.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
gct.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
head.S License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
io.c iomap: constify ioreadX() iomem argument (as in generic implementation) 2020-08-14 19:56:57 -07:00
irq_alpha.c alpha: Replace setup_irq() by request_irq() 2020-03-29 21:03:41 +02:00
irq_i8259.c alpha: Replace setup_irq() by request_irq() 2020-03-29 21:03:41 +02:00
irq_impl.h alpha: Replace setup_irq() by request_irq() 2020-03-29 21:03:41 +02:00
irq_pyxis.c alpha: Replace setup_irq() by request_irq() 2020-03-29 21:03:41 +02:00
irq_srm.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
irq.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
machvec_impl.h mm: remove unneeded includes of <asm/pgalloc.h> 2020-08-07 11:33:26 -07:00
Makefile alpha: Implement CPU vulnerabilities sysfs functions. 2018-04-07 15:04:04 -07:00
module.c treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
osf_sys.c alpha: fix spelling mistakes 2021-07-25 22:33:04 -07:00
pc873xx.c alpha: eliminate old-style function definitions 2021-05-06 19:24:11 -07:00
pc873xx.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
pci_impl.h alpha: fix reboot on Avanti platform 2018-01-20 17:01:10 -08:00
pci_iommu.c alpha: remove DISCONTIGMEM and NUMA 2021-06-29 10:53:55 -07:00
pci-noop.c treewide: add checks for the return value of memblock_alloc*() 2019-03-12 10:04:02 -07:00
pci-sysfs.c PCI: Add PCI_STD_NUM_BARS for the number of standard BARs 2019-10-14 10:22:26 -05:00
pci.c treewide: add checks for the return value of memblock_alloc*() 2019-03-12 10:04:02 -07:00
perf_event.c alpha: fix spelling mistakes 2021-07-25 22:33:04 -07:00
process.c alpha: convert comma to semicolon 2021-07-25 22:32:59 -07:00
proto.h alpha: remove DISCONTIGMEM and NUMA 2021-06-29 10:53:55 -07:00
ptrace.c mm: don't include asm/pgtable.h if linux/mm.h is already included 2020-06-09 09:39:13 -07:00
rtc.c rtc: rework rtc_register_device() resource management 2020-11-19 12:50:12 +01:00
setup.c alpha: register early reserved memory in memblock 2021-07-28 20:49:18 -07:00
signal.c alpha: add support for TIF_NOTIFY_SIGNAL 2020-12-12 09:16:34 -07:00
smc37c93x.c arch: mostly remove <asm/segment.h> 2019-04-23 21:51:40 +02:00
smc37c669.c arch: mostly remove <asm/segment.h> 2019-04-23 21:51:40 +02:00
smp.c alpha: Send stop IPI to send to online CPUs 2021-07-25 22:33:03 -07:00
srm_env.c proc: convert everything to "struct proc_ops" 2020-02-04 03:05:26 +00:00
srmcons.c tty: remove tty_operations::chars_in_buffer for non-buffering 2021-05-13 18:29:11 +02:00
sys_alcor.c mm: don't include asm/pgtable.h if linux/mm.h is already included 2020-06-09 09:39:13 -07:00
sys_cabriolet.c mm: don't include asm/pgtable.h if linux/mm.h is already included 2020-06-09 09:39:13 -07:00
sys_dp264.c mm: don't include asm/pgtable.h if linux/mm.h is already included 2020-06-09 09:39:13 -07:00
sys_eb64p.c mm: don't include asm/pgtable.h if linux/mm.h is already included 2020-06-09 09:39:13 -07:00
sys_eiger.c alpha: remove unneeded semicolon in sys_eiger.c 2020-06-12 17:43:17 -07:00
sys_jensen.c genirq: Move irq_has_action() into core code 2020-12-15 16:19:30 +01:00
sys_marvel.c alpha: remove DISCONTIGMEM and NUMA 2021-06-29 10:53:55 -07:00
sys_miata.c mm: don't include asm/pgtable.h if linux/mm.h is already included 2020-06-09 09:39:13 -07:00
sys_mikasa.c mm: don't include asm/pgtable.h if linux/mm.h is already included 2020-06-09 09:39:13 -07:00
sys_nautilus.c alpha: fix spelling mistakes 2021-07-25 22:33:04 -07:00
sys_noritake.c mm: don't include asm/pgtable.h if linux/mm.h is already included 2020-06-09 09:39:13 -07:00
sys_rawhide.c mm: don't include asm/pgtable.h if linux/mm.h is already included 2020-06-09 09:39:13 -07:00
sys_ruffian.c mm: don't include asm/pgtable.h if linux/mm.h is already included 2020-06-09 09:39:13 -07:00
sys_rx164.c mm: don't include asm/pgtable.h if linux/mm.h is already included 2020-06-09 09:39:13 -07:00
sys_sable.c mm: don't include asm/pgtable.h if linux/mm.h is already included 2020-06-09 09:39:13 -07:00
sys_sio.c mm: don't include asm/pgtable.h if linux/mm.h is already included 2020-06-09 09:39:13 -07:00
sys_sx164.c mm: don't include asm/pgtable.h if linux/mm.h is already included 2020-06-09 09:39:13 -07:00
sys_takara.c mm: don't include asm/pgtable.h if linux/mm.h is already included 2020-06-09 09:39:13 -07:00
sys_titan.c mm: don't include asm/pgtable.h if linux/mm.h is already included 2020-06-09 09:39:13 -07:00
sys_wildfire.c alpha: remove DISCONTIGMEM and NUMA 2021-06-29 10:53:55 -07:00
systbls.S alpha: syscalls: switch to generic syscalltbl.sh 2021-04-25 05:25:22 +09:00
time.c alpha: Replace setup_irq() by request_irq() 2020-03-29 21:03:41 +02:00
traps.c alpha: fix spelling mistakes 2021-07-25 22:33:04 -07:00
vmlinux.lds.S vmlinux.lds.h: Split ELF_DETAILS from STABS_DEBUG 2020-09-01 09:50:35 +02:00