From: shamir rabinovitch <shamir.rabinovitch@xxxxxxxxxx> The problem is that the function 'send_reply_to_slave' get the 'req_sa_mad' as pointer whose address can be unaligned to 8 bytes. In this case the compiler cannot know in advance what will be the alignment of the 'data' field. Sowmini Varadhan pointed to this reply from Dave Miller that say that memcpy should not be used to solve alignment issues: https://lkml.org/lkml/2015/10/21/352 Optimization of memcpy to 'ldx' instruction can only happen if the compiler see that the size of the data we copy is 8 bytes and it assume it is aligned to 8. If the compiler know the type is not aligned to 8 it must not optimize the 8 bytes copy. Defining the data type as aligned to 4 force the compiler to assume it is not aligned to 8 at all time. Full credit for the idea goes to Jason Gunthorpe <jgunthorpe@xxxxxxxxxxxxxxxxxxxx>. v3: Change patch according to suggestion by Jason Gunthorpe <jgunthorpe@xxxxxxxxxxxxxxxxxxxx> v2: Minor fix in patch headline by Or Gerlitz <gerlitz.or@xxxxxxxxx> Signed-off-by: shamir rabinovitch <shamir.rabinovitch@xxxxxxxxxx> --- drivers/infiniband/hw/mlx4/mcg.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/infiniband/hw/mlx4/mcg.c b/drivers/infiniband/hw/mlx4/mcg.c index 99451d8..0550017 100644 --- a/drivers/infiniband/hw/mlx4/mcg.c +++ b/drivers/infiniband/hw/mlx4/mcg.c @@ -96,7 +96,7 @@ struct ib_sa_mcmember_data { u8 scope_join_state; u8 proxy_join; u8 reserved[2]; -}; +} __packed __aligned(4); struct mcast_group { struct ib_sa_mcmember_data rec; -- 1.7.1 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html