[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAK8P3a0HNOCOSx9UONw6gf1UUU8J4iAOmMFP8-DtJ3O7XAACsQ@mail.gmail.com>
Date: Mon, 30 May 2022 15:35:28 +0200
From: Arnd Bergmann <arnd@...db.de>
To: Jani Nikula <jani.nikula@...el.com>
Cc: Arnd Bergmann <arnd@...db.de>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Sudip Mukherjee <sudipm.mukherjee@...il.com>,
Russell King <linux@...linux.org.uk>,
Viresh Kumar <vireshk@...nel.org>,
Shiraz Hashim <shiraz.linux.kernel@...il.com>,
Ville Syrjälä <ville.syrjala@...ux.intel.com>,
Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>,
Maxime Ripard <mripard@...nel.org>,
Thomas Zimmermann <tzimmermann@...e.de>,
David Airlie <airlied@...ux.ie>,
Daniel Vetter <daniel@...ll.ch>,
dri-devel <dri-devel@...ts.freedesktop.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Linux ARM <linux-arm-kernel@...ts.infradead.org>,
SoC Team <soc@...nel.org>
Subject: Re: mainline build failure due to f1e4c916f97f ("drm/edid: add EDID
block count and size helpers")
On Mon, May 30, 2022 at 3:10 PM Jani Nikula <jani.nikula@...el.com> wrote:
> >
> > I think in general, most __packed annotations we have in the kernel are
> > completely pointless because they do not change the structure layout on
> > any architecture but instead just make member access slower on
>
> Please explain.
>
> They are used quite a bit for parsing blob data, or
> serialization/deserialization, like in the EDID case at hand. Try
> removing __attribute__((packed)) from include/drm/drm_edid.h and see the
> sizeof(struct edid) on any architecture.
The annotations for edid are completely correct and necessary. However
other driver authors just slap __packed annotations on any structure
even if the layout is not fixed at all like:
struct my_driver_priv {
struct device dev;
u8 causes_misalignment;
spinlock_t lock;
atomic_t counter;
} __packed; /* this annotation is harmful because it breaks the atomics */
or if the annotation does not change the layout like
struct my_dma_descriptor {
__le64 address;
__le64 length;
} __packed; /* does not change layout but makes access slow on some
architectures */
Arnd
Powered by blists - more mailing lists