diff options
author | Martijn Coenen <maco@android.com> | 2017-08-31 04:04:26 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-09-01 03:21:57 -0400 |
commit | 858b2719686ddd0ab5fc77479a46d16f90e6b7da (patch) | |
tree | 31ce51f18aab399e037ae86e88ccb4b4bdbc0459 | |
parent | abcc61537e3566cae7f1fd225f2dcb82b3595fe3 (diff) |
ANDROID: binder: Don't BUG_ON(!spin_is_locked()).
Because is_spin_locked() always returns false on UP
systems.
Use assert_spin_locked() instead, and remove the
WARN_ON() instances, since those were easy to verify.
Signed-off-by: Martijn Coenen <maco@android.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/android/binder.c | 26 |
1 files changed, 10 insertions, 16 deletions
diff --git a/drivers/android/binder.c b/drivers/android/binder.c index eb8bd8d7c4c9..afe6ac37e1ca 100644 --- a/drivers/android/binder.c +++ b/drivers/android/binder.c | |||
@@ -987,7 +987,7 @@ binder_select_thread_ilocked(struct binder_proc *proc) | |||
987 | { | 987 | { |
988 | struct binder_thread *thread; | 988 | struct binder_thread *thread; |
989 | 989 | ||
990 | BUG_ON(!spin_is_locked(&proc->inner_lock)); | 990 | assert_spin_locked(&proc->inner_lock); |
991 | thread = list_first_entry_or_null(&proc->waiting_threads, | 991 | thread = list_first_entry_or_null(&proc->waiting_threads, |
992 | struct binder_thread, | 992 | struct binder_thread, |
993 | waiting_thread_node); | 993 | waiting_thread_node); |
@@ -1018,7 +1018,7 @@ static void binder_wakeup_thread_ilocked(struct binder_proc *proc, | |||
1018 | struct binder_thread *thread, | 1018 | struct binder_thread *thread, |
1019 | bool sync) | 1019 | bool sync) |
1020 | { | 1020 | { |
1021 | BUG_ON(!spin_is_locked(&proc->inner_lock)); | 1021 | assert_spin_locked(&proc->inner_lock); |
1022 | 1022 | ||
1023 | if (thread) { | 1023 | if (thread) { |
1024 | if (sync) | 1024 | if (sync) |
@@ -1075,7 +1075,7 @@ static struct binder_node *binder_get_node_ilocked(struct binder_proc *proc, | |||
1075 | struct rb_node *n = proc->nodes.rb_node; | 1075 | struct rb_node *n = proc->nodes.rb_node; |
1076 | struct binder_node *node; | 1076 | struct binder_node *node; |
1077 | 1077 | ||
1078 | BUG_ON(!spin_is_locked(&proc->inner_lock)); | 1078 | assert_spin_locked(&proc->inner_lock); |
1079 | 1079 | ||
1080 | while (n) { | 1080 | while (n) { |
1081 | node = rb_entry(n, struct binder_node, rb_node); | 1081 | node = rb_entry(n, struct binder_node, rb_node); |
@@ -1120,7 +1120,8 @@ static struct binder_node *binder_init_node_ilocked( | |||
1120 | binder_uintptr_t cookie = fp ? fp->cookie : 0; | 1120 | binder_uintptr_t cookie = fp ? fp->cookie : 0; |
1121 | __u32 flags = fp ? fp->flags : 0; | 1121 | __u32 flags = fp ? fp->flags : 0; |
1122 | 1122 | ||
1123 | BUG_ON(!spin_is_locked(&proc->inner_lock)); | 1123 | assert_spin_locked(&proc->inner_lock); |
1124 | |||
1124 | while (*p) { | 1125 | while (*p) { |
1125 | 1126 | ||
1126 | parent = *p; | 1127 | parent = *p; |
@@ -1195,9 +1196,9 @@ static int binder_inc_node_nilocked(struct binder_node *node, int strong, | |||
1195 | { | 1196 | { |
1196 | struct binder_proc *proc = node->proc; | 1197 | struct binder_proc *proc = node->proc; |
1197 | 1198 | ||
1198 | BUG_ON(!spin_is_locked(&node->lock)); | 1199 | assert_spin_locked(&node->lock); |
1199 | if (proc) | 1200 | if (proc) |
1200 | BUG_ON(!spin_is_locked(&proc->inner_lock)); | 1201 | assert_spin_locked(&proc->inner_lock); |
1201 | if (strong) { | 1202 | if (strong) { |
1202 | if (internal) { | 1203 | if (internal) { |
1203 | if (target_list == NULL && | 1204 | if (target_list == NULL && |
@@ -1248,9 +1249,9 @@ static bool binder_dec_node_nilocked(struct binder_node *node, | |||
1248 | { | 1249 | { |
1249 | struct binder_proc *proc = node->proc; | 1250 | struct binder_proc *proc = node->proc; |
1250 | 1251 | ||
1251 | BUG_ON(!spin_is_locked(&node->lock)); | 1252 | assert_spin_locked(&node->lock); |
1252 | if (proc) | 1253 | if (proc) |
1253 | BUG_ON(!spin_is_locked(&proc->inner_lock)); | 1254 | assert_spin_locked(&proc->inner_lock); |
1254 | if (strong) { | 1255 | if (strong) { |
1255 | if (internal) | 1256 | if (internal) |
1256 | node->internal_strong_refs--; | 1257 | node->internal_strong_refs--; |
@@ -1774,7 +1775,7 @@ static void binder_pop_transaction_ilocked(struct binder_thread *target_thread, | |||
1774 | struct binder_transaction *t) | 1775 | struct binder_transaction *t) |
1775 | { | 1776 | { |
1776 | BUG_ON(!target_thread); | 1777 | BUG_ON(!target_thread); |
1777 | BUG_ON(!spin_is_locked(&target_thread->proc->inner_lock)); | 1778 | assert_spin_locked(&target_thread->proc->inner_lock); |
1778 | BUG_ON(target_thread->transaction_stack != t); | 1779 | BUG_ON(target_thread->transaction_stack != t); |
1779 | BUG_ON(target_thread->transaction_stack->from != target_thread); | 1780 | BUG_ON(target_thread->transaction_stack->from != target_thread); |
1780 | target_thread->transaction_stack = | 1781 | target_thread->transaction_stack = |
@@ -4896,7 +4897,6 @@ static void print_binder_transaction_ilocked(struct seq_file *m, | |||
4896 | struct binder_proc *to_proc; | 4897 | struct binder_proc *to_proc; |
4897 | struct binder_buffer *buffer = t->buffer; | 4898 | struct binder_buffer *buffer = t->buffer; |
4898 | 4899 | ||
4899 | WARN_ON(!spin_is_locked(&proc->inner_lock)); | ||
4900 | spin_lock(&t->lock); | 4900 | spin_lock(&t->lock); |
4901 | to_proc = t->to_proc; | 4901 | to_proc = t->to_proc; |
4902 | seq_printf(m, | 4902 | seq_printf(m, |
@@ -4984,7 +4984,6 @@ static void print_binder_thread_ilocked(struct seq_file *m, | |||
4984 | size_t start_pos = m->count; | 4984 | size_t start_pos = m->count; |
4985 | size_t header_pos; | 4985 | size_t header_pos; |
4986 | 4986 | ||
4987 | WARN_ON(!spin_is_locked(&thread->proc->inner_lock)); | ||
4988 | seq_printf(m, " thread %d: l %02x need_return %d tr %d\n", | 4987 | seq_printf(m, " thread %d: l %02x need_return %d tr %d\n", |
4989 | thread->pid, thread->looper, | 4988 | thread->pid, thread->looper, |
4990 | thread->looper_need_return, | 4989 | thread->looper_need_return, |
@@ -5021,10 +5020,6 @@ static void print_binder_node_nilocked(struct seq_file *m, | |||
5021 | struct binder_work *w; | 5020 | struct binder_work *w; |
5022 | int count; | 5021 | int count; |
5023 | 5022 | ||
5024 | WARN_ON(!spin_is_locked(&node->lock)); | ||
5025 | if (node->proc) | ||
5026 | WARN_ON(!spin_is_locked(&node->proc->inner_lock)); | ||
5027 | |||
5028 | count = 0; | 5023 | count = 0; |
5029 | hlist_for_each_entry(ref, &node->refs, node_entry) | 5024 | hlist_for_each_entry(ref, &node->refs, node_entry) |
5030 | count++; | 5025 | count++; |
@@ -5050,7 +5045,6 @@ static void print_binder_node_nilocked(struct seq_file *m, | |||
5050 | static void print_binder_ref_olocked(struct seq_file *m, | 5045 | static void print_binder_ref_olocked(struct seq_file *m, |
5051 | struct binder_ref *ref) | 5046 | struct binder_ref *ref) |
5052 | { | 5047 | { |
5053 | WARN_ON(!spin_is_locked(&ref->proc->outer_lock)); | ||
5054 | binder_node_lock(ref->node); | 5048 | binder_node_lock(ref->node); |
5055 | seq_printf(m, " ref %d: desc %d %snode %d s %d w %d d %pK\n", | 5049 | seq_printf(m, " ref %d: desc %d %snode %d s %d w %d d %pK\n", |
5056 | ref->data.debug_id, ref->data.desc, | 5050 | ref->data.debug_id, ref->data.desc, |