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]
Date: Tue, 11 Jun 2024 14:38:02 -0700
From: Yury Norov <yury.norov@...il.com>
To: Linus Walleij <linus.walleij@...aro.org>, linux-kernel@...r.kernel.org
Cc: Jani Nikula <jani.nikula@...ux.intel.com>,
	Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
	"Rafael J. Wysocki" <rafael.j.wysocki@...el.com>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Guenter Roeck <linux@...ck-us.net>,
	Randy Dunlap <rdunlap@...radead.org>,
	Andi Shyti <andi.shyti@...nel.org>, Lee Jones <lee@...nel.org>,
	Arseniy Krasnov <AVKrasnov@...rdevices.ru>,
	Johannes Berg <johannes.berg@...el.com>,
	Bjorn Helgaas <bhelgaas@...gle.com>,
	Robert Richter <rrichter@....com>, Vinod Koul <vkoul@...nel.org>,
	Hans de Goede <hdegoede@...hat.com>,
	Nikita Kravets <teackot@...il.com>,
	Jiri Slaby <jirislaby@...nel.org>,
	Heikki Krogerus <heikki.krogerus@...ux.intel.com>,
	Kent Overstreet <kent.overstreet@...ux.dev>,
	Eric Biggers <ebiggers@...gle.com>,
	Kees Cook <keescook@...omium.org>, Ingo Molnar <mingo@...nel.org>,
	"Steven Rostedt (Google)" <rostedt@...dmis.org>,
	Daniel Bristot de Oliveira <bristot@...nel.org>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Hugh Dickins <hughd@...gle.com>,
	John Johansen <john.johansen@...onical.com>,
	Eric Snowberg <eric.snowberg@...cle.com>,
	Takashi Iwai <tiwai@...e.de>,
	Takashi Sakamoto <o-takashi@...amocchi.jp>,
	Mark Brown <broonie@...nel.org>,
	Kuninori Morimoto <kuninori.morimoto.gx@...esas.com>,
	Nicholas Piggin <npiggin@...il.com>,
	Christophe Leroy <christophe.leroy@...roup.eu>,
	Thomas Gleixner <tglx@...utronix.de>,
	Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
	Dave Hansen <dave.hansen@...ux.intel.com>,
	"H. Peter Anvin" <hpa@...or.com>,
	David Howells <dhowells@...hat.com>,
	"David S. Miller" <davem@...emloft.net>,
	"Rafael J. Wysocki" <rafael@...nel.org>,
	Len Brown <lenb@...nel.org>, Sergey Shtylyov <s.shtylyov@....ru>,
	Damien Le Moal <dlemoal@...nel.org>,
	Niklas Cassel <cassel@...nel.org>, Stephen Boyd <sboyd@...nel.org>,
	Florian Fainelli <florian.fainelli@...adcom.com>,
	Ray Jui <rjui@...adcom.com>,
	Peter De Schrijver <pdeschrijver@...dia.com>,
	Prashant Gaikwad <pgaikwad@...dia.com>,
	Thierry Reding <thierry.reding@...il.com>,
	Jonathan Hunter <jonathanh@...dia.com>,
	Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>,
	Maxime Ripard <mripard@...nel.org>,
	Thomas Zimmermann <tzimmermann@...e.de>,
	David Airlie <airlied@...il.com>, Daniel Vetter <daniel@...ll.ch>,
	Rodrigo Vivi <rodrigo.vivi@...el.com>,
	Joonas Lahtinen <joonas.lahtinen@...ux.intel.com>,
	Tvrtko Ursulin <tursulin@...ulin.net>,
	Karol Herbst <kherbst@...hat.com>, Lyude Paul <lyude@...hat.com>,
	Danilo Krummrich <dakr@...hat.com>,
	Jean Delvare <jdelvare@...e.com>,
	Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
	Pavel Machek <pavel@....cz>,
	Jernej Skrabec <jernej.skrabec@...il.com>,
	Ulf Hansson <ulf.hansson@...aro.org>,
	Eric Dumazet <edumazet@...gle.com>,
	Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
	Miri Korenblit <miriam.rachel.korenblit@...el.com>,
	Kalle Valo <kvalo@...nel.org>,
	Kishon Vijay Abraham I <kishon@...nel.org>,
	Sebastian Reichel <sre@...nel.org>,
	Daniel Lezcano <daniel.lezcano@...aro.org>,
	Tejun Heo <tj@...nel.org>, Johannes Weiner <hannes@...xchg.org>,
	Peter Zijlstra <peterz@...radead.org>,
	Juri Lelli <juri.lelli@...hat.com>,
	Vincent Guittot <vincent.guittot@...aro.org>,
	Dietmar Eggemann <dietmar.eggemann@....com>,
	Ben Segall <bsegall@...gle.com>, Mel Gorman <mgorman@...e.de>,
	Daniel Bristot de Oliveira <bristot@...hat.com>,
	Valentin Schneider <vschneid@...hat.com>,
	Masami Hiramatsu <mhiramat@...nel.org>,
	Mathieu Desnoyers <mathieu.desnoyers@...icios.com>,
	Jason Baron <jbaron@...mai.com>, Paul Moore <paul@...l-moore.com>,
	James Morris <jmorris@...ei.org>,
	"Serge E. Hallyn" <serge@...lyn.com>,
	Dmitry Kasatkin <dmitry.kasatkin@...il.com>,
	Clemens Ladisch <clemens@...isch.de>,
	Jaroslav Kysela <perex@...ex.cz>, Takashi Iwai <tiwai@...e.com>,
	Linus Torvalds <torvalds@...ux-foundation.org>
Subject: Re: [PATCH v1 1/1] treewide: Align match_string() with
 sysfs_match_string()

On Mon, Jun 10, 2024 at 10:08:00AM +0200, Linus Walleij wrote:
> On Tue, Jun 4, 2024 at 9:46 AM Jani Nikula <jani.nikula@...ux.intel.com> wrote:
> 
> [Maybe slightly off-topic, ranty]
> 
> > Why do we think it's a good idea to increase and normalize the use of
> > double-underscore function names across the kernel, like
> > __match_string() in this case? It should mean "reserved for the
> > implementation, not to be called directly".
> >
> > If it's to be used directly, it should be named accordingly, right?
> 
> It's a huge mess. "__" prefix is just so ambiguous I think it just
> shouldn't be used or prolifierated, and it usually breaks Rusty Russells
> API rules times over.
> 
> Consider __set_bit() from <linux/bitops.h>, used all over the place,
> in contrast with set_bit() for example, what does "__" represent in
> this context that makes __set_bit() different from set_bit()?
> 
> It means "non-atomic"...
> 
> How does a random contributor know this?
> 
> Yeah, you guess it. By the token of "everybody knows that".
> (Grep, google, repeat for the number of contributors to the kernel.)
> 
> I was considering to send a script to Torvalds to just change all
> this to set_bit_nonatomic() (etc) but was hesitating because that
> makes the name unambiguous but long. I think I stayed off it
> because changing stuff like that all over the place creates churn
> and churn is bad.

Hi Linus,

I think about renaming set_bit() stuff for atomicity at least twice
a year. But it would be over 15000 renames for set and clear_bit only:

yury:linux$ git grep -w -E "set_bit|clear_bit"|wc -l
12972
yury:linux$ git grep -w -E "__set_bit|__clear_bit"|wc -l
2914

Anyways, if someone is brave enough to do that... The main problem is
that set_bit() is heavily abused because people don't bother putting
the '__' thing, which leads to using atomic helpers where non-atomic
versions are enough. 

So the right path for renaming would be:

s/set_bit/atomic_set_bit
s/__set_bit/nonatomic_set_bit
/* Wait for a full release cycle or two to let people get used, then */
#define set_bit nonatomic_set_bit

Thanks,
Yury

PS. Had to drop all maillists except for LKML and some random victims
because my gmail account doesn't allow more that 100 recipients. If
you guys know how to increase the limit, please advise.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ