Thread (26 messages) 26 messages, 5 authors, 2011-12-09

Re: [PATCH 03/13] powerpc: Fix booke hugetlb preload code for PPC_MM_SLICES and 64-bit

From: Kumar Gala <hidden>
Date: 2011-11-28 16:01:23

On Nov 24, 2011, at 6:43 PM, Benjamin Herrenschmidt wrote:
On Mon, 2011-10-10 at 15:50 -0500, Becky Bruce wrote:
=20
.../...
=20
quoted
#ifdef CONFIG_PPC_MM_SLICES
-	psize =3D mmu_get_tsize(get_slice_psize(mm, ea));
-	tsize =3D mmu_get_psize(psize);
+	psize =3D get_slice_psize(mm, ea);
+	tsize =3D mmu_get_tsize(psize);
	shift =3D mmu_psize_defs[psize].shift;
#else
-	vma =3D find_vma(mm, ea);
-	psize =3D vma_mmu_pagesize(vma);	/* returns actual size =
in bytes */
quoted
-	asm (PPC_CNTLZL "%0,%1" : "=3Dr" (lz) : "r" (psize));
-	shift =3D 31 - lz;
-	tsize =3D 21 - lz;
+	psize =3D vma_mmu_pagesize(find_vma(mm, ea));
+	shift =3D __ilog2(psize);
+	tsize =3D shift - 10;
#endif
=20
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...
=20
Now, the caller is just doing:
=20
	book3e_hugetlb_preload(vma->vm_mm, address, *ptep);
=20
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=
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help