Commit 16d5c084 authored by David Gibson's avatar David Gibson Committed by Linus Torvalds

[PATCH] ppc64: hugepage hash flushing bugfix

This fixes a potentially bad (although very rarely triggered) bug in the
ppc64 hugepage code.

hpte_update() did not correctly calculate the address for hugepages, so
pte_clear() (which we use for hugepage ptes as well as normal ones)
would not correctly flush the hash page table entry.  Under the right
circumstances this could potentially lead to duplicate hash entries,
which is very bad.

davem's upcoming patch to pass the virtual address directly to set_pte()
and its ilk will obsolete this, but this is bad enough it should
probably be fixed in the meantime.
Signed-off-by: default avatarDavid Gibson <dwg@au1.ibm.com>
Acked-by: default avatarWilliam Irwin <wli@holomorphy.com>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 8672a651
......@@ -85,8 +85,12 @@ void hpte_update(pte_t *ptep, unsigned long pte, int wrprot)
ptepage = virt_to_page(ptep);
mm = (struct mm_struct *) ptepage->mapping;
addr = ptepage->index +
(((unsigned long)ptep & ~PAGE_MASK) * PTRS_PER_PTE);
addr = ptepage->index;
if (pte_huge(pte))
addr += ((unsigned long)ptep & ~PAGE_MASK)
/ sizeof(*ptep) * HPAGE_SIZE;
else
addr += ((unsigned long)ptep & ~PAGE_MASK) * PTRS_PER_PTE;
if (REGION_ID(addr) == USER_REGION_ID)
context = mm->context.id;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment