[lkml]   [2005]   [Feb]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
Subject[PPC64] Hugepage hash flushing bugfix
Andrew, Linus, please apply:

Fix 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: David Gibson <>

Index: working-2.6/arch/ppc64/mm/tlb.c
--- working-2.6.orig/arch/ppc64/mm/tlb.c 2004-09-09 09:59:49.000000000 +1000
+++ working-2.6/arch/ppc64/mm/tlb.c 2005-02-25 14:56:47.000000000 +1100
@@ -85,8 +85,12 @@

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;

context = mm->;

David Gibson | I'll have my music baroque, and my code
david AT | minimalist. NOT _the_ _other_ _way_
| _around_!
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at
 \ /
  Last update: 2005-03-22 14:10    [W:0.032 / U:0.896 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site