lkml.org 
[lkml]   [2013]   [Dec]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH 1/6] GenWQE PCI support, health monitoring and recovery
Date
On Thursday 05 December 2013, Frank Haverkamp wrote:
> > > Was wrong, as already pointed out before. It is now:
> > >
> > > struct genwqe_mem {
> > > __u64 addr;
> > > __u64 size;
> > > int direction;
> > > };
> > >
> > > I hope the int is ok here.
> >
> > No, it's not. The problem is that sizeof(struct genwqe_mem) is now 24 on
> > most architectures (including x86-64) and 20 on x86-32.
>
> Interesting. So int is like long architecture specific. I changed it to
> be __u64 too, to avoid any problem.

The solution is ok, but the problem is different from what you thought:

On all architectures that Linux runs on, 'int' is 32 bit. The problem is
again the alignment of __u64. On normal architectures, it is naturally
aligned, and gcc adds 4 byte padding so that 'sizeof (struct genwqe_mem)'
is multiple of the required alignment. On x86-32, the required alignment
for the __u64 members is only 4 bytes, so no padding is added.

Arnd


\
 
 \ /
  Last update: 2013-12-05 22:01    [W:1.878 / U:0.416 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site