Re: [Xen-devel] [PATCH 01/24] arm: initial Xen support

From: Stefano Stabellini
Date: Mon Aug 06 2012 - 06:56:17 EST


On Wed, 1 Aug 2012, Konrad Rzeszutek Wilk wrote:
> > > > +struct pvclock_wall_clock {
> > > > + u32 version;
> > > > + u32 sec;
> > > > + u32 nsec;
> > > > +} __attribute__((__packed__));
> > >
> > > That is weird. It is 4+4+4 = 12 bytes? Don't you want it to be 16 bytes?
> >
> > I agree that 16 bytes would be a better choice, but it needs to match
> > the struct in Xen that is defined as follow:
> >
> > uint32_t wc_version; /* Version counter: see vcpu_time_info_t. */
> > uint32_t wc_sec; /* Secs 00:00:00 UTC, Jan 1, 1970. */
> > uint32_t wc_nsec; /* Nsecs 00:00:00 UTC, Jan 1, 1970. */
>
> Would it make sense to add some paddigin then at least? In both
> cases? Or is it too late for this?

I can see why adding some padding would be useful if the structs were
not packed and we wanted to enforce 32/64 bit compatibility on x86.
However on ARM the field alignments on 32 and 64 bits are the same for
integer values so the padding wouldn't make a difference.
In any case both structs are packed, so the alignment is forced to be the
same by the compiler.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/