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] [day] [month] [year] [list]
Message-ID: <aV7fXuvIMNOP0Kp8@agluck-desk3>
Date: Wed, 7 Jan 2026 14:34:06 -0800
From: "Luck, Tony" <tony.luck@...el.com>
To: Eric Dumazet <edumazet@...gle.com>
CC: Eric Dumazet <eric.dumazet@...il.com>, "David S . Miller"
	<davem@...emloft.net>, Jakub Kicinski <kuba@...nel.org>, Paolo Abeni
	<pabeni@...hat.com>, netdev <netdev@...r.kernel.org>, Christophe Leroy
	<christophe.leroy@...roup.eu>, Willy Tarreau <w@....eu>, Reinette Chatre
	<reinette.chatre@...el.com>
Subject: Re: [PATCH net-next] once: add DO_ONCE_SLOW() for sleepable contexts

On Wed, Jan 07, 2026 at 10:17:52PM +0100, Eric Dumazet wrote:
> On Wed, Jan 7, 2026 at 9:59 PM Luck, Tony <tony.luck@...el.com> wrote:
> >
> > On Sat, Oct 01, 2022 at 01:51:02PM -0700, Eric Dumazet wrote:
> > > +void __do_once_slow_done(bool *done, struct static_key_true *once_key,
> > > +                      struct module *mod)
> > > +     __releases(once_mutex)
> > > +{
> > > +     *done = true;
> > > +     mutex_unlock(&once_mutex);
> > > +     once_disable_jump(once_key, mod);
> >
> > This seems to have been cut & pasted from __do_once_done(). But is there
> > a reason for the "sleepable" version to defer resetting the static key
> > in a work queue? Can't we just inline do:
> >
> >         BUG_ON(!static_key_enabled(once_key));
> >         static_branch_disable(once_key);
> >
> > > +}
> >
> > -Tony
> >
> > Credit to Reinette for raising this question. Blame me if I didn't spot
> > why a work queue is needed.
> 
> Note this is used from one single place, one time...

Boris pointed me to <linux/once.h> when reviewing a patch with open-coded
"do this once" section. So there may be about to be a second user. Perhaps
more to follow as the DO_ONCE*() macros look to be a very neat, concise,
and obvious way to call a function just once.

> Why would you care ?

It looks like unnecessary overhead, but I wondered if there was
something I was missing. Some reason why the SLEEPABLE version
needed to delay clearing the static key to a work queue.

-Tony

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ