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: <9db27bd6015ccebaa20e51450d8c42eb2864cb2e.camel@nvidia.com>
Date: Wed, 31 Dec 2025 22:33:41 +0000
From: Timur Tabi <ttabi@...dia.com>
To: "dakr@...nel.org" <dakr@...nel.org>, John Hubbard <jhubbard@...dia.com>
CC: Alexandre Courbot <acourbot@...dia.com>, "lossin@...nel.org"
	<lossin@...nel.org>, "a.hindborg@...nel.org" <a.hindborg@...nel.org>,
	"boqun.feng@...il.com" <boqun.feng@...il.com>, "aliceryhl@...gle.com"
	<aliceryhl@...gle.com>, Zhi Wang <zhiw@...dia.com>, "simona@...ll.ch"
	<simona@...ll.ch>, "alex.gaynor@...il.com" <alex.gaynor@...il.com>,
	"ojeda@...nel.org" <ojeda@...nel.org>, "tmgross@...ch.edu"
	<tmgross@...ch.edu>, "nouveau@...ts.freedesktop.org"
	<nouveau@...ts.freedesktop.org>, "linux-kernel@...r.kernel.org"
	<linux-kernel@...r.kernel.org>, "rust-for-linux@...r.kernel.org"
	<rust-for-linux@...r.kernel.org>, "bjorn3_gh@...tonmail.com"
	<bjorn3_gh@...tonmail.com>, Edwin Peer <epeer@...dia.com>,
	"airlied@...il.com" <airlied@...il.com>, Joel Fernandes
	<joelagnelf@...dia.com>, "bhelgaas@...gle.com" <bhelgaas@...gle.com>,
	"gary@...yguo.net" <gary@...yguo.net>, Alistair Popple <apopple@...dia.com>
Subject: Re: [PATCH] gpu: nova-core: bitfield: use &mut self setters instead
 of builder pattern

On Wed, 2025-12-31 at 13:47 -0800, John Hubbard wrote:
> The builder-pattern setters (self -> Self) enabled method chaining like:
> 
>     reg.set_foo(x).set_sec(y).write(bar);
> 
> This made separate operations appear as a single expression, obscuring
> that each setter is a distinct mutation. 

So you're concerned about the fact that the compiler is not merging the set_foo(x) and the
set_sec(y) into a single read-modify-write?

> These setters are infallible,
> so the chaining provides no error-propagation benefit—it just obscures
> what are simple, independent assignments.
> 
> Change the bitfield!() macro to generate `&mut self` setters, so each
> operation is a distinct statement:
> 
>     reg.set_foo(x);
>     reg.set_sec(y);
>     reg.write(bar);

Are you sure about this?  It just seems like you're throwing out a neat little feature of Rust and
replacing it with something that's very C-like.  This breaks compatible with all users of the regs
macros.  Seems really disruptive for what seems to me like a cosmetic change.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ