From: James Hogan > On 03/02/14 10:35, David Laight wrote: > > From: James Hogan > >> Combining __packed with __aligned(2) does the trick though (__packed > >> alone sets __aligned(1) which is obviously going to be suboptimal). ... > > Meta is also one of those arches, and according to my quick tests, > __packed alone does correctly make it fall back to byte loads/stores, > but with __packed __aligned(2) it uses 16bit loads/stores. I've also > confirmed that with an ARM toolchain (see below for example).
I would either: 1a) Add explicit padding to the relevant structures so that they are multiple of 4 bytes. or: 1b) #define some token to "__packed __aligned(2)" before all the structures that require changing, and use that in there definitions. This lets you comment on WHY you are doing it. and: 2) Add a compile-time assert that the structures are the correct size. Clearly you don't want to mark anything that contains a 32bit value with __packed __aligned(2). I'm not at all clear whether you are sometimes using a different compiler. David -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/