Re: [PATCH v4 13/15] locking/lockdep: Add support for dynamic keys

From: Bart Van Assche
Date: Fri Dec 14 2018 - 12:20:10 EST


On Tue, 2018-12-11 at 14:13 -0800, Bart Van Assche wrote:
+AD4 +-/+ACo
+AD4 +- +ACo Unregister a dynamically allocated key. Must not be called from interrupt
+AD4 +- +ACo context. The caller must ensure that freeing +AEA-key only happens after an RCU
+AD4 +- +ACo grace period.
+AD4 +- +ACo-/
+AD4 +-void lockdep+AF8-unregister+AF8-key(struct lock+AF8-class+AF8-key +ACo-key)
+AD4 +-+AHs
+AD4 +- struct hlist+AF8-head +ACo-hash+AF8-head +AD0 keyhashentry(key)+ADs
+AD4 +- struct lock+AF8-class+AF8-key +ACo-k+ADs
+AD4 +- struct pending+AF8-free +ACo-pf+ADs
+AD4 +- unsigned long flags+ADs
+AD4 +- bool found +AD0 false+ADs
+AD4 +-
+AD4 +- might+AF8-sleep()+ADs
+AD4 +-
+AD4 +- if (WARN+AF8-ON+AF8-ONCE(static+AF8-obj(key)))
+AD4 +- return+ADs
+AD4 +-
+AD4 +- pf +AD0 get+AF8-pending+AF8-free+AF8-lock(+ACY-flags)+ADs
+AD4 +- if (WARN+AF8-ON+AF8-ONCE(+ACE-pf))
+AD4 +- return+ADs
+AD4 +- hlist+AF8-for+AF8-each+AF8-entry+AF8-rcu(k, hash+AF8-head, hash+AF8-entry) +AHs
+AD4 +- if (k +AD0APQ key) +AHs
+AD4 +- hlist+AF8-del+AF8-rcu(+ACY-k-+AD4-hash+AF8-entry)+ADs
+AD4 +- found +AD0 true+ADs
+AD4 +- break+ADs
+AD4 +- +AH0
+AD4 +- +AH0
+AD4 +- WARN+AF8-ON+AF8-ONCE(+ACE-found)+ADs
+AD4 +- +AF8AXw-lockdep+AF8-free+AF8-key+AF8-range(pf, key, 1)+ADs
+AD4 +- schedule+AF8-free+AF8-zapped+AF8-classes(pf)+ADs
+AD4 +- graph+AF8-unlock()+ADs
+AD4 +- raw+AF8-local+AF8-irq+AF8-restore(flags)+ADs
+AD4 +-+AH0
+AD4 +-EXPORT+AF8-SYMBOL+AF8-GPL(lockdep+AF8-unregister+AF8-key)+ADs

Since is+AF8-dynamic+AF8-key() has been modified from using locking into using RCU, a
synchronize+AF8-rcu() call needs to be added at the end of lockdep+AF8-unregister+AF8-key().
I will repost this patch series if the 0-day test infrastructure is happy with
the new version.

Bart.