On 05/18/2016 06:18 AM, shamir.rabinovitch@xxxxxxxxxx wrote: > 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> I considerably reworked the commit message, but otherwise applied. Thanks. -- Doug Ledford <dledford@xxxxxxxxxx> GPG KeyID: 0E572FDD
Attachment:
signature.asc
Description: OpenPGP digital signature