x86: fix pageattr handling for lpage percpu allocator and re-enable it
authorTejun Heo <tj@kernel.org>
Mon, 22 Jun 2009 02:56:24 +0000 (11:56 +0900)
committerTejun Heo <tj@kernel.org>
Mon, 22 Jun 2009 02:56:24 +0000 (11:56 +0900)
commite59a1bb2fdfb745c685f5b40ffbed126331d3223
treef2916a898b56f70554160f33be2252d15347fe8b
parent992f4c1c2c1583cef3296ec4bf5205843a9a5f3d
x86: fix pageattr handling for lpage percpu allocator and re-enable it

lpage allocator aliases a PMD page for each cpu and returns whatever
is unused to the page allocator.  When the pageattr of the recycled
pages are changed, this makes the two aliases point to the overlapping
regions with different attributes which isn't allowed and known to
cause subtle data corruption in certain cases.

This can be handled in simliar manner to the x86_64 highmap alias.
pageattr code should detect if the target pages have PMD alias and
split the PMD alias and synchronize the attributes.

pcpur allocator is updated to keep the allocated PMD pages map sorted
in ascending address order and provide pcpu_lpage_remapped() function
which binary searches the array to determine whether the given address
is aliased and if so to which address.  pageattr is updated to use
pcpu_lpage_remapped() to detect the PMD alias and split it up as
necessary from cpa_process_alias().

Jan Beulich spotted the original problem and incorrect usage of vaddr
instead of laddr for lookup.

With this, lpage percpu allocator should work correctly.  Re-enable
it.

[ Impact: fix subtle lpage pageattr bug and re-enable lpage ]

Signed-off-by: Tejun Heo <tj@kernel.org>
Reported-by: Jan Beulich <JBeulich@novell.com>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: Ingo Molnar <mingo@elte.hu>
arch/x86/include/asm/percpu.h
arch/x86/kernel/setup_percpu.c
arch/x86/mm/pageattr.c