linux/drivers/base
Yinghai Lu 7568fb63f5 mm: Check if section present during memory block (un)registering
Tony found on his setup, if memory block size 512M will cause crash
during booting.

 BUG: unable to handle kernel paging request at ffffea0074000020
 IP: [<ffffffff81670527>] get_nid_for_pfn+0x17/0x40
 PGD 128ffcb067 PUD 128ffc9067 PMD 0
 Oops: 0000 [#1] SMP
 Modules linked in:
 CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.2.0-rc8 #1
...
 Call Trace:
  [<ffffffff81453b56>] ? register_mem_sect_under_node+0x66/0xe0
  [<ffffffff81453eeb>] register_one_node+0x17b/0x240
  [<ffffffff81b1f1ed>] ? pci_iommu_alloc+0x6e/0x6e
  [<ffffffff81b1f229>] topology_init+0x3c/0x95
  [<ffffffff8100213d>] do_one_initcall+0xcd/0x1f0

The system has non continuous RAM address:
 BIOS-e820: [mem 0x0000001300000000-0x0000001cffffffff] usable
 BIOS-e820: [mem 0x0000001d70000000-0x0000001ec7ffefff] usable
 BIOS-e820: [mem 0x0000001f00000000-0x0000002bffffffff] usable
 BIOS-e820: [mem 0x0000002c18000000-0x0000002d6fffefff] usable
 BIOS-e820: [mem 0x0000002e00000000-0x00000039ffffffff] usable

So there are start sections in memory block not present.
For example:
memory block : [0x2c18000000, 0x2c20000000) 512M
first three sections are not present.

Current register_mem_sect_under_node() assume first section is present,
but memory block section number range [start_section_nr, end_section_nr]
would include not present section.

For arch that support vmemmap, we don't setup memmap for struct page area
within not present sections area.

So skip the pfn range that belong to absent section.

Also fixes unregister_mem_sect_under_nodes() that assume one section per
memory block.

Reported-by: Tony Luck <tony.luck@intel.com>
Tested-by: Tony Luck <tony.luck@intel.com>
Fixes: bdee237c03 ("x86: mm: Use 2GB memory block size on large memory x86-64 systems")
Fixes: 982792c782 ("x86, mm: probe memory block size for generic x86 64bit")
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Cc: stable@vger.kernel.org #v3.15
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-05 04:51:55 +01:00
..
power Merge branches 'pm-cpu', 'pm-cpuidle' and 'pm-domains' 2015-09-11 15:37:36 +02:00
regmap debugfs: Pass bool pointer to debugfs_create_bool() 2015-10-04 11:36:07 +01:00
attribute_container.c attribute_container: fix missing blank lines after declarations 2015-03-25 14:35:09 +01:00
base.h driver core: correct device's shutdown order 2015-08-05 17:07:19 -07:00
bus.c driver-core: add asynchronous probing support for drivers 2015-05-20 00:25:24 -07:00
cacheinfo.c cpu/cacheinfo: Fix teardown path 2015-09-17 06:06:54 -07:00
class.c drivers: base: class: Add a blank line after declarations 2015-03-25 14:36:19 +01:00
component.c component: fix bug with legacy API 2014-07-04 18:05:05 +01:00
container.c ACPI / hotplug / driver core: Handle containers in a special way 2013-12-29 15:25:48 +01:00
core.c Power management and ACPI material for v4.3-rc1 2015-09-01 19:45:46 -07:00
cpu.c cpu: Remove bogus __ref annotation of cpu_subsys_online() 2015-08-05 15:18:26 -07:00
dd.c Power management and ACPI material for v4.3-rc1 2015-09-01 19:45:46 -07:00
devcoredump.c devcoredump: provide a one-way disable function 2014-11-26 19:40:12 -08:00
devres.c devres: fix devres_get() 2015-08-05 15:11:48 -07:00
devtmpfs.c VFS: assorted weird filesystems: d_inode() annotations 2015-04-15 15:06:58 -04:00
dma-coherent.c drivers: dma-coherent: add initialization from device tree 2014-10-14 02:18:12 +02:00
dma-contiguous.c CMA: fix CONFIG_CMA_SIZE_MBYTES overflow in 64bit 2015-10-05 04:49:54 +01:00
dma-mapping.c drivers: base: dma-mapping: Erase blank space after pointer 2015-03-25 14:36:19 +01:00
driver.c driver core: add missing blank line after declaration 2015-03-25 14:36:30 +01:00
firmware.c
firmware_class.c firmware: fix wrong memory deallocation in fw_add_devm_name() 2015-08-05 15:18:26 -07:00
hypervisor.c
init.c drivers: of/base: move of_init to driver_init 2015-05-26 19:55:56 -07:00
isa.c
Kconfig cma: make default CMA area size zero for x86 2014-12-10 17:41:06 -08:00
Makefile drivers/base: Add MSI domain support for non-PCI devices 2015-07-30 00:14:38 +02:00
map.c drivers: base: map: Use kmalloc_array instead of kmalloc 2015-03-25 14:35:08 +01:00
memory.c mm, hotplug: fix concurrent memory hot-add deadlock 2015-04-14 16:49:00 -07:00
module.c
node.c mm: Check if section present during memory block (un)registering 2015-10-05 04:51:55 +01:00
pinctrl.c drivers: pinctrl sleep and idle states in the core 2013-06-16 11:56:52 +02:00
platform-msi.c platform-msi: Do not cache msi_desc in handler_data 2015-09-15 17:06:29 +02:00
platform.c base/platform: assert that dev_pm_domain callbacks are called unconditionally 2015-10-04 19:42:22 +01:00
property.c device property: Don't overwrite addr when failing in device_get_mac_address 2015-09-08 13:40:23 -07:00
soc.c base: soc: siplify ida usage 2015-10-04 19:42:22 +01:00
syscore.c genirq: Simplify wakeup mechanism 2014-09-01 13:48:59 +02:00
topology.c sched/topology: Rename topology_thread_cpumask() to topology_sibling_cpumask() 2015-05-27 15:22:15 +02:00
transport_class.c