android_kernel_xiaomi_sdm845/drivers/acpi
Yinghai Lu d3bd058826 x86, acpi: Parse all SRAT cpu entries even above the cpu number limitation
Recent Intel new system have different order in MADT, aka will list all thread0
at first, then all thread1.
But SRAT table still old order, it will list cpus in one socket all together.

If the user have compiled limited NR_CPUS or boot with nr_cpus=, could have missed
to put some cpus apic id to node mapping into apicid_to_node[].

for example for 4 sockets system with 64 cpus with nr_cpus=32 will get crash...

[    9.106288] Total of 32 processors activated (136190.88 BogoMIPS).
[    9.235021] divide error: 0000 [#1] SMP
[    9.235315] last sysfs file:
[    9.235481] CPU 1
[    9.235592] Modules linked in:
[    9.245398]
[    9.245478] Pid: 2, comm: kthreadd Not tainted 2.6.37-rc1-tip-yh-01782-ge92ef79-dirty #274      /Sun Fire x4800
[    9.265415] RIP: 0010:[<ffffffff81075a8f>]  [<ffffffff81075a8f>] select_task_rq_fair+0x4f0/0x623
...
[    9.645938] RIP  [<ffffffff81075a8f>] select_task_rq_fair+0x4f0/0x623
[    9.665356]  RSP <ffff88103f8d1c40>
[    9.665568] ---[ end trace 2296156d35fdfc87 ]---

So let just parse all cpu entries in SRAT.

Also add apicid checking with MAX_LOCAL_APIC, in case We could out of boundaries of
apicid_to_node[].

it fixes following bug too.
https://bugzilla.kernel.org/show_bug.cgi?id=22662

-v2: expand to 32bit according to hpa
   need to add MAX_LOCAL_APIC for 32bit

Reported-and-Tested-by: Wu Fengguang <fengguang.wu@intel.com>
Reported-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
Tested-by: Myron Stowe <myron.stowe@hp.com>
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
LKML-Reference: <4D0AD486.9020704@kernel.org>
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2010-12-23 13:16:18 -08:00
..
acpica Merge branches 'apei', 'battery-mwh-fix', 'bugzilla-10807', 'bugzilla-14736', 'bugzilla-14679', 'bugzilla-16396', 'launchpad-613381' and 'misc' into release 2010-09-29 15:18:28 -04:00
apei Merge branches 'apei', 'battery-mwh-fix', 'bugzilla-10807', 'bugzilla-14736', 'bugzilla-14679', 'bugzilla-16396', 'launchpad-613381' and 'misc' into release 2010-09-29 15:18:28 -04:00
ac.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
acpi_memhotplug.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
acpi_pad.c Merge branch 'x86-idle-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip 2010-10-21 13:45:38 -07:00
atomicio.c ACPI, APEI, Fix acpi_pre_map() return value 2010-09-29 14:02:16 -04:00
battery.c ACPI: Don't report current_now if battery reports in mWh 2010-08-31 00:00:47 -04:00
blacklist.c Merge branch 'msi-dmi' into release 2010-10-08 22:37:46 -04:00
bus.c Merge branches 'apei', 'battery-mwh-fix', 'bugzilla-10807', 'bugzilla-14736', 'bugzilla-14679', 'bugzilla-16396', 'launchpad-613381' and 'misc' into release 2010-09-29 15:18:28 -04:00
button.c ACPICA: Remove wakeup GPE reference counting which is not used 2010-07-06 22:34:26 -04:00
cm_sbs.c ACPI: Move definition of PREFIX from acpi_bus.h to internal..h 2009-08-28 19:57:27 -04:00
container.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
debugfs.c ACPI: introduce module parameter acpi.aml_debug_output 2010-08-14 23:02:14 -04:00
dock.c Merge branches 'battery', 'bugzilla-14667', 'bugzilla-15096', 'bugzilla-15480', 'bugzilla-15521', 'bugzilla-15605', 'gpe-reference-counters', 'misc', 'pxm-fix' and 'video-random-key' into release 2010-04-06 17:06:22 -04:00
ec_sys.c acpi ec_sys: Be more cautious about ec write access 2010-08-03 09:49:13 -04:00
ec.c Merge branch 'acpica' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6 2010-08-07 17:08:30 -07:00
event.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
fan.c ACPI: fan: Fix more unbalanced code block 2010-09-29 14:08:10 -04:00
glue.c ACPI: Add the check of ADR flag in course of finding ACPI handle for PCI device 2010-07-26 22:32:13 -04:00
hed.c ACPI Hardware Error Device (PNP0C33) support 2010-05-19 22:40:24 -04:00
internal.h Merge branch 'linus' into release 2010-08-15 01:06:31 -04:00
Kconfig ACPI: Kconfig: fix typo. 2010-09-28 21:38:20 -04:00
Makefile Merge branch 'linus' into release 2010-08-15 01:06:31 -04:00
numa.c x86, acpi: Parse all SRAT cpu entries even above the cpu number limitation 2010-12-23 13:16:18 -08:00
osl.c Merge branch 'linus' into release 2010-08-15 01:06:31 -04:00
pci_bind.c PCI / ACPI / PM: Platform support for PCI PME wake-up 2010-02-22 16:21:02 -08:00
pci_irq.c x86, acpi/irq: pci device dev->irq is an isa irq not a gsi 2010-05-04 13:34:30 -07:00
pci_link.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
pci_root.c PCI: PCIe: Ask BIOS for control of all native services at once 2010-08-24 13:47:33 -07:00
pci_slot.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
power_meter.c power_meter: acpi_device_class "power_meter_resource" too long 2010-05-06 02:38:24 -04:00
power.c Merge branch 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6 2010-08-15 17:37:07 -07:00
proc.c ACPI: remove deprecated ACPI procfs I/F 2010-08-15 00:27:51 -04:00
processor_core.c Merge branch 'pdc-regression' into release 2010-10-08 22:35:02 -04:00
processor_driver.c acpi_idle: add missing \n to printk 2010-09-28 23:30:40 -04:00
processor_idle.c Merge branch 'linus' into release 2010-08-15 01:06:31 -04:00
processor_perflib.c ACPI: Fix typos 2010-09-28 21:38:19 -04:00
processor_thermal.c ACPI processor: remove deprecated ACPI procfs I/F 2010-08-15 00:31:45 -04:00
processor_throttling.c ACPI processor: remove deprecated ACPI procfs I/F 2010-08-15 00:31:45 -04:00
reboot.c ACPI: reboot.c: use new acpi_reset interface 2008-12-31 01:15:00 -05:00
sbs.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
sbshc.c sbshc: acpi_device_class "smbus_host_controller" too long 2010-05-06 02:38:25 -04:00
sbshc.h ACPI: SBS: Ignore alarms coming from unknown devices 2007-12-14 15:14:06 -05:00
scan.c ACPI / ACPICA: Do not execute _PRW methods during initialization 2010-07-12 14:17:39 -04:00
sleep.c PM / ACPI: Blacklist systems known to require acpi_sleep=nonvs 2010-09-24 16:52:02 -04:00
sleep.h ACPI / Wakeup: Simplify enabling of wakeup devices 2010-07-06 22:09:38 -04:00
sysfs.c ACPI: fix build warnings resulting from merge window conflict 2010-09-28 21:38:01 -04:00
tables.c ACPI: delete the "acpi=ht" boot option 2010-03-14 20:58:38 -04:00
thermal.c ACPI thermal: make procfs I/F depend on CONFIG_ACPI_PROCFS 2010-08-15 00:37:33 -04:00
utils.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
video_detect.c ACPI video: fix a poor warning message 2010-09-28 21:38:01 -04:00
video.c gcc-4.6: ACPI: fix unused but set variables in ACPI 2010-08-15 00:53:08 -04:00
wakeup.c Merge branch 'acpica-gpe' into release 2010-08-15 00:25:40 -04:00