diff options
-rw-r--r-- | include/linux/rcupdate.h | 14 | ||||
-rw-r--r-- | include/linux/srcu.h | 4 |
2 files changed, 16 insertions, 2 deletions
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h index 146d37d31778..6ee663c8745a 100644 --- a/include/linux/rcupdate.h +++ b/include/linux/rcupdate.h | |||
@@ -248,13 +248,11 @@ static inline int rcu_is_cpu_idle(void) | |||
248 | 248 | ||
249 | static inline void rcu_lock_acquire(struct lockdep_map *map) | 249 | static inline void rcu_lock_acquire(struct lockdep_map *map) |
250 | { | 250 | { |
251 | WARN_ON_ONCE(rcu_is_cpu_idle()); | ||
252 | lock_acquire(map, 0, 0, 2, 1, NULL, _THIS_IP_); | 251 | lock_acquire(map, 0, 0, 2, 1, NULL, _THIS_IP_); |
253 | } | 252 | } |
254 | 253 | ||
255 | static inline void rcu_lock_release(struct lockdep_map *map) | 254 | static inline void rcu_lock_release(struct lockdep_map *map) |
256 | { | 255 | { |
257 | WARN_ON_ONCE(rcu_is_cpu_idle()); | ||
258 | lock_release(map, 1, _THIS_IP_); | 256 | lock_release(map, 1, _THIS_IP_); |
259 | } | 257 | } |
260 | 258 | ||
@@ -699,6 +697,8 @@ static inline void rcu_read_lock(void) | |||
699 | __rcu_read_lock(); | 697 | __rcu_read_lock(); |
700 | __acquire(RCU); | 698 | __acquire(RCU); |
701 | rcu_lock_acquire(&rcu_lock_map); | 699 | rcu_lock_acquire(&rcu_lock_map); |
700 | rcu_lockdep_assert(!rcu_is_cpu_idle(), | ||
701 | "rcu_read_lock() used illegally while idle"); | ||
702 | } | 702 | } |
703 | 703 | ||
704 | /* | 704 | /* |
@@ -718,6 +718,8 @@ static inline void rcu_read_lock(void) | |||
718 | */ | 718 | */ |
719 | static inline void rcu_read_unlock(void) | 719 | static inline void rcu_read_unlock(void) |
720 | { | 720 | { |
721 | rcu_lockdep_assert(!rcu_is_cpu_idle(), | ||
722 | "rcu_read_unlock() used illegally while idle"); | ||
721 | rcu_lock_release(&rcu_lock_map); | 723 | rcu_lock_release(&rcu_lock_map); |
722 | __release(RCU); | 724 | __release(RCU); |
723 | __rcu_read_unlock(); | 725 | __rcu_read_unlock(); |
@@ -745,6 +747,8 @@ static inline void rcu_read_lock_bh(void) | |||
745 | local_bh_disable(); | 747 | local_bh_disable(); |
746 | __acquire(RCU_BH); | 748 | __acquire(RCU_BH); |
747 | rcu_lock_acquire(&rcu_bh_lock_map); | 749 | rcu_lock_acquire(&rcu_bh_lock_map); |
750 | rcu_lockdep_assert(!rcu_is_cpu_idle(), | ||
751 | "rcu_read_lock_bh() used illegally while idle"); | ||
748 | } | 752 | } |
749 | 753 | ||
750 | /* | 754 | /* |
@@ -754,6 +758,8 @@ static inline void rcu_read_lock_bh(void) | |||
754 | */ | 758 | */ |
755 | static inline void rcu_read_unlock_bh(void) | 759 | static inline void rcu_read_unlock_bh(void) |
756 | { | 760 | { |
761 | rcu_lockdep_assert(!rcu_is_cpu_idle(), | ||
762 | "rcu_read_unlock_bh() used illegally while idle"); | ||
757 | rcu_lock_release(&rcu_bh_lock_map); | 763 | rcu_lock_release(&rcu_bh_lock_map); |
758 | __release(RCU_BH); | 764 | __release(RCU_BH); |
759 | local_bh_enable(); | 765 | local_bh_enable(); |
@@ -777,6 +783,8 @@ static inline void rcu_read_lock_sched(void) | |||
777 | preempt_disable(); | 783 | preempt_disable(); |
778 | __acquire(RCU_SCHED); | 784 | __acquire(RCU_SCHED); |
779 | rcu_lock_acquire(&rcu_sched_lock_map); | 785 | rcu_lock_acquire(&rcu_sched_lock_map); |
786 | rcu_lockdep_assert(!rcu_is_cpu_idle(), | ||
787 | "rcu_read_lock_sched() used illegally while idle"); | ||
780 | } | 788 | } |
781 | 789 | ||
782 | /* Used by lockdep and tracing: cannot be traced, cannot call lockdep. */ | 790 | /* Used by lockdep and tracing: cannot be traced, cannot call lockdep. */ |
@@ -793,6 +801,8 @@ static inline notrace void rcu_read_lock_sched_notrace(void) | |||
793 | */ | 801 | */ |
794 | static inline void rcu_read_unlock_sched(void) | 802 | static inline void rcu_read_unlock_sched(void) |
795 | { | 803 | { |
804 | rcu_lockdep_assert(!rcu_is_cpu_idle(), | ||
805 | "rcu_read_unlock_sched() used illegally while idle"); | ||
796 | rcu_lock_release(&rcu_sched_lock_map); | 806 | rcu_lock_release(&rcu_sched_lock_map); |
797 | __release(RCU_SCHED); | 807 | __release(RCU_SCHED); |
798 | preempt_enable(); | 808 | preempt_enable(); |
diff --git a/include/linux/srcu.h b/include/linux/srcu.h index 9a323728e60c..d3d5fa54f25e 100644 --- a/include/linux/srcu.h +++ b/include/linux/srcu.h | |||
@@ -172,6 +172,8 @@ static inline int srcu_read_lock(struct srcu_struct *sp) __acquires(sp) | |||
172 | int retval = __srcu_read_lock(sp); | 172 | int retval = __srcu_read_lock(sp); |
173 | 173 | ||
174 | rcu_lock_acquire(&(sp)->dep_map); | 174 | rcu_lock_acquire(&(sp)->dep_map); |
175 | rcu_lockdep_assert(!rcu_is_cpu_idle(), | ||
176 | "srcu_read_lock() used illegally while idle"); | ||
175 | return retval; | 177 | return retval; |
176 | } | 178 | } |
177 | 179 | ||
@@ -185,6 +187,8 @@ static inline int srcu_read_lock(struct srcu_struct *sp) __acquires(sp) | |||
185 | static inline void srcu_read_unlock(struct srcu_struct *sp, int idx) | 187 | static inline void srcu_read_unlock(struct srcu_struct *sp, int idx) |
186 | __releases(sp) | 188 | __releases(sp) |
187 | { | 189 | { |
190 | rcu_lockdep_assert(!rcu_is_cpu_idle(), | ||
191 | "srcu_read_unlock() used illegally while idle"); | ||
188 | rcu_lock_release(&(sp)->dep_map); | 192 | rcu_lock_release(&(sp)->dep_map); |
189 | __srcu_read_unlock(sp, idx); | 193 | __srcu_read_unlock(sp, idx); |
190 | } | 194 | } |