[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <1544808002.185366.414.camel@acm.org>
Date: Fri, 14 Dec 2018 09:20:02 -0800
From: Bart Van Assche <bvanassche@....org>
To: peterz@...radead.org
Cc: mingo@...hat.com, tj@...nel.org, longman@...hat.com,
johannes.berg@...el.com, linux-kernel@...r.kernel.org,
Johannes Berg <johannes@...solutions.net>
Subject: Re: [PATCH v4 13/15] locking/lockdep: Add support for dynamic keys
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.
Powered by blists - more mailing lists