On Mon, Feb 27, 2012 at 09:18:35PM -0800, Roland Dreier wrote: > On Mon, Feb 27, 2012 at 2:02 PM, Kyle McMartin <[email protected]> wrote: > > static u64 ehca_get_max_hwpage_size(struct ehca_shca *shca) > > { > > - return 1UL << ilog2(shca->hca_cap_mr_pgsize); > > + u32 pgsize = shca->hca_cap_mr_pgsize; > > + return 1UL << ilog2(pgsize); > > } > > How about using rounddown_pow_of_two(shca->hca_cap_mr_pgsize)? > Does that build? Because that seems to me to be a cleaner way of > expressing this anyway... >
Yeah, that works too, good catch, I should have noticed that sooner. > Something about that ilog2() implementation seems to trigger gcc > bugs, I seem to remember some other bogus compile failure on > sparc involving it as well... > I suspect it's the 64 deep trinary operators ;-) (It seems to trip up on the __builtin_constant_p and hit the second ____ilog2_NaN) It's a pretty weird .config dependent bug, I'm very confused by it. Suggested-by: Roland Dreier <[email protected]> Signed-off-by: Kyle McMartin <[email protected]> --- a/drivers/infiniband/hw/ehca/ehca_mrmw.c +++ b/drivers/infiniband/hw/ehca/ehca_mrmw.c @@ -112,7 +112,7 @@ static u32 ehca_encode_hwpage_size(u32 pgsize) static u64 ehca_get_max_hwpage_size(struct ehca_shca *shca) { - return 1UL << ilog2(shca->hca_cap_mr_pgsize); + return rounddown_pow_of_two(shca->hca_cap_mr_pgsize); } static struct ehca_mr *ehca_mr_new(void) -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
