| From f299b2c1c7057482c34f44fe41a051ae437adcc7 Mon Sep 17 00:00:00 2001 |
| From: Paul Gortmaker <paul.gortmaker@windriver.com> |
| Date: Sat, 22 Jan 2011 14:43:36 -0500 |
| Subject: [PATCH] lockdep: add no_validate class |
| |
| This is one of several extractions from the merge up to 33-rc8. |
| |
| See it in a git tip repo with: |
| |
| git diff 5f854cfc024622e4aae14d7cf422f6ff86278688^2 \ |
| 5f854cfc024622e4aae14d7cf422f6ff86278688 include/linux/lockdep.h |
| |
| You can find the origin of this change in the tip merge commit: |
| |
| commit 5f854cfc024622e4aae14d7cf422f6ff86278688 |
| Merge: cc24da0 4ec62b2 |
| Author: Thomas Gleixner <tglx@linutronix.de> |
| Date: Sun Feb 21 20:17:22 2010 +0100 |
| |
| Forward to 2.6.33-rc8 |
| |
| Merge branch 'linus' into rt/head with a pile of conflicts. |
| |
| Signed-off-by: Thomas Gleixner <tglx@linutronix.de> |
| |
| Normally there are not significant changes/additions in a merge commit that |
| are not from any other "normal" commit. But in this case there are, so |
| break them out into separate explicit commits. |
| |
| Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com> |
| |
| diff --git a/drivers/base/core.c b/drivers/base/core.c |
| index 004302c..5e2950a 100644 |
| --- a/drivers/base/core.c |
| +++ b/drivers/base/core.c |
| @@ -564,6 +564,7 @@ void device_initialize(struct device *dev) |
| kobject_init(&dev->kobj, &device_ktype); |
| INIT_LIST_HEAD(&dev->dma_pools); |
| mutex_init(&dev->mutex); |
| + lockdep_set_novalidate_class(&dev->mutex); |
| spin_lock_init(&dev->devres_lock); |
| INIT_LIST_HEAD(&dev->devres_head); |
| device_init_wakeup(dev, 0); |
| diff --git a/include/linux/lockdep.h b/include/linux/lockdep.h |
| index 9ccf0e2..528620e 100644 |
| --- a/include/linux/lockdep.h |
| +++ b/include/linux/lockdep.h |
| @@ -40,6 +40,8 @@ struct lock_class_key { |
| struct lockdep_subclass_key subkeys[MAX_LOCKDEP_SUBCLASSES]; |
| }; |
| |
| +extern struct lock_class_key __lockdep_no_validate__; |
| + |
| #define LOCKSTAT_POINTS 4 |
| |
| /* |
| @@ -266,6 +268,9 @@ extern void lockdep_init_map(struct lockdep_map *lock, const char *name, |
| #define lockdep_set_subclass(lock, sub) \ |
| lockdep_init_map(&(lock)->dep_map, #lock, \ |
| (lock)->dep_map.key, sub) |
| + |
| +#define lockdep_set_novalidate_class(lock) \ |
| + lockdep_set_class(lock, &__lockdep_no_validate__) |
| /* |
| * Compare locking classes |
| */ |
| @@ -350,6 +355,9 @@ static inline void lockdep_on(void) |
| #define lockdep_set_class_and_subclass(lock, key, sub) \ |
| do { (void)(key); } while (0) |
| #define lockdep_set_subclass(lock, sub) do { } while (0) |
| + |
| +#define lockdep_set_novalidate_class(lock) do { } while (0) |
| + |
| /* |
| * We don't define lockdep_match_class() and lockdep_match_key() for !LOCKDEP |
| * case since the result is not well defined and the caller should rather |
| diff --git a/kernel/lockdep.c b/kernel/lockdep.c |
| index cf6db46..1199bda 100644 |
| --- a/kernel/lockdep.c |
| +++ b/kernel/lockdep.c |
| @@ -805,6 +805,12 @@ out_unlock_set: |
| return class; |
| } |
| |
| +#if defined(CONFIG_PROVE_LOCKING) || defined(CONFIG_TRACE_IRQFLAGS) |
| + |
| +/* CHECKME */ |
| + |
| +#endif /* CONFIG_PROVE_LOCKING || CONFIG_TRACE_IRQFLAGS */ |
| + |
| #ifdef CONFIG_PROVE_LOCKING |
| /* |
| * Allocate a lockdep entry. (assumes the graph_lock held, returns |
| @@ -2718,6 +2724,8 @@ void lockdep_init_map(struct lockdep_map *lock, const char *name, |
| } |
| EXPORT_SYMBOL_GPL(lockdep_init_map); |
| |
| +struct lock_class_key __lockdep_no_validate__; |
| + |
| /* |
| * This gets called for every mutex_lock*()/spin_lock*() operation. |
| * We maintain the dependency maps and validate the locking attempt: |
| @@ -2752,6 +2760,9 @@ static int __lock_acquire(struct lockdep_map *lock, unsigned int subclass, |
| return 0; |
| } |
| |
| + if (lock->key == &__lockdep_no_validate__) |
| + check = 1; |
| + |
| if (!subclass) |
| class = lock->class_cache; |
| /* |
| @@ -3597,6 +3608,9 @@ void lockdep_init(void) |
| for (i = 0; i < CHAINHASH_SIZE; i++) |
| INIT_LIST_HEAD(chainhash_table + i); |
| |
| + /* Hack alert ! */ |
| + lockdep_set_novalidate_class(&kernel_sem); |
| + |
| lockdep_initialized = 1; |
| } |
| |
| -- |
| 1.7.1.1 |
| |