lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87v7o0i7b8.fsf@kernel.org>
Date: Thu, 10 Jul 2025 14:00:59 +0200
From: Andreas Hindborg <a.hindborg@...nel.org>
To: "Benno Lossin" <lossin@...nel.org>
Cc: "Boqun Feng" <boqun.feng@...il.com>,  <linux-kernel@...r.kernel.org>,
  <rust-for-linux@...r.kernel.org>,  <lkmm@...ts.linux.dev>,
  <linux-arch@...r.kernel.org>,  "Miguel Ojeda" <ojeda@...nel.org>,  "Alex
 Gaynor" <alex.gaynor@...il.com>,  "Gary Guo" <gary@...yguo.net>,
  Björn
 Roy Baron <bjorn3_gh@...tonmail.com>,  "Alice Ryhl"
 <aliceryhl@...gle.com>,  "Trevor Gross" <tmgross@...ch.edu>,  "Danilo
 Krummrich" <dakr@...nel.org>,  "Will Deacon" <will@...nel.org>,  "Peter
 Zijlstra" <peterz@...radead.org>,  "Mark Rutland" <mark.rutland@....com>,
  "Wedson Almeida Filho" <wedsonaf@...il.com>,  "Viresh Kumar"
 <viresh.kumar@...aro.org>,  "Lyude Paul" <lyude@...hat.com>,  "Ingo
 Molnar" <mingo@...nel.org>,  "Mitchell Levy" <levymitchell0@...il.com>,
  "Paul E. McKenney" <paulmck@...nel.org>,  "Greg Kroah-Hartman"
 <gregkh@...uxfoundation.org>,  "Linus Torvalds"
 <torvalds@...ux-foundation.org>,  "Thomas Gleixner" <tglx@...utronix.de>,
  "Alan Stern" <stern@...land.harvard.edu>
Subject: Re: [PATCH v6 3/9] rust: sync: atomic: Add ordering annotation types

"Benno Lossin" <lossin@...nel.org> writes:

> On Thu Jul 10, 2025 at 8:00 AM CEST, Boqun Feng wrote:
>> Preparation for atomic primitives. Instead of a suffix like _acquire, a
>> method parameter along with the corresponding generic parameter will be
>> used to specify the ordering of an atomic operations. For example,
>> atomic load() can be defined as:
>>
>> 	impl<T: ...> Atomic<T> {
>> 	    pub fn load<O: AcquireOrRelaxed>(&self, _o: O) -> T { ... }
>> 	}
>>
>> and acquire users would do:
>>
>> 	let r = x.load(Acquire);
>>
>> relaxed users:
>>
>> 	let r = x.load(Relaxed);
>>
>> doing the following:
>>
>> 	let r = x.load(Release);
>>
>> will cause a compiler error.
>>
>> Compared to suffixes, it's easier to tell what ordering variants an
>> operation has, and it also make it easier to unify the implementation of
>> all ordering variants in one method via generic. The `TYPE` associate
>> const is for generic function to pick up the particular implementation
>> specified by an ordering annotation.
>>
>> Reviewed-by: Alice Ryhl <aliceryhl@...gle.com>
>> Signed-off-by: Boqun Feng <boqun.feng@...il.com>
>
> One naming comment below, with that fixed:
>
> Reviewed-by: Benno Lossin <lossin@...nel.org>
>
>> ---
>>  rust/kernel/sync/atomic.rs          |  3 +
>>  rust/kernel/sync/atomic/ordering.rs | 97 +++++++++++++++++++++++++++++
>>  2 files changed, 100 insertions(+)
>>  create mode 100644 rust/kernel/sync/atomic/ordering.rs
>
>> +/// The trait bound for annotating operations that support any ordering.
>> +pub trait Any: internal::Sealed {
>
> I don't like the name `Any`, how about `AnyOrdering`? Otherwise we
> should require people to write `ordering::Any` because otherwise it's
> pretty confusing.

I agree with this observation.


Best regards,
Andreas Hindborg




Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ