On Tue, 2018-12-11 at 14:13 -0800, Bart Van Assche wrote:
> +/*
> + * Unregister a dynamically allocated key. Must not be called from interrupt
> + * context. The caller must ensure that freeing @key only happens after an 
> RCU
> + * grace period.
> + */
> +void lockdep_unregister_key(struct lock_class_key *key)
> +{
> +     struct hlist_head *hash_head = keyhashentry(key);
> +     struct lock_class_key *k;
> +     struct pending_free *pf;
> +     unsigned long flags;
> +     bool found = false;
> +
> +     might_sleep();
> +
> +     if (WARN_ON_ONCE(static_obj(key)))
> +             return;
> +
> +     pf = get_pending_free_lock(&flags);
> +     if (WARN_ON_ONCE(!pf))
> +             return;
> +     hlist_for_each_entry_rcu(k, hash_head, hash_entry) {
> +             if (k == key) {
> +                     hlist_del_rcu(&k->hash_entry);
> +                     found = true;
> +                     break;
> +             }
> +     }
> +     WARN_ON_ONCE(!found);
> +     __lockdep_free_key_range(pf, key, 1);
> +     schedule_free_zapped_classes(pf);
> +     graph_unlock();
> +     raw_local_irq_restore(flags);
> +}
> +EXPORT_SYMBOL_GPL(lockdep_unregister_key);

Since is_dynamic_key() has been modified from using locking into using RCU, a
synchronize_rcu() call needs to be added at the end of lockdep_unregister_key().
I will repost this patch series if the 0-day test infrastructure is happy with
the new version.

Bart.

Reply via email to