Will help enable user-defined lockdep maps for workqueues.
Showing the changes to kernel/workqueue.c (1 of 1 file). Show all
Unified · Split
| @@ -364,7 +364,8 @@ struct workqueue_struct { · 363 unmodified lines | |||
| 364 | #ifdef CONFIG_LOCKDEP | 364 | #ifdef CONFIG_LOCKDEP |
| 365 | char *lock_name; | 365 | char *lock_name; |
| 366 | struct lock_class_key key; | 366 | struct lock_class_key key; |
| 367 | struct lockdep_map lockdep_map; | 367 | struct lockdep_map __lockdep_map; |
| 368 | struct lockdep_map *lockdep_map; | ||
| 368 | #endif | 369 | #endif |
| 369 | char name[WQ_NAME_LEN]; /* I: workqueue name */ | 370 | char name[WQ_NAME_LEN]; /* I: workqueue name */ |
| 370 | 371 | ||
| @@ -3203,7 +3204,7 @@ __acquires(&pool->lock) · 2832 unmodified lines | |||
| 3203 | lockdep_start_depth = lockdep_depth(current); | 3204 | lockdep_start_depth = lockdep_depth(current); |
| 3204 | /* see drain_dead_softirq_workfn() */ | 3205 | /* see drain_dead_softirq_workfn() */ |
| 3205 | if (!bh_draining) | 3206 | if (!bh_draining) |
| 3206 | lock_map_acquire(&pwq->wq->lockdep_map); | 3207 | lock_map_acquire(pwq->wq->lockdep_map); |
| 3207 | lock_map_acquire(&lockdep_map); | 3208 | lock_map_acquire(&lockdep_map); |
| 3208 | /* | 3209 | /* |
| 3209 | * Strictly speaking we should mark the invariant state without holding | 3210 | * Strictly speaking we should mark the invariant state without holding |
| @@ -3237,7 +3238,7 @@ __acquires(&pool->lock) · 27 unmodified lines | |||
| 3237 | pwq->stats[PWQ_STAT_COMPLETED]++; | 3238 | pwq->stats[PWQ_STAT_COMPLETED]++; |
| 3238 | lock_map_release(&lockdep_map); | 3239 | lock_map_release(&lockdep_map); |
| 3239 | if (!bh_draining) | 3240 | if (!bh_draining) |
| 3240 | lock_map_release(&pwq->wq->lockdep_map); | 3241 | lock_map_release(pwq->wq->lockdep_map); |
| 3241 | 3242 | ||
| 3242 | if (unlikely((worker->task && in_atomic()) || | 3243 | if (unlikely((worker->task && in_atomic()) || |
| 3243 | lockdep_depth(current) != lockdep_start_depth || | 3244 | lockdep_depth(current) != lockdep_start_depth || |
| @@ -3873,8 +3874,8 @@ static void touch_wq_lockdep_map(struct workqueue_struct *wq) · 629 unmodified lines | |||
| 3873 | if (wq->flags & WQ_BH) | 3874 | if (wq->flags & WQ_BH) |
| 3874 | local_bh_disable(); | 3875 | local_bh_disable(); |
| 3875 | 3876 | ||
| 3876 | lock_map_acquire(&wq->lockdep_map); | 3877 | lock_map_acquire(wq->lockdep_map); |
| 3877 | lock_map_release(&wq->lockdep_map); | 3878 | lock_map_release(wq->lockdep_map); |
| 3878 | 3879 | ||
| 3879 | if (wq->flags & WQ_BH) | 3880 | if (wq->flags & WQ_BH) |
| 3880 | local_bh_enable(); | 3881 | local_bh_enable(); |
| @@ -3908,7 +3909,7 @@ void __flush_workqueue(struct workqueue_struct *wq) · 27 unmodified lines | |||
| 3908 | struct wq_flusher this_flusher = { | 3909 | struct wq_flusher this_flusher = { |
| 3909 | .list = LIST_HEAD_INIT(this_flusher.list), | 3910 | .list = LIST_HEAD_INIT(this_flusher.list), |
| 3910 | .flush_color = -1, | 3911 | .flush_color = -1, |
| 3911 | .done = COMPLETION_INITIALIZER_ONSTACK_MAP(this_flusher.done, wq->lockdep_map), | 3912 | .done = COMPLETION_INITIALIZER_ONSTACK_MAP(this_flusher.done, (*wq->lockdep_map)), |
| 3912 | }; | 3913 | }; |
| 3913 | int next_color; | 3914 | int next_color; |
| 3914 | 3915 | ||
| @@ -4768,7 +4769,8 @@ static void wq_init_lockdep(struct workqueue_struct *wq) · 853 unmodified lines | |||
| 4768 | lock_name = wq->name; | 4769 | lock_name = wq->name; |
| 4769 | 4770 | ||
| 4770 | wq->lock_name = lock_name; | 4771 | wq->lock_name = lock_name; |
| 4771 | lockdep_init_map(&wq->lockdep_map, lock_name, &wq->key, 0); | 4772 | wq->lockdep_map = &wq->__lockdep_map; |
| 4773 | lockdep_init_map(wq->lockdep_map, lock_name, &wq->key, 0); | ||
| 4772 | } | 4774 | } |
| 4773 | 4775 | ||
| 4774 | static void wq_unregister_lockdep(struct workqueue_struct *wq) | 4776 | static void wq_unregister_lockdep(struct workqueue_struct *wq) |