From: Andreas Hindborg <a.hindborg@kernel.org>
To: "Miguel Ojeda" <miguel.ojeda.sandonis@gmail.com>,
"Sasha Levin" <sashal@kernel.org>,
"Emilio Cobos Álvarez" <emilio@crisal.io>
Cc: "Miguel Ojeda" <ojeda@kernel.org>, "Jens Axboe" <axboe@kernel.dk>,
"Linus Torvalds" <torvalds@linux-foundation.org>,
"Josef Bacik" <josef@toxicpanda.com>,
"Boqun Feng" <boqun@kernel.org>, "Gary Guo" <gary@garyguo.net>,
"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
"Benno Lossin" <lossin@kernel.org>,
"Alice Ryhl" <aliceryhl@google.com>,
"Trevor Gross" <tmgross@umich.edu>,
"Danilo Krummrich" <dakr@kernel.org>,
"Nathan Chancellor" <nathan@kernel.org>,
rust-for-linux@vger.kernel.org, linux-block@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] rust: bindings: derive Zeroable for bindgen's opaque array wrappers
Date: Mon, 02 Nov 2026 13:02:27 +0100 [thread overview]
Message-ID: <8733tjo2zw.fsf@t14s.mail-host-address-is-not-set> (raw)
In-Reply-To: <CANiq72=jdQdNeTNoSxnMGvQ9URQ7yJjLWceYiB1ZcbpoYxj7wA@mail.gmail.com>
"Miguel Ojeda" <miguel.ojeda.sandonis@gmail.com> writes:
> On Sat, Oct 31, 2026 at 4:28 PM Sasha Levin <sashal@kernel.org> wrote:
>>
>> bindgen 0.73 emits the blob of some opaque types, such as ones aligned
>> to more than 4 bytes, as a `__BindgenOpaqueArray` or
>> `__BindgenOpaqueArray<align>` newtype instead of a plain array. The
>> newtype only derives `PartialEq`, `Eq`, `Copy`, `Clone`, `Debug` and
>> `Hash`, and the `MaybeZeroable` custom derive does not reach it, so a
>> struct that embeds such an opaque type is no longer `Zeroable`.
>>
>> `spinlock` is opaque (see rust/bindgen_parameters), and with lockdep its
>> blob becomes a `__BindgenOpaqueArray8<[u8; 72]>`. Commit 71ec3c7d6db8
>> ("blk-mq: quiesce a queue that joins a quiesced tag set") added a
>> `spinlock_t` to `struct blk_mq_tag_set`, so an allmodconfig build with
>> bindgen 0.73 now fails:
>>
>> error[E0277]: the trait bound `bindings::__BindgenOpaqueArray8<[u8; 72]>: pin_init::Zeroable` is not satisfied
>> --> rust/kernel/block/mq/tag_set.rs:41:49
>>
>> Which wrappers exist depends on the bindgen version and on the opaque
>> types of the configuration, so they cannot be covered by unconditional
>> impls in rust/bindings/lib.rs like `__BindgenBitfieldUnit` is. Derive
>> `Zeroable` for each wrapper in the generated bindings instead. The
>> pattern allows for the spacing of bindgen's output when rustfmt is not
>> available.
>>
>> Fixes: 71ec3c7d6db8 ("blk-mq: quiesce a queue that joins a quiesced tag set")
>> Signed-off-by: Sasha Levin <sashal@kernel.org>
>
> Applied to `rust-fixes` -- thanks everyone!
>
> I can send this to Linus in a couple days, unless Andreas shouts or
> Jens prefer to take it through his tree for some reason (now that
> v7.4-rc1 is out, it shouldn't matter).
Thanks, works for me.
Best regards,
Andreas Hindborg
prev parent reply other threads:[~2026-11-02 12:03 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <27b58e47-723b-4d67-a1f0-ccb8b0ae66a9@kernel.dk>
2026-10-31 15:28 ` Sasha Levin
2026-10-31 16:17 ` Alice Ryhl
2026-10-31 16:29 ` Sasha Levin
2026-10-31 16:37 ` Alice Ryhl
2026-11-01 0:48 ` Alexandre Courbot
2026-11-01 15:34 ` Miguel Ojeda
2026-11-01 23:15 ` John Hubbard
2026-11-02 2:09 ` Miguel Ojeda
2026-11-02 12:02 ` Andreas Hindborg [this message]
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=8733tjo2zw.fsf@t14s.mail-host-address-is-not-set \
--to=a.hindborg@kernel.org \
--cc=aliceryhl@google.com \
--cc=axboe@kernel.dk \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun@kernel.org \
--cc=dakr@kernel.org \
--cc=emilio@crisal.io \
--cc=gary@garyguo.net \
--cc=josef@toxicpanda.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lossin@kernel.org \
--cc=miguel.ojeda.sandonis@gmail.com \
--cc=nathan@kernel.org \
--cc=ojeda@kernel.org \
--cc=rust-for-linux@vger.kernel.org \
--cc=sashal@kernel.org \
--cc=tmgross@umich.edu \
--cc=torvalds@linux-foundation.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®