• T
    x86: fix pageattr handling for lpage percpu allocator and re-enable it · e59a1bb2
    Tejun Heo 提交于
    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: NTejun Heo <tj@kernel.org>
    Reported-by: NJan Beulich <JBeulich@novell.com>
    Cc: Andi Kleen <andi@firstfloor.org>
    Cc: Ingo Molnar <mingo@elte.hu>
    e59a1bb2
pageattr.c 30.8 KB