Messages in this thread Patch in this message | | | Date | Tue, 8 May 2012 15:58:49 -0700 (PDT) | From | Hugh Dickins <> | Subject | Re: linux-next oops in __lock_acquire for process_one_work |
| |
On Wed, 9 May 2012, Peter Zijlstra wrote: > On Tue, 2012-05-08 at 11:11 -0700, Hugh Dickins wrote: > > Please send me the version of patch you'd like to put in > > (lest I make it up myself and you don't like the result). > > something like so?
More like the one below: I'm not alone in preferring a comma between args!
And you're not a believer in checkpatch.pl, I see: I've removed trailing spaces; but left the 85-col line, that's not a fight I'll have with you.
I'll set it going when I get home later - thanks.
Hugh
--- include/linux/lockdep.h | 17 +++++++++++++++++ kernel/timer.c | 4 +++- kernel/workqueue.c | 4 +++- 3 files changed, 23 insertions(+), 2 deletions(-)
diff --git a/include/linux/lockdep.h b/include/linux/lockdep.h index d36619e..968c3e2 100644 --- a/include/linux/lockdep.h +++ b/include/linux/lockdep.h @@ -157,6 +157,23 @@ struct lockdep_map { #endif }; +static inline void lockdep_copy_map(struct lockdep_map *to, struct lockdep_map *from) +{ + int i; + + *to = *from; + /* + * Since the class cache can be modified concurrently we could observe + * half pointers (64bit arch using 32bit copy insns). Therefore clear + * the caches and take the performance hit. + * + * XXX it doesn't work well with lockdep_set_class_and_subclass(), since + * that relies on cache abuse. + */ + for (i = 0; i < NR_LOCKDEP_CACHING_CLASSES; i++) + to->class_cache[i] = NULL; +} + /* * Every lock has a list of other locks that were taken after it. * We only grow the list, never remove from it: diff --git a/kernel/timer.c b/kernel/timer.c index a297ffc..6aa7ad8 100644 --- a/kernel/timer.c +++ b/kernel/timer.c @@ -1102,7 +1102,9 @@ static void call_timer_fn(struct timer_list *timer, void (*fn)(unsigned long), * warnings as well as problems when looking into * timer->lockdep_map, make a copy and use that here. */ - struct lockdep_map lockdep_map = timer->lockdep_map; + struct lockdep_map lockdep_map; + + lockdep_copy_map(&lockdep_map, &timer->lockdep_map); #endif /* * Couple the lock chain with the lock chain at diff --git a/kernel/workqueue.c b/kernel/workqueue.c index 5abf42f..7d77d1f 100644 --- a/kernel/workqueue.c +++ b/kernel/workqueue.c @@ -1810,7 +1810,9 @@ __acquires(&gcwq->lock) * lock freed" warnings as well as problems when looking into * work->lockdep_map, make a copy and use that here. */ - struct lockdep_map lockdep_map = work->lockdep_map; + struct lockdep_map lockdep_map; + + lockdep_copy_map(&lockdep_map, &work->lockdep_map); #endif /* * A single work shouldn't be executed concurrently by
| |