linux/arch
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
..
alpha Remove unused PROC_CHANGE_PENALTY constant 2011-05-25 08:39:43 -07:00
arm ARM: 6913/1: sparsemem: allow pfn_valid to be overridden when using SPARSEMEM 2011-05-26 10:23:24 +01:00
avr32 mm: now that all old mmu_gather code is gone, remove the storage 2011-05-25 08:39:16 -07:00
blackfin Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/vapier/blackfin 2011-05-25 15:34:14 -07:00
cris cris: convert old cpumask API into new one 2011-05-25 08:39:39 -07:00
frv mm: now that all old mmu_gather code is gone, remove the storage 2011-05-25 08:39:16 -07:00
h8300 genirq: Remove the now obsolete config options and select statements 2011-03-30 14:13:23 +02:00
ia64 mm: now that all old mmu_gather code is gone, remove the storage 2011-05-25 08:39:16 -07:00
m32r lib: consolidate DEBUG_STACK_USAGE option 2011-05-25 08:39:54 -07:00
m68k mm: now that all old mmu_gather code is gone, remove the storage 2011-05-25 08:39:16 -07:00
microblaze mm: now that all old mmu_gather code is gone, remove the storage 2011-05-25 08:39:16 -07:00
mips lib: consolidate DEBUG_STACK_USAGE option 2011-05-25 08:39:54 -07:00
mn10300 mn10300: convert old cpumask API into new one 2011-05-25 08:39:39 -07:00
parisc Remove unused PROC_CHANGE_PENALTY constant 2011-05-25 08:39:43 -07:00
powerpc 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
s390 mm: now that all old mmu_gather code is gone, remove the storage 2011-05-25 08:39:16 -07:00
score lib: consolidate DEBUG_STACK_USAGE option 2011-05-25 08:39:54 -07:00
sh lib: consolidate DEBUG_STACK_USAGE option 2011-05-25 08:39:54 -07:00
sparc lib: consolidate DEBUG_STACK_USAGE option 2011-05-25 08:39:54 -07:00
tile Merge git://git.kernel.org/pub/scm/linux/kernel/git/cmetcalf/linux-tile 2011-05-25 15:35:32 -07:00
um lib: consolidate DEBUG_STACK_USAGE option 2011-05-25 08:39:54 -07:00
unicore32 lib: consolidate DEBUG_STACK_USAGE option 2011-05-25 08:39:54 -07:00
x86 Merge branch 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelvare/staging 2011-05-25 16:52:50 -07:00
xtensa mm: now that all old mmu_gather code is gone, remove the storage 2011-05-25 08:39:16 -07:00
.gitignore
Kconfig mm, powerpc: move the RCU page-table freeing into generic code 2011-05-25 08:39:16 -07:00