Linux driver-core infrastructure
 help / color / mirror / Atom feed
From: Yury Norov <ynorov@nvidia.com>
To: Gary Guo <gary@garyguo.net>
Cc: "Alexandre Courbot" <acourbot@nvidia.com>,
	"Boming Kong" <michaelkongboming@gmail.com>,
	"Miguel Ojeda" <miguel.ojeda.sandonis@gmail.com>,
	rust-for-linux@vger.kernel.org,
	"Yury Norov" <yury.norov@gmail.com>,
	"Miguel Ojeda" <ojeda@kernel.org>,
	"Boqun Feng" <boqun@kernel.org>,
	"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
	"Benno Lossin" <lossin@kernel.org>,
	"Andreas Hindborg" <a.hindborg@kernel.org>,
	"Alice Ryhl" <aliceryhl@google.com>,
	"Trevor Gross" <tmgross@umich.edu>,
	"Danilo Krummrich" <dakr@kernel.org>,
	"Daniel Almeida" <daniel.almeida@collabora.com>,
	"Tamir Duberstein" <tamird@kernel.org>,
	"Onur Özkan" <work@onurozkan.dev>,
	driver-core@lists.linux.dev
Subject: Re: [RFC PATCH 0/2] rust: Add compile-time overlap checking for bitfield! and register!
Date: Wed, 2 Dec 2026 13:18:53 -0500	[thread overview]
Message-ID: <axBhDfHJWiJCM-Ne@yury> (raw)
In-Reply-To: <DNA9VDOGX93P.30VU84MD3BFQQ@garyguo.net>

On Wed, Dec 02, 2026 at 01:14:02PM +0000, Gary Guo wrote:
> On Wed Dec 2, 2026 at 9:44 AM GMT, Alexandre Courbot wrote:
> > On Wed Dec 2, 2026 at 4:33 PM JST, Boming Kong wrote:
> >>> Boming, do you think you could produce a v2 that does this,
> >>> and turn the overlap check on by default after updating the couple of
> >>> bitfields that need an exception?
> >>
> >> Hi Alexandre,
> >>
> >> Sure, I can do that.
> >>
> >> The syntax off top of my head would looks like this:
> >>
> >> #[overlapping]
> >> 53:8    table_frame_sys => Pfn;
> >> #[overlapping]
> >> 32:8    table_frame_vid => Pfn;
> >>
> >> where table_frame_sys and table_frame_vid would escape checks.
> >
> > That's the idea yes, although maybe only the second field needs to be
> > tagged in that case.
> 
> I'd prefer the order to stay unimportant. So perhaps we can define this as
> "#[overlapping]" fields are not checked instead of "second field that overlaps
> need to be marked as `#[overlapping]`".
> 
> So in this case, you'd want to annotate the larger-sized one, i.e.
> 
>     #[overlapping]
>     53:8 table_frame_sys => Pfn;
>     32:8 table_frame_vid => Pfn;

It's not overlapping, it's embedding, and it should not be restricted
or require any special annotation because it's a common practice.

The true overlapping is something like:

    53:8 table_frame_sys => Pfn;
    32:0 table_frame_vid => Pfn;

I agree that overlapping is weird to some extent. Let's maybe restrict
it unless user explicitly mentions fields that do overlap:

        #[overlaps: foo, bar, baz]

Thanks,
Yury

      reply	other threads:[~2026-12-02 18:19 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-30  8:13 [RFC PATCH 0/2] rust: Add compile-time overlap checking for bitfield! and register! Boming Kong
2026-11-30  8:13 ` [RFC PATCH 1/2] rust: bitfield: added optional overlap argument for bitfield! Boming Kong
2026-11-30  8:13 ` [RFC PATCH 2/2] rust: io: register: implemented overlap flag inside register! Boming Kong
2026-11-30 10:34 ` [RFC PATCH 0/2] rust: Add compile-time overlap checking for bitfield! and register! Miguel Ojeda
2026-11-30 17:31   ` Boming Kong
2026-12-02  6:23   ` Alexandre Courbot
2026-12-02  7:33     ` Boming Kong
2026-12-02  9:44       ` Alexandre Courbot
2026-12-02 13:14         ` Gary Guo
2026-12-02 18:18           ` Yury Norov [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=axBhDfHJWiJCM-Ne@yury \
    --to=ynorov@nvidia.com \
    --cc=a.hindborg@kernel.org \
    --cc=acourbot@nvidia.com \
    --cc=aliceryhl@google.com \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun@kernel.org \
    --cc=dakr@kernel.org \
    --cc=daniel.almeida@collabora.com \
    --cc=driver-core@lists.linux.dev \
    --cc=gary@garyguo.net \
    --cc=lossin@kernel.org \
    --cc=michaelkongboming@gmail.com \
    --cc=miguel.ojeda.sandonis@gmail.com \
    --cc=ojeda@kernel.org \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=tamird@kernel.org \
    --cc=tmgross@umich.edu \
    --cc=work@onurozkan.dev \
    --cc=yury.norov@gmail.com \
    /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