Re: [PATCH 03/13] powerpc: Fix booke hugetlb preload code for PPC_MM_SLICES and 64-bit
On Nov 24, 2011, at 6:43 PM, Benjamin Herrenschmidt wrote: On Mon, 2011-10-10 at 15:50 -0500, Becky Bruce wrote: .../... #ifdef CONFIG_PPC_MM_SLICES -psize = mmu_get_tsize(get_slice_psize(mm, ea)); -tsize = mmu_get_psize(psize); +psize = get_slice_psize(mm, ea); +tsize = mmu_get_tsize(psize); shift = mmu_psize_defs[psize].shift; #else -vma = find_vma(mm, ea); -psize = vma_mmu_pagesize(vma); /* returns actual size in bytes */ -asm (PPC_CNTLZL %0,%1 : =r (lz) : r (psize)); -shift = 31 - lz; -tsize = 21 - lz; +psize = vma_mmu_pagesize(find_vma(mm, ea)); +shift = __ilog2(psize); +tsize = shift - 10; #endif Now, I know it was already there and you are just moving it around in this patch but come on ... find_vma() here ? Really ? And with no result checking nor boundary checking (remember it can return a vma that doesn't enclose the address etc). Now I know in this specific case it -should- be safe but still... Now, the caller is just doing: book3e_hugetlb_preload(vma-vm_mm, address, *ptep); So why not just change the prototype and pass the vma down instead ? Can we do this on top of the patchset instead of changing the existing patchset? - k ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH 03/13] powerpc: Fix booke hugetlb preload code for PPC_MM_SLICES and 64-bit
On Nov 24, 2011, at 6:43 PM, Benjamin Herrenschmidt wrote: On Mon, 2011-10-10 at 15:50 -0500, Becky Bruce wrote: .../... #ifdef CONFIG_PPC_MM_SLICES -psize = mmu_get_tsize(get_slice_psize(mm, ea)); -tsize = mmu_get_psize(psize); +psize = get_slice_psize(mm, ea); +tsize = mmu_get_tsize(psize); shift = mmu_psize_defs[psize].shift; #else -vma = find_vma(mm, ea); -psize = vma_mmu_pagesize(vma); /* returns actual size in bytes */ -asm (PPC_CNTLZL %0,%1 : =r (lz) : r (psize)); -shift = 31 - lz; -tsize = 21 - lz; +psize = vma_mmu_pagesize(find_vma(mm, ea)); +shift = __ilog2(psize); +tsize = shift - 10; #endif Now, I know it was already there and you are just moving it around in this patch but come on ... find_vma() here ? Really ? And with no result checking nor boundary checking (remember it can return a vma that doesn't enclose the address etc). Now I know in this specific case it -should- be safe but still... Now, the caller is just doing: book3e_hugetlb_preload(vma-vm_mm, address, *ptep); So why not just change the prototype and pass the vma down instead ? There's no reason - I just left the prototype the way it was in the original code, but it makes sense to change it given the changes to the function. Respin coming. -B ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH 03/13] powerpc: Fix booke hugetlb preload code for PPC_MM_SLICES and 64-bit
return; #ifdef CONFIG_PPC_MM_SLICES - psize = mmu_get_tsize(get_slice_psize(mm, ea)); - tsize = mmu_get_psize(psize); + psize = get_slice_psize(mm, ea); + tsize = mmu_get_tsize(psize); shift = mmu_psize_defs[psize].shift; #else - vma = find_vma(mm, ea); - psize = vma_mmu_pagesize(vma); /* returns actual size in bytes */ - asm (PPC_CNTLZL %0,%1 : =r (lz) : r (psize)); - shift = 31 - lz; - tsize = 21 - lz; + psize = vma_mmu_pagesize(find_vma(mm, ea)); + shift = __ilog2(psize); + tsize = shift - 10; #endif BTW. Can you remind me what is the business with slices vs. no slices on Book3E ? I'd like to avoid having to build separate kernels for A2 vs. FSL ... Cheers, Ben. ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH 03/13] powerpc: Fix booke hugetlb preload code for PPC_MM_SLICES and 64-bit
On Mon, 2011-10-10 at 15:50 -0500, Becky Bruce wrote: .../... #ifdef CONFIG_PPC_MM_SLICES - psize = mmu_get_tsize(get_slice_psize(mm, ea)); - tsize = mmu_get_psize(psize); + psize = get_slice_psize(mm, ea); + tsize = mmu_get_tsize(psize); shift = mmu_psize_defs[psize].shift; #else - vma = find_vma(mm, ea); - psize = vma_mmu_pagesize(vma); /* returns actual size in bytes */ - asm (PPC_CNTLZL %0,%1 : =r (lz) : r (psize)); - shift = 31 - lz; - tsize = 21 - lz; + psize = vma_mmu_pagesize(find_vma(mm, ea)); + shift = __ilog2(psize); + tsize = shift - 10; #endif Now, I know it was already there and you are just moving it around in this patch but come on ... find_vma() here ? Really ? And with no result checking nor boundary checking (remember it can return a vma that doesn't enclose the address etc). Now I know in this specific case it -should- be safe but still... Now, the caller is just doing: book3e_hugetlb_preload(vma-vm_mm, address, *ptep); So why not just change the prototype and pass the vma down instead ? Cheers, Ben. ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH 03/13] powerpc: Fix booke hugetlb preload code for PPC_MM_SLICES and 64-bit
From: Becky Bruce bec...@kernel.crashing.org This patch does 2 things: It corrects the code that determines the size to write into MAS1 for the PPC_MM_SLICES case (this originally came from David Gibson and I had incorrectly altered it), and it changes the methodolody used to calculate the size for !PPC_MM_SLICES to work for 64-bit as well as 32-bit. Signed-off-by: Becky Bruce bec...@kernel.crashing.org Signed-off-by: David Gibson da...@gibson.dropbear.id.au --- arch/powerpc/mm/hugetlbpage-book3e.c | 15 ++- 1 files changed, 6 insertions(+), 9 deletions(-) diff --git a/arch/powerpc/mm/hugetlbpage-book3e.c b/arch/powerpc/mm/hugetlbpage-book3e.c index 343ad0b..4d6d849 100644 --- a/arch/powerpc/mm/hugetlbpage-book3e.c +++ b/arch/powerpc/mm/hugetlbpage-book3e.c @@ -45,23 +45,20 @@ void book3e_hugetlb_preload(struct mm_struct *mm, unsigned long ea, pte_t pte) unsigned long flags; #ifdef CONFIG_PPC_FSL_BOOK3E - int index, lz, ncams; - struct vm_area_struct *vma; + int index, ncams; #endif if (unlikely(is_kernel_addr(ea))) return; #ifdef CONFIG_PPC_MM_SLICES - psize = mmu_get_tsize(get_slice_psize(mm, ea)); - tsize = mmu_get_psize(psize); + psize = get_slice_psize(mm, ea); + tsize = mmu_get_tsize(psize); shift = mmu_psize_defs[psize].shift; #else - vma = find_vma(mm, ea); - psize = vma_mmu_pagesize(vma); /* returns actual size in bytes */ - asm (PPC_CNTLZL %0,%1 : =r (lz) : r (psize)); - shift = 31 - lz; - tsize = 21 - lz; + psize = vma_mmu_pagesize(find_vma(mm, ea)); + shift = __ilog2(psize); + tsize = shift - 10; #endif /* -- 1.5.6.5 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev