[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <74849e23af4d480f8a990a7924fc48e1@AcuMS.aculab.com>
Date: Tue, 14 Aug 2018 13:09:34 +0000
From: David Laight <David.Laight@...LAB.COM>
To: 'Arnd Bergmann' <arnd@...db.de>
CC: Johannes Berg <johannes@...solutions.net>,
Masahiro Yamada <yamada.masahiro@...ionext.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Jakub Kicinski <jakub.kicinski@...ronome.com>,
Andy Shevchenko <andy.shevchenko@...il.com>,
Al Viro <viro@...iv.linux.org.uk>,
"Linux Kernel Mailing List" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH] bitfield: avoid gcc-8 -Wint-in-bool-context warning
From: Arnd Bergmann
> Sent: 14 August 2018 12:08
...
> > There are also a whole load of crappy __packed in that header file.
> > There might be one or two 64bit items on 32bit boundaries but
> > that can be solved without using __packed.
>
> Agreed, this likely causes problems on architectures without unaligned
> load/store instructions that end up doing byte accesses to the descriptor
> fields, which in turn can confuse the hardware, and can become very
> slow when they live in dma_alloc_coherent() memory. That looks
> like a completely unrelated issue though.
If you ever define a variable of one of those types (or embed one
in another structure that contains non-word sized items) you'll
get the entire structure misaligned.
I doubt that is what you had in mind.
Maybe you could use __packed __attribute__((aligned(4))).
But it is much better just to use a 64bit type with only 4 byte alignment
(I think there is a standard one in one of the header files).
I'd also add a compile-time assert on the length of the non-trivial
structures. That will detect all sorts of errors.
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
Powered by blists - more mailing lists