From: Jani Nikula <jani.nikula@intel.com>
To: Arnd Bergmann <arnd@arndb.de>
Cc: "Linus Torvalds" <torvalds@linux-foundation.org>,
"Arnd Bergmann" <arnd@arndb.de>,
"Sudip Mukherjee" <sudipm.mukherjee@gmail.com>,
"Russell King" <linux@armlinux.org.uk>,
"Viresh Kumar" <vireshk@kernel.org>,
"Shiraz Hashim" <shiraz.linux.kernel@gmail.com>,
"Ville Syrjälä" <ville.syrjala@linux.intel.com>,
"Maarten Lankhorst" <maarten.lankhorst@linux.intel.com>,
"Maxime Ripard" <mripard@kernel.org>,
"Thomas Zimmermann" <tzimmermann@suse.de>,
"David Airlie" <airlied@linux.ie>,
"Daniel Vetter" <daniel@ffwll.ch>,
dri-devel <dri-devel@lists.freedesktop.org>,
"Linux Kernel Mailing List" <linux-kernel@vger.kernel.org>,
"Linux ARM" <linux-arm-kernel@lists.infradead.org>,
"SoC Team" <soc@kernel.org>
Subject: Re: mainline build failure due to f1e4c916f97f ("drm/edid: add EDID block count and size helpers")
Date: Mon, 30 May 2022 16:10:08 +0300 [thread overview]
Message-ID: <87czfvrwsv.fsf@intel.com> (raw)
In-Reply-To: <CAK8P3a0-S77QLR1dK3NT6ot7JTAD5AdojAZJr-Xi112-v5EOdw@mail.gmail.com>
On Mon, 30 May 2022, Arnd Bergmann <arnd@arndb.de> wrote:
> On Mon, May 30, 2022 at 11:33 AM Jani Nikula <jani.nikula@intel.com> wrote:
>>
>> That is, for EDID. Makes you wonder about all the other packed structs
>> with enum members across the kernel.
>
> It is not the 'enum' that is special here, it's the 'union' having
> unpacked members,
Obviously meant union not enum, that was just a -ENOCOFFEE on my part.
> and the same thing happens when you have nested structs: both the inner
> and the outer aggregate need to be packed, either with __packed at the
> end, or on each individual member that is not fully aligned to
> max(sizeof(member), 4)).
>
> 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.
BR,
Jani.
> architectures that lack unaligned load/store instructions. There have
> definitely been other cases though where a __packed annotation is
> not needed on any sane architecture but is needed for OABI ARM.
>
> Overall I'm not that worried because the only machines running OABI
> kernels would be on really old hardware that runs a limited set of
> driver code.
>
> A completely different matter are the extraneous __packed annotations
> that lead to possible problems when accessed through a misaligned
> pointer. We ignore -Waddress-of-packed-member and -Wcast-align
> in the kernel, so these never get caught at build time, but we have
> seen bugs from gcc making incorrect assumptions about alignment
> even on architectures that have unaligned load/store instructions.
>
> Arnd
--
Jani Nikula, Intel Open Source Graphics Center
WARNING: multiple messages have this Message-ID (diff)
From: Jani Nikula <jani.nikula@intel.com>
To: Arnd Bergmann <arnd@arndb.de>
Cc: "Linus Torvalds" <torvalds@linux-foundation.org>,
"Arnd Bergmann" <arnd@arndb.de>,
"Sudip Mukherjee" <sudipm.mukherjee@gmail.com>,
"Russell King" <linux@armlinux.org.uk>,
"Viresh Kumar" <vireshk@kernel.org>,
"Shiraz Hashim" <shiraz.linux.kernel@gmail.com>,
"Ville Syrjälä" <ville.syrjala@linux.intel.com>,
"Maarten Lankhorst" <maarten.lankhorst@linux.intel.com>,
"Maxime Ripard" <mripard@kernel.org>,
"Thomas Zimmermann" <tzimmermann@suse.de>,
"David Airlie" <airlied@linux.ie>,
"Daniel Vetter" <daniel@ffwll.ch>,
dri-devel <dri-devel@lists.freedesktop.org>,
"Linux Kernel Mailing List" <linux-kernel@vger.kernel.org>,
"Linux ARM" <linux-arm-kernel@lists.infradead.org>,
"SoC Team" <soc@kernel.org>
Subject: Re: mainline build failure due to f1e4c916f97f ("drm/edid: add EDID block count and size helpers")
Date: Mon, 30 May 2022 16:10:08 +0300 [thread overview]
Message-ID: <87czfvrwsv.fsf@intel.com> (raw)
In-Reply-To: <CAK8P3a0-S77QLR1dK3NT6ot7JTAD5AdojAZJr-Xi112-v5EOdw@mail.gmail.com>
On Mon, 30 May 2022, Arnd Bergmann <arnd@arndb.de> wrote:
> On Mon, May 30, 2022 at 11:33 AM Jani Nikula <jani.nikula@intel.com> wrote:
>>
>> That is, for EDID. Makes you wonder about all the other packed structs
>> with enum members across the kernel.
>
> It is not the 'enum' that is special here, it's the 'union' having
> unpacked members,
Obviously meant union not enum, that was just a -ENOCOFFEE on my part.
> and the same thing happens when you have nested structs: both the inner
> and the outer aggregate need to be packed, either with __packed at the
> end, or on each individual member that is not fully aligned to
> max(sizeof(member), 4)).
>
> 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.
BR,
Jani.
> architectures that lack unaligned load/store instructions. There have
> definitely been other cases though where a __packed annotation is
> not needed on any sane architecture but is needed for OABI ARM.
>
> Overall I'm not that worried because the only machines running OABI
> kernels would be on really old hardware that runs a limited set of
> driver code.
>
> A completely different matter are the extraneous __packed annotations
> that lead to possible problems when accessed through a misaligned
> pointer. We ignore -Waddress-of-packed-member and -Wcast-align
> in the kernel, so these never get caught at build time, but we have
> seen bugs from gcc making incorrect assumptions about alignment
> even on architectures that have unaligned load/store instructions.
>
> Arnd
--
Jani Nikula, Intel Open Source Graphics Center
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
WARNING: multiple messages have this Message-ID (diff)
From: Jani Nikula <jani.nikula@intel.com>
To: Arnd Bergmann <arnd@arndb.de>
Cc: Linux ARM <linux-arm-kernel@lists.infradead.org>,
Arnd Bergmann <arnd@arndb.de>, David Airlie <airlied@linux.ie>,
Viresh Kumar <vireshk@kernel.org>,
Russell King <linux@armlinux.org.uk>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Linus Torvalds <torvalds@linux-foundation.org>,
SoC Team <soc@kernel.org>,
dri-devel <dri-devel@lists.freedesktop.org>,
Thomas Zimmermann <tzimmermann@suse.de>,
Shiraz Hashim <shiraz.linux.kernel@gmail.com>,
Sudip Mukherjee <sudipm.mukherjee@gmail.com>
Subject: Re: mainline build failure due to f1e4c916f97f ("drm/edid: add EDID block count and size helpers")
Date: Mon, 30 May 2022 16:10:08 +0300 [thread overview]
Message-ID: <87czfvrwsv.fsf@intel.com> (raw)
In-Reply-To: <CAK8P3a0-S77QLR1dK3NT6ot7JTAD5AdojAZJr-Xi112-v5EOdw@mail.gmail.com>
On Mon, 30 May 2022, Arnd Bergmann <arnd@arndb.de> wrote:
> On Mon, May 30, 2022 at 11:33 AM Jani Nikula <jani.nikula@intel.com> wrote:
>>
>> That is, for EDID. Makes you wonder about all the other packed structs
>> with enum members across the kernel.
>
> It is not the 'enum' that is special here, it's the 'union' having
> unpacked members,
Obviously meant union not enum, that was just a -ENOCOFFEE on my part.
> and the same thing happens when you have nested structs: both the inner
> and the outer aggregate need to be packed, either with __packed at the
> end, or on each individual member that is not fully aligned to
> max(sizeof(member), 4)).
>
> 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.
BR,
Jani.
> architectures that lack unaligned load/store instructions. There have
> definitely been other cases though where a __packed annotation is
> not needed on any sane architecture but is needed for OABI ARM.
>
> Overall I'm not that worried because the only machines running OABI
> kernels would be on really old hardware that runs a limited set of
> driver code.
>
> A completely different matter are the extraneous __packed annotations
> that lead to possible problems when accessed through a misaligned
> pointer. We ignore -Waddress-of-packed-member and -Wcast-align
> in the kernel, so these never get caught at build time, but we have
> seen bugs from gcc making incorrect assumptions about alignment
> even on architectures that have unaligned load/store instructions.
>
> Arnd
--
Jani Nikula, Intel Open Source Graphics Center
next prev parent reply other threads:[~2022-05-30 13:10 UTC|newest]
Thread overview: 90+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-27 9:07 mainline build failure due to f1e4c916f97f ("drm/edid: add EDID block count and size helpers") Sudip Mukherjee
2022-05-27 9:07 ` Sudip Mukherjee
2022-05-27 18:56 ` Linus Torvalds
2022-05-27 18:56 ` Linus Torvalds
2022-05-27 23:40 ` Sudip Mukherjee
2022-05-27 23:40 ` Sudip Mukherjee
2022-05-28 1:04 ` Linus Torvalds
2022-05-28 1:04 ` Linus Torvalds
2022-05-28 10:07 ` Sudip Mukherjee
2022-05-28 10:07 ` Sudip Mukherjee
2022-05-28 12:13 ` Sudip Mukherjee
2022-05-28 12:13 ` Sudip Mukherjee
2022-05-28 17:40 ` Linus Torvalds
2022-05-28 17:40 ` Linus Torvalds
2022-05-28 18:08 ` Linus Torvalds
2022-05-28 18:08 ` Linus Torvalds
2022-05-28 18:08 ` Linus Torvalds
2022-05-28 18:58 ` Arnd Bergmann
2022-05-28 18:58 ` Arnd Bergmann
2022-05-28 18:58 ` Arnd Bergmann
2022-05-28 20:31 ` Linus Torvalds
2022-05-28 20:31 ` Linus Torvalds
2022-05-28 20:31 ` Linus Torvalds
2022-05-28 21:08 ` Arnd Bergmann
2022-05-28 21:08 ` Arnd Bergmann
2022-05-28 21:08 ` Arnd Bergmann
2022-05-30 9:31 ` Jani Nikula
2022-05-30 9:31 ` Jani Nikula
2022-05-30 9:31 ` Jani Nikula
2022-05-30 9:33 ` Jani Nikula
2022-05-30 9:33 ` Jani Nikula
2022-05-30 9:33 ` Jani Nikula
2022-05-30 12:43 ` Arnd Bergmann
2022-05-30 12:43 ` Arnd Bergmann
2022-05-30 12:43 ` Arnd Bergmann
2022-05-30 13:10 ` Jani Nikula [this message]
2022-05-30 13:10 ` Jani Nikula
2022-05-30 13:10 ` Jani Nikula
2022-05-30 13:35 ` Arnd Bergmann
2022-05-30 13:35 ` Arnd Bergmann
2022-05-30 14:08 ` Jani Nikula
2022-05-30 14:08 ` Jani Nikula
2022-05-30 14:08 ` Jani Nikula
2022-05-30 14:26 ` Arnd Bergmann
2022-05-30 14:26 ` Arnd Bergmann
2022-05-30 14:26 ` Arnd Bergmann
2022-05-31 6:26 ` Julia Lawall
2022-05-31 6:26 ` Julia Lawall
2022-05-31 6:26 ` Julia Lawall
2022-05-31 8:04 ` Arnd Bergmann
2022-05-31 8:04 ` Arnd Bergmann
2022-05-31 8:04 ` Arnd Bergmann
2022-05-31 16:41 ` Linus Torvalds
2022-05-31 16:41 ` Linus Torvalds
2022-05-31 16:41 ` Linus Torvalds
2022-06-01 22:28 ` Keisuke Nishimura
2022-06-01 22:28 ` Keisuke Nishimura
2022-06-01 22:28 ` Keisuke Nishimura
2022-06-02 1:08 ` Linus Torvalds
2022-06-02 1:08 ` Linus Torvalds
2022-06-02 1:08 ` Linus Torvalds
2022-06-02 7:38 ` Arnd Bergmann
2022-06-02 7:38 ` Arnd Bergmann
2022-06-02 7:38 ` Arnd Bergmann
2022-06-02 11:21 ` Tetsuo Handa
2022-06-02 11:21 ` Tetsuo Handa
2022-06-02 11:21 ` Tetsuo Handa
2022-06-02 12:11 ` Arnd Bergmann
2022-06-02 12:11 ` Arnd Bergmann
2022-06-02 12:11 ` Arnd Bergmann
2022-06-02 13:18 ` Ard Biesheuvel
2022-06-02 13:18 ` Ard Biesheuvel
2022-06-02 13:18 ` Ard Biesheuvel
2022-06-02 12:19 ` Christoph Hellwig
2022-06-02 12:19 ` Christoph Hellwig
2022-06-06 10:51 ` Keisuke Nishimura
2022-06-06 10:51 ` Keisuke Nishimura
2022-06-06 10:51 ` Keisuke Nishimura
2022-05-30 16:56 ` Russell King (Oracle)
2022-05-30 16:56 ` Russell King (Oracle)
2022-05-30 16:56 ` Russell King (Oracle)
2022-05-30 16:54 ` Russell King (Oracle)
2022-05-30 16:54 ` Russell King (Oracle)
2022-05-30 16:54 ` Russell King (Oracle)
2022-05-30 16:53 ` Russell King (Oracle)
2022-05-30 16:53 ` Russell King (Oracle)
2022-05-30 16:53 ` Russell King (Oracle)
2022-05-28 20:32 ` Russell King (Oracle)
2022-05-28 20:32 ` Russell King (Oracle)
2022-05-28 20:32 ` Russell King (Oracle)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87czfvrwsv.fsf@intel.com \
--to=jani.nikula@intel.com \
--cc=airlied@linux.ie \
--cc=arnd@arndb.de \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=shiraz.linux.kernel@gmail.com \
--cc=soc@kernel.org \
--cc=sudipm.mukherjee@gmail.com \
--cc=torvalds@linux-foundation.org \
--cc=tzimmermann@suse.de \
--cc=ville.syrjala@linux.intel.com \
--cc=vireshk@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.