Skip to contentSkip to conversation

rdma-roce build quesiton

For help oulijun 2 participants 3 messages Oct 26, 2016 – Oct 27, 2016 2 messages not in the archive InfiniBand

lore
Share & tools
lore

oulijun

author
#0 lore raw

Hi, Jason
I am building my userspace library code using cmake. after i fix some lines, it is failed.

I directly called the min() from the ccan/minmax.h, the min() as follows:

#if HAVE_BUILTIN_TYPES_COMPATIBLE_P
#define MINMAX_ASSERT_COMPATIBLE(a, b) \
BUILD_ASSERT(__builtin_types_compatible_p(a, b))
#else
#define MINMAX_ASSERT_COMPATIBLE(a, b) \
do { } while (0)
#endif

#define min(a, b) \
({ \
typeof(a) _a = (a); \
typeof(b) _b = (b); \
MINMAX_ASSERT_COMPATIBLE(typeof(_a), typeof(_b)); \
_a < _b ? _a : _b; \
})

and use #include <ccan/minmax.h> in my .c file where is used the min()

according to the modification, I use the cmd as follows:
CC=aarch64-linux-gnu-gcc cmake -GNinja -DENABLE_RESOLVE_NEIGH=0 -DHAVE_ARCH_ARM64=1 ..

the build is fail and the print log as follows:

error: size of unnamed array is negative attr->cap.max_recv_wr = min(context->max_qp_wr, attr->cap.max_recv_wr);

Now, after fixed, the error is elimed. the fix as follows:
Fix the HAVE_BUILTIN_TYPES_COMPATIBLE_P for 0 in config.h.in or use the origin definition in my .h file

the origin defintion:
#define min(a, b) \
({ \
typeof(a) _a = (a); \
typeof(b) _b = (b); \
_a < _b ? _a : _b; \
})

but I think that the above modification is not a better approach
I try to change the Optimization Option(from -O0 to -O2) in aarch64-linux-gnu-gcc by finded some material. CC=aarch64-linux-gnu-gcc cmake -O2 -GNinja -DENABLE_RESOLVE_NEIGH=0 -DHAVE_ARCH_ARM64=1 ..

But the error is not elimed.

Can you give me some guide?

thanks
Lijun ou

--
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

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw
Quoted 4 lines · oulijun

the build is fail and the print log as follows:

error: size of unnamed array is negative attr->cap.max_recv_wr = min(context->max_qp_wr, attr->cap.max_recv_wr);

It is telling you the types are not the same, and this is a source of bugs as C has some counter intuitive rules regarding type promotion.

1) Audit max_qp_wr and max_recv_wr to see if they really should be different types, if not fix context->max_qp_wr to match

2) If they are legitimately different then use

  min_t(<desired type>, context->max_qp_wr, attr->cap.max_recv_wr);

Think carefully about what common type is used because both arguments will be casted, and the goal is to avoid a loss of precision or signdedness in the cast.

Jason
--
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

A message that is not in the archive (sent off-list or not yet received): 20161026160902.GD24898-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org

author
#4 lore raw
Quoted 17 lines · Jason Gunthorpe
Quoted 4 lines · oulijun

the build is fail and the print log as follows:

error: size of unnamed array is negative attr->cap.max_recv_wr = min(context->max_qp_wr, attr->cap.max_recv_wr);

It is telling you the types are not the same, and this is a source of bugs as C has some counter intuitive rules regarding type promotion.

1) Audit max_qp_wr and max_recv_wr to see if they really should be different types, if not fix context->max_qp_wr to match

2) If they are legitimately different then use

  min_t(<desired type>, context->max_qp_wr, attr->cap.max_recv_wr);
Quoted 8 lines

Think carefully about what common type is used because both arguments will be casted, and the goal is to avoid a loss of precision or signdedness in the cast.

Jason

.

thanks, I see it.

--
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