* [iproute] rdma broken on 32 bit
@ 2018-12-10 22:10 Stephen Hemminger
2018-12-11 17:33 ` Leon Romanovsky
0 siblings, 1 reply; 3+ messages in thread
From: Stephen Hemminger @ 2018-12-10 22:10 UTC (permalink / raw)
To: Leon Romanovsky, David Ahern; +Cc: netdev
It appears that RDMA is broken on 32 bit platforms.
Sure you don't run on 32bit, but iproute2 needs to build everywhere.
The issue is that you are assuming a C enum can hold 64 bits.
The standard says enum only has to hold "int" values.
So it breaks on 32bit.
The issue is deeper than just a trivial fix. Please either change iproute
config script to not build RDMA if sizeof(enum) < 64 or fix the code to
use a safe value like uint64_t.
rdma
CC rdma.o
CC utils.o
CC dev.o
CC link.o
In file included from rdma.h:26:0,
from dev.c:12:
dev.c: In function ‘dev_caps_to_str’:
../include/utils.h:269:38: warning: left shift count >= width of type [-Wshift-count-overflow]
#define BIT(nr) (1UL << (nr))
^
rdma.h:32:61: note: in expansion of macro ‘BIT’
#define RDMA_BITMAP_ENUM(name, bit_no) RDMA_BITMAP_##name = BIT(bit_no),
^~~
If you wade through the macro swamp:
dev.c
#define RDMA_DEV_FLAGS(x) \
x(SG_GAPS_REG, 32) \
enum { RDMA_DEV_FLAGS(RDMA_BITMAP_ENUM) };
Expands to:
enum {
RDMA_BITMAP_SG_GAPS_REG = (1UL << (32)),
};
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [iproute] rdma broken on 32 bit
2018-12-10 22:10 [iproute] rdma broken on 32 bit Stephen Hemminger
@ 2018-12-11 17:33 ` Leon Romanovsky
2018-12-13 21:15 ` Stephen Hemminger
0 siblings, 1 reply; 3+ messages in thread
From: Leon Romanovsky @ 2018-12-11 17:33 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: David Ahern, netdev@vger.kernel.org
[-- Attachment #1: Type: text/plain, Size: 1477 bytes --]
On Mon, Dec 10, 2018 at 02:10:20PM -0800, Stephen Hemminger wrote:
> It appears that RDMA is broken on 32 bit platforms.
> Sure you don't run on 32bit, but iproute2 needs to build everywhere.
>
> The issue is that you are assuming a C enum can hold 64 bits.
> The standard says enum only has to hold "int" values.
> So it breaks on 32bit.
>
> The issue is deeper than just a trivial fix. Please either change iproute
> config script to not build RDMA if sizeof(enum) < 64 or fix the code to
> use a safe value like uint64_t.
>
> rdma
> CC rdma.o
> CC utils.o
> CC dev.o
> CC link.o
> In file included from rdma.h:26:0,
> from dev.c:12:
> dev.c: In function ‘dev_caps_to_str’:
> ../include/utils.h:269:38: warning: left shift count >= width of type [-Wshift-count-overflow]
> #define BIT(nr) (1UL << (nr))
> ^
> rdma.h:32:61: note: in expansion of macro ‘BIT’
> #define RDMA_BITMAP_ENUM(name, bit_no) RDMA_BITMAP_##name = BIT(bit_no),
> ^~~
> If you wade through the macro swamp:
> dev.c
> #define RDMA_DEV_FLAGS(x) \
>
> x(SG_GAPS_REG, 32) \
>
> enum { RDMA_DEV_FLAGS(RDMA_BITMAP_ENUM) };
>
> Expands to:
> enum {
> RDMA_BITMAP_SG_GAPS_REG = (1UL << (32)),
> };
>
Thanks for the report, I reproduced and will do my best to send patches tomorrow.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 801 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [iproute] rdma broken on 32 bit
2018-12-11 17:33 ` Leon Romanovsky
@ 2018-12-13 21:15 ` Stephen Hemminger
0 siblings, 0 replies; 3+ messages in thread
From: Stephen Hemminger @ 2018-12-13 21:15 UTC (permalink / raw)
To: Leon Romanovsky; +Cc: David Ahern, netdev@vger.kernel.org
[-- Attachment #1: Type: text/plain, Size: 1695 bytes --]
On Tue, 11 Dec 2018 17:33:19 +0000
Leon Romanovsky <leonro@mellanox.com> wrote:
> On Mon, Dec 10, 2018 at 02:10:20PM -0800, Stephen Hemminger wrote:
> > It appears that RDMA is broken on 32 bit platforms.
> > Sure you don't run on 32bit, but iproute2 needs to build everywhere.
> >
> > The issue is that you are assuming a C enum can hold 64 bits.
> > The standard says enum only has to hold "int" values.
> > So it breaks on 32bit.
> >
> > The issue is deeper than just a trivial fix. Please either change iproute
> > config script to not build RDMA if sizeof(enum) < 64 or fix the code to
> > use a safe value like uint64_t.
> >
> > rdma
> > CC rdma.o
> > CC utils.o
> > CC dev.o
> > CC link.o
> > In file included from rdma.h:26:0,
> > from dev.c:12:
> > dev.c: In function ‘dev_caps_to_str’:
> > ../include/utils.h:269:38: warning: left shift count >= width of type [-Wshift-count-overflow]
> > #define BIT(nr) (1UL << (nr))
> > ^
> > rdma.h:32:61: note: in expansion of macro ‘BIT’
> > #define RDMA_BITMAP_ENUM(name, bit_no) RDMA_BITMAP_##name = BIT(bit_no),
> > ^~~
> > If you wade through the macro swamp:
> > dev.c
> > #define RDMA_DEV_FLAGS(x) \
> >
> > x(SG_GAPS_REG, 32) \
> >
> > enum { RDMA_DEV_FLAGS(RDMA_BITMAP_ENUM) };
> >
> > Expands to:
> > enum {
> > RDMA_BITMAP_SG_GAPS_REG = (1UL << (32)),
> > };
> >
>
> Thanks for the report, I reproduced and will do my best to send patches tomorrow.
Thanks for fixing it so fast. Applied your fix
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-12-13 21:15 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-12-10 22:10 [iproute] rdma broken on 32 bit Stephen Hemminger
2018-12-11 17:33 ` Leon Romanovsky
2018-12-13 21:15 ` Stephen Hemminger
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).