> Quoting Jason Gunthorpe <[EMAIL PROTECTED]>:
> Subject: Re: [openib-general] [PATCH] IB/core - ib_umad can cause address 
> alignment fault on ia64
> 
> On Thu, Jan 18, 2007 at 06:14:31PM +0200, Michael S. Tsirkin wrote:
> 
> > So the issue is that we are casting char *data which has no
> > alignment guarantees to 64 bit number. We really must find a way to
> > force 64 bit alignment for struct ib_user_mad all over. Would not
> > something like the following simple trick work?
>  
> > struct ib_user_mad_hdr {
> >     .............
> > } __attribute__((aligned (8)));
> 
> You might get a similar result if you change:
> 
> struct ib_user_mad {
>         struct ib_user_mad_hdr hdr;
>         __u8    data[0];
> };
> 
> To
> 
> struct ib_user_mad {
>         struct ib_user_mad_hdr hdr;
>         __u64    data[0];
> };
> 
> Which is more clear since it is the data[0] that has the alignment
> requirement not the ib_usr_mad_hdr..

Hmm. Good idea. Patch?

Need to audit the code from other cases of 'u8 data'
being cast or a struct with 64 bit field, BTW.

> Plus you only get the pad if you actually need it.

You mean, no pad if ib_user_mad_hdr is used separately?

-- 
MST

_______________________________________________
openib-general mailing list
[email protected]
http://openib.org/mailman/listinfo/openib-general

To unsubscribe, please visit http://openib.org/mailman/listinfo/openib-general

Reply via email to