[prev in list] [next in list] [prev in thread] [next in thread]
List: linux-rdma
Subject: Re: [PATCH] ib_ehca: fix compile failure on ppc64
From: Kyle McMartin <kmcmartin () redhat ! com>
Date: 2012-02-28 15:15:46
Message-ID: 20120228151545.GF29211 () redacted ! bos ! redhat ! com
[Download RAW message or body]
On Mon, Feb 27, 2012 at 09:18:35PM -0800, Roland Dreier wrote:
> On Mon, Feb 27, 2012 at 2:02 PM, Kyle McMartin <kmcmartin@redhat.com> 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 <roland@purestorage.com>
Signed-off-by: Kyle McMartin <kmcmarti@redhat.com>
--- 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 majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic