[PPC64] Hugepage hash flushing bugfix

From: David Gibson (david_at_gibson.dropbear.id.au)
Date: 02/25/05

  • Next message: Mike Galbraith: "Re: Xterm Hangs - Possible scheduler defect?"
    Date:	Fri, 25 Feb 2005 15:14:46 +1100
    To: Andrew Morton <akpm@osdl.org>, Linus Torvalds <torvalds@osdl.org>
    
    

    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 <dwg@au1.ibm.com>

    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;
     
             if (REGION_ID(addr) == USER_REGION_ID)
                     context = mm->context.id;

    -- 
    David Gibson			| I'll have my music baroque, and my code
    david AT gibson.dropbear.id.au	| minimalist.  NOT _the_ _other_ _way_
    				| _around_!
    http://www.ozlabs.org/people/dgibson
    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at  http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at  http://www.tux.org/lkml/
    

  • Next message: Mike Galbraith: "Re: Xterm Hangs - Possible scheduler defect?"

    Relevant Pages

    • Re: [PPC64] Hugepage hash flushing bugfix
      ... > ppc64 hugepage code. ... > address for hugepages, so pte_clear(which we use for hugepage ptes ... > duplicate hash entries, which is very bad. ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: [BUG] hugetlb MAP_PRIVATE mapping vs /dev/zero
      ... For now forcing VM_SHARED in the hugetlbfs code is ... but if we ever allow MAP_PRIVATE hugepage mappings ... > shared which is tripping up zeromap as the fact that it isn't mapped ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: Kill off hugepage_vma()
      ... >> hugepage pagetables, rather than being looked up in the normal ... than leaving it as two functions for a reason - akpm indicated that he ... better myself, too, although it's not a strong preference. ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: [PATCH 0/4] Swap migration V3: Overview
      ... Hugepage pagefaulting is being worked on by Hugh and Adam Litke. ... fragmentation avoidance patches plus memory defragmentation using memory ... So all bits should be around for hugepage migration by now? ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: [Lhms-devel] [PATCH 0/7] Fragmentation Avoidance V19
      ... Well I think it can satisfy hugepage allocations simply because ... Send instant messages to your online friends http://au.messenger.yahoo.com ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)