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, 04 Dec 2018 08:08:20 -0800
From:   Bart Van Assche <bvanassche@....org>
To:     Peter Zijlstra <peterz@...radead.org>
Cc:     mingo@...hat.com, tj@...nel.org, johannes.berg@...el.com,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH 22/27] locking/lockdep: Reuse list entries that are no
 longer in use

On Tue, 2018-12-04 at 09:14 +0100, Peter Zijlstra wrote:
> On Mon, Dec 03, 2018 at 10:16:59AM -0800, Bart Van Assche wrote:
> > On Mon, 2018-12-03 at 18:32 +0100, Peter Zijlstra wrote:
> > > On Mon, Dec 03, 2018 at 08:40:48AM -0800, Bart Van Assche wrote:
> > > > How about the following alternative which requires only two bitmaps instead
> > > > of three:
> > > > - Maintain two bitmaps, one for the free entries and one for the entries
> > > >   that are being freed.
> > > > - Protect all accesses to both bitmaps with the graph lock.
> > > > - zap_class() sets a bit in the "being freed" bitmap for the entries that
> > > >   should be freed after a GP.
> > > > - Instead of making free_zapped_classes() wait for a grace period by calling
> > > >   synchronize_sched(), use call_rcu() and do the freeing work from inside the
> > > >   RCU callback.
> > > > - From inside the RCU callback, set a bit in the "free" bitmap for all entries
> > > >   that have a bit set in the "being freed" bitmap and clears the "being freed"
> > > >   bitmap.
> > > 
> > > What happens when another unreg happens while the rcu_call thing is
> > > still pending?
> > 
> > A new flag will have to keep track of whether or not an RCU callback has
> > already been scheduled via rcu_call() but not yet executed to avoid double
> > RCU call complaints.
>
> That's not the only problem there. You either then have to synchronously
> wait for that flag / rcu_call to complete, or, if you modify the bitmap,
> ensure it re-queues itself for another GP before committing, which is
> starvation prone.

Can you have a look at free_zapped_classes() and schedule_free_zapped_classes()
in v2 of this patch series? In v2 the call_rcu(), manipulation of the boolean
and processing of the bitmaps are all protected by the graph
lock to avoid the issues that you described. See also
* [PATCH v2 17/24] locking/lockdep: Free lock classes that are no longer in use
  (https://lore.kernel.org/lkml/20181204002833.55452-18-bvanassche@acm.org/).
* [PATCH v2 18/24] locking/lockdep: Reuse list entries that are no longer in use
  (https://lore.kernel.org/lkml/20181204002833.55452-19-bvanassche@acm.org/).

Thanks,

Bart.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ