Skip to contentSkip to conversation

rcuperf: Do not wake up shutdown wait queue if "shutdown" is false.

PATCH In review Artem Savkov 2 participants 2 messages Feb 7, 2016 RCU

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 rcuperf: Do not wake up shutdown wait queue if "shutdown" is false.

After finishing it's tests rcuperf tries to wake up shutdown_wq even if "shutdown" param is set to false, resulting in a wake_up() call on an unitialized wait_queue_head_t which leads to "BUG: spinlock bad magic" and "BUG: unable to handle kernel NULL pointer dereference".

Fix by checking "shutdown" param before waking up the queue.

---
 kernel/rcu/rcuperf.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
kernel/rcu/rcuperf.c +4 -2
index 09ffa36..fb45a26 100644
@@ -414,8 +414,10 @@ rcu_perf_writer(void *arg)
 					b_rcu_perf_writer_finished =
 						cur_ops->completed();
 				}
-				smp_mb(); /* Assign before wake. */
-				wake_up(&shutdown_wq);
+				if (shutdown) {
+					smp_mb(); /* Assign before wake. */
+					wake_up(&shutdown_wq);
+				}
 			}
 		}
 		if (done && !alldone &&
Signature · 1 line
2.7.0
#1 lore raw
Quoted 8 lines · Artem Savkov

After finishing it's tests rcuperf tries to wake up shutdown_wq even if "shutdown" param is set to false, resulting in a wake_up() call on an unitialized wait_queue_head_t which leads to "BUG: spinlock bad magic" and "BUG: unable to handle kernel NULL pointer dereference".

Fix by checking "shutdown" param before waking up the queue.

Good catch! Queued for testing and review.

Thanx, Paul

Quoted 24 lines
---
 kernel/rcu/rcuperf.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
kernel/rcu/rcuperf.c +4 -2
index 09ffa36..fb45a26 100644
@@ -414,8 +414,10 @@ rcu_perf_writer(void *arg)
 					b_rcu_perf_writer_finished =
 						cur_ops->completed();
 				}
-				smp_mb(); /* Assign before wake. */
-				wake_up(&shutdown_wq);
+				if (shutdown) {
+					smp_mb(); /* Assign before wake. */
+					wake_up(&shutdown_wq);
+				}
 			}
 		}
 		if (done && !alldone &&
Signature · 1 line
2.7.0