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: <20230119112354.GP2948950@paulmck-ThinkPad-P17-Gen-1>
Date:   Thu, 19 Jan 2023 03:23:54 -0800
From:   "Paul E. McKenney" <paulmck@...nel.org>
To:     Alan Stern <stern@...land.harvard.edu>
Cc:     Andrea Parri <parri.andrea@...il.com>,
        Jonas Oberhauser <jonas.oberhauser@...wei.com>,
        Peter Zijlstra <peterz@...radead.org>, will <will@...nel.org>,
        "boqun.feng" <boqun.feng@...il.com>, npiggin <npiggin@...il.com>,
        dhowells <dhowells@...hat.com>,
        "j.alglave" <j.alglave@....ac.uk>,
        "luc.maranget" <luc.maranget@...ia.fr>, akiyks <akiyks@...il.com>,
        dlustig <dlustig@...dia.com>, joel <joel@...lfernandes.org>,
        urezki <urezki@...il.com>,
        quic_neeraju <quic_neeraju@...cinc.com>,
        frederic <frederic@...nel.org>,
        Kernel development list <linux-kernel@...r.kernel.org>
Subject: Re: Internal vs. external barriers (was: Re: Interesting LKMM litmus
 test)

On Wed, Jan 18, 2023 at 09:19:07PM -0500, Alan Stern wrote:
> On Wed, Jan 18, 2023 at 04:02:14PM -0800, Paul E. McKenney wrote:
> > On Wed, Jan 18, 2023 at 03:54:47PM -0500, Alan Stern wrote:
> > > How does this differ from srcu_read_lock() and srcu_read_unlock()?  And 
> > > how do the "up" and "down" parts figure into it? -- what is going up or 
> > > down?
> > 
> > Functionally and from a performance/scalability viewpoint, they
> > are identical to srcu_read_lock() and srcu_read_unlock().  The only
> > difference is that srcu_down_read() and srcu_up_read() lack the lockdep
> > machinery that complains when a matching pair of srcu_read_lock() and
> > srcu_read_unlock() are used from different tasks.
> 
> This makes me wonder if there's any need for srcu_down_read and 
> srcu_up_read at all.  Why not just use srcu_read_lock and 
> srcu_read_unlock, and remove the lockdep check?

Because the lockdep check is quite helpful in finding bugs in the
common case.

> > Within the implementation, nothing ever goes down, it is all
> > this_cpu_inc().  The "down" and "up" are by analogy to down() and up(),
> > where "down()" says acquire some rights to a resource and "up()" says
> > release those rights.
> 
> Another reason not to use those names.  If you insist on making these 
> operations distinct from srcu_read_lock and srcu_read_unlock, why not 
> borrow the "_get" and "_put" nomenclature used by the device core?  I 
> suspect more people would associate them with acquiring and releasing 
> rights to a resource.  (Although in this case it might be so clear 
> exactly what that resource is.)
> 
> > Wait, I can make "down" work.
> > 
> > A call to srcu_down_read() reduces the quantity computed by summing the
> > unlocks then subtracting the sum of the locks.  A call to srcu_up_read()
> > increases that same quantity.  ;-)
> 
> I can't honestly call that a resoundingly convincing argument.  :-)

It is exactly the same argument for the name of down() and up().  ;-)

And the analogy between mutex_lock() and down() on the one hand an
srcu_read_lock() and srcu_down_read() should be helpful as well.

							Thanx, Paul

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ