mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andreas Hindborg <a.hindborg@kernel.org>
To: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>,
	Gary Guo <gary@garyguo.net>
Cc: "Alexandre Courbot" <acourbot@nvidia.com>,
	"Miguel Ojeda" <ojeda@kernel.org>,
	"Boqun Feng" <boqun.feng@gmail.com>,
	"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>,
	linux-kernel@vger.kernel.org, rust-for-linux@vger.kernel.org
Subject: Re: [PATCH] rust: add `CacheAligned` for easy cache line alignment of values
Date: Wed, 28 Jan 2026 19:19:56 +0100	[thread overview]
Message-ID: <87ikclsipf.fsf@t14s.mail-host-address-is-not-set> (raw)
In-Reply-To: <CANiq72=LyWx+5FbZ8H2FzoXNF9TaYAf06qA-Fo83pCxP_e-94Q@mail.gmail.com>

"Miguel Ojeda" <miguel.ojeda.sandonis@gmail.com> writes:

> On Wed, Jan 28, 2026 at 3:41 PM Gary Guo <gary@garyguo.net> wrote:
>>
>> Unfortunately `repr(align())` does not accept expression or macro invocations.
>> It's still possible with code-generation, but it'll be more tricky.
>>
>> On all archs that we do support today, I think the value is always 64. However
>> it'd worth putting a FIXME or TODO (or assertion, maybe?) in case new archs gets
>> addded where this isn't true.
>
> The docs need to also avoid mentioning 64 themselves; otherwise,
> someone may use this and rely on it being 64, i.e. not just cache
> aligned, but actually 64.
>
> If Andreas really wants a fixed 64 one, then perhaps we want several
> types like `Aligned64` etc.

I was considering all the options that are mentioned here, and I decided
to go with least effort and hear you all out. I agree that `Aligned64`
is better than `CacheAligned` when the alignment is fixed and the type
is available on all architectures.

How about we gate the module on architectures that use 64 byte cache
line? Then we can add a proc macro to generate later if we need to, or
we can gate in another module implementation.

Regarding generating the code, how would a proc macro for this work? Do
we have environment variable access in proc macros?


Best regards,
Andreas Hindborg




  reply	other threads:[~2026-01-28 18:20 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-28 14:05 Andreas Hindborg
2026-01-28 14:25 ` Alexandre Courbot
2026-01-28 14:41   ` Gary Guo
2026-01-28 14:45     ` Miguel Ojeda
2026-01-28 18:19       ` Andreas Hindborg [this message]
2026-01-28 14:46     ` Alice Ryhl
2026-01-28 15:05       ` Gary Guo
2026-05-18 13:41     ` Andreas Hindborg
2026-05-18 16:22       ` Gary Guo
2026-05-19  8:18         ` Andreas Hindborg
2026-05-19 10:35           ` Gary Guo
2026-05-19 11:28             ` Andreas Hindborg
2026-01-28 14:26 ` Miguel Ojeda
2026-01-28 14:34   ` Miguel Ojeda
2026-01-28 18:23   ` Andreas Hindborg
2026-01-28 18:41     ` Miguel Ojeda
2026-01-28 14:32 ` Gary Guo
2026-01-28 18:27   ` Andreas Hindborg
2026-05-19  9:16   ` Andreas Hindborg

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=87ikclsipf.fsf@t14s.mail-host-address-is-not-set \
    --to=a.hindborg@kernel.org \
    --cc=acourbot@nvidia.com \
    --cc=aliceryhl@google.com \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun.feng@gmail.com \
    --cc=dakr@kernel.org \
    --cc=gary@garyguo.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lossin@kernel.org \
    --cc=miguel.ojeda.sandonis@gmail.com \
    --cc=ojeda@kernel.org \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=tmgross@umich.edu \
    /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®