alistair23-linux/arch/arm
Will Deacon 7b7bf499f7 ARM: 6913/1: sparsemem: allow pfn_valid to be overridden when using SPARSEMEM
In commit eb33575c ("[ARM] Double check memmap is actually valid with a
memmap has unexpected holes V2"), a new function, memmap_valid_within,
was introduced to mmzone.h so that holes in the memmap which pass
pfn_valid in SPARSEMEM configurations can be detected and avoided.

The fix to this problem checks that the pfn <-> page linkages are
correct by calculating the page for the pfn and then checking that
page_to_pfn on that page returns the original pfn. Unfortunately, in
SPARSEMEM configurations, this results in reading from the page flags to
determine the correct section. Since the memmap here has been freed,
junk is read from memory and the check is no longer robust.

In the best case, reading from /proc/pagetypeinfo will give you the
wrong answer. In the worst case, you get SEGVs, Kernel OOPses and hung
CPUs. Furthermore, ioremap implementations that use pfn_valid to
disallow the remapping of normal memory will break.

This patch allows architectures to provide their own pfn_valid function
instead of using the default implementation used by sparsemem. The
architecture-specific version is aware of the memmap state and will
return false when passed a pfn for a freed page within a valid section.

Acked-by: Mel Gorman <mgorman@suse.de>
Acked-by: Catalin Marinas <catalin.marinas@arm.com>
Tested-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2011-05-26 10:23:24 +01:00
..
boot Merge branch 'devel-stable' into for-linus 2011-05-23 19:28:04 +01:00
common Merge branch 'devel-stable' into for-linus 2011-05-23 19:28:04 +01:00
configs Merge branch 'devel-stable' into for-linus 2011-05-23 19:28:04 +01:00
include/asm ARM: 6913/1: sparsemem: allow pfn_valid to be overridden when using SPARSEMEM 2011-05-26 10:23:24 +01:00
kernel Merge branch 'for-2.6.40' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/percpu 2011-05-24 11:53:42 -07:00
lib
mach-at91 Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial 2011-05-23 09:12:26 -07:00
mach-bcmring ARM: bcmring: convert to use sp804 clockevents 2011-05-23 18:04:54 +01:00
mach-clps711x
mach-cns3xxx
mach-davinci Merge branch 'devel-stable' into for-linus 2011-05-23 19:28:04 +01:00
mach-dove ARM: dove: Consolidate mpp code with platform mpp. 2011-05-16 15:49:31 -04:00
mach-ebsa110
mach-ep93xx ARM: 6852/1: EP93xx: Remove ep93xx_gpio_dbg_show function 2011-05-11 12:37:18 +01:00
mach-exynos4 Merge branch 'for-linus' of master.kernel.org:/home/rmk/linux-2.6-arm 2011-05-23 15:15:27 -07:00
mach-footbridge clocksource: convert footbridge to generic i8253 clocksource 2011-05-14 10:29:48 +01:00
mach-gemini ARM: zImage: remove the static qualifier from global data variables 2011-05-07 00:08:02 -04:00
mach-h720x ARM: Replace platform definition of ISA_DMA_THRESHOLD/MAX_DMA_ADDRESS 2011-05-12 08:36:49 +01:00
mach-imx ARM: imx: move mx3 support to mach-imx 2011-05-19 13:11:38 +02:00
mach-integrator Merge branches 'consolidate-clksrc', 'consolidate-flash', 'consolidate-generic', 'consolidate-smp', 'consolidate-stmp' and 'consolidate-zones' into consolidate 2011-05-23 18:05:10 +01:00
mach-iop13xx
mach-iop32x ARM: zImage: remove the static qualifier from global data variables 2011-05-07 00:08:02 -04:00
mach-iop33x ARM: zImage: remove the static qualifier from global data variables 2011-05-07 00:08:02 -04:00
mach-ixp4xx Merge branch 'timers-ptp-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip 2011-05-25 08:59:42 -07:00
mach-ixp23xx
mach-ixp2000
mach-kirkwood ARM: orion: Refactor the MPP code common in the orion platform 2011-05-16 15:25:54 -04:00
mach-ks8695
mach-l7200/include/mach
mach-loki ARM: orion: Consolidate ethernet platform data 2011-05-16 15:06:01 -04:00
mach-lpc32xx clocksource: convert ARM 32-bit up counting clocksources 2011-05-23 18:04:51 +01:00
mach-mmp Merge branch 'zImage_fixes' of git://git.linaro.org/people/nico/linux into devel-stable 2011-05-07 08:34:02 +01:00
mach-msm Merge branch 'for-linus' of master.kernel.org:/home/rmk/linux-2.6-arm 2011-05-23 15:15:27 -07:00
mach-mv78xx0 ARM: orion: Refactor the MPP code common in the orion platform 2011-05-16 15:25:54 -04:00
mach-mx5 ARM: mxc: don't allow to compile together i.MX51 and i.MX53 2011-05-19 13:11:30 +02:00
mach-mxs Merge branch 'devel-stable' into for-linus 2011-05-23 19:28:04 +01:00
mach-netx clocksource: convert ARM 32-bit up counting clocksources 2011-05-23 18:04:51 +01:00
mach-nomadik
mach-nuc93x ARM: zImage: remove the static qualifier from global data variables 2011-05-07 00:08:02 -04:00
mach-omap1 Merge branches 'consolidate-clksrc', 'consolidate-flash', 'consolidate-generic', 'consolidate-smp', 'consolidate-stmp' and 'consolidate-zones' into consolidate 2011-05-23 18:05:10 +01:00
mach-omap2 Merge branch 'for-paul' of git://gitorious.org/linux-omap-dss2/linux 2011-05-24 15:35:54 +09:00
mach-orion5x ARM: orion5x: Refactor mpp code to use common orion platform mpp. 2011-05-16 15:42:59 -04:00
mach-pnx4008
mach-pxa Merge branch 'devel-stable' into for-linus 2011-05-23 19:28:04 +01:00
mach-realview Merge branches 'consolidate-clksrc', 'consolidate-flash', 'consolidate-generic', 'consolidate-smp', 'consolidate-stmp' and 'consolidate-zones' into consolidate 2011-05-23 18:05:10 +01:00
mach-rpc ARM: zImage: remove the static qualifier from global data variables 2011-05-07 00:08:02 -04:00
mach-s3c24a0/include/mach
mach-s3c64xx Merge branch 'devel-stable' into for-linus 2011-05-23 19:28:04 +01:00
mach-s3c2400
mach-s3c2410 Merge branch 'for-linus' of master.kernel.org:/home/rmk/linux-2.6-arm 2011-05-23 15:15:27 -07:00
mach-s3c2412
mach-s3c2416 Merge branch 'usb-next' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb-2.6 2011-05-23 12:33:02 -07:00
mach-s3c2440
mach-s3c2443
mach-s5p64x0 ARM: zImage: remove the static qualifier from global data variables 2011-05-07 00:08:02 -04:00
mach-s5p6442
mach-s5pc100
mach-s5pv210
mach-sa1100 Merge branches 'consolidate-clksrc', 'consolidate-flash', 'consolidate-generic', 'consolidate-smp', 'consolidate-stmp' and 'consolidate-zones' into consolidate 2011-05-23 18:05:10 +01:00
mach-shark ARM: use ARM_DMA_ZONE_SIZE to adjust the zone sizes 2011-05-12 08:36:53 +01:00
mach-shmobile ARM: mach-shmobile: mackerel: add renesas_usbhs support for USB1 2011-05-25 17:07:36 +09:00
mach-spear3xx ARM: 6931/1: SPEAr3xx: Rework KConfig to allow all boards to be compiled in 2011-05-20 22:34:25 +01:00
mach-spear6xx ARM: 6934/1: SPEAr6xx: Rework Kconfig for single image solution 2011-05-20 22:34:25 +01:00
mach-tcc8k clocksource: convert ARM 32-bit up counting clocksources 2011-05-23 18:04:51 +01:00
mach-tegra Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/cjb/mmc 2011-05-25 16:55:55 -07:00
mach-u300 clocksource: convert ARM 32-bit up counting clocksources 2011-05-23 18:04:51 +01:00
mach-ux500 Merge branch 'for-torvalds' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-stericsson 2011-05-25 15:35:03 -07:00
mach-versatile Merge branches 'consolidate-clksrc', 'consolidate-flash', 'consolidate-generic', 'consolidate-smp', 'consolidate-stmp' and 'consolidate-zones' into consolidate 2011-05-23 18:05:10 +01:00
mach-vexpress Merge branches 'consolidate-clksrc', 'consolidate-flash', 'consolidate-generic', 'consolidate-smp', 'consolidate-stmp' and 'consolidate-zones' into consolidate 2011-05-23 18:05:10 +01:00
mach-vt8500
mach-w90x900 Merge branch 'devel-stable' into for-linus 2011-05-23 19:28:04 +01:00
mm ARM: 6913/1: sparsemem: allow pfn_valid to be overridden when using SPARSEMEM 2011-05-26 10:23:24 +01:00
nwfpe
oprofile
plat-iop
plat-mxc Merge branch 'for-linus' of master.kernel.org:/home/rmk/linux-2.6-arm 2011-05-23 15:15:27 -07:00
plat-nomadik i2c-nomadik: fix speed enumerator 2011-05-25 00:20:22 +01:00
plat-omap Merge branch 'for-paul' of git://gitorious.org/linux-omap-dss2/linux 2011-05-24 15:35:54 +09:00
plat-orion Merge branch 'devel-stable' into for-linus 2011-05-23 19:28:04 +01:00
plat-pxa
plat-s3c24xx Merge branch 'usb-next' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb-2.6 2011-05-23 12:33:02 -07:00
plat-s5p Merge branch 'for-linus' of master.kernel.org:/home/rmk/linux-2.6-arm 2011-05-23 15:15:27 -07:00
plat-samsung Merge branch 'for-linus' of master.kernel.org:/home/rmk/linux-2.6-arm 2011-05-23 15:15:27 -07:00
plat-spear Merge branches 'consolidate', 'ep93xx', 'fixes', 'misc', 'mmci', 'remove' and 'spear' into for-linus 2011-05-23 19:27:40 +01:00
plat-tcc
plat-versatile ARM: consolidate SMP cross call implementation 2011-05-23 16:53:17 +01:00
tools ARM: Update mach-types 2011-05-14 21:36:55 +01:00
vfp
Kconfig ARM: 6913/1: sparsemem: allow pfn_valid to be overridden when using SPARSEMEM 2011-05-26 10:23:24 +01:00
Kconfig-nommu
Kconfig.debug lib: consolidate DEBUG_STACK_USAGE option 2011-05-25 08:39:54 -07:00
Makefile Merge branch 'devel-stable' into for-linus 2011-05-23 19:28:04 +01:00