linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] rcuperf: Do not wake up shutdown wait queue if "shutdown" is false.
@ 2016-02-07 12:31 Artem Savkov
  2016-02-07 19:43 ` Paul E. McKenney
  0 siblings, 1 reply; 2+ messages in thread
From: Artem Savkov @ 2016-02-07 12:31 UTC (permalink / raw)
  To: paulmck; +Cc: linux-kernel, 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.

Signed-off-by: Artem Savkov <artem.savkov@gmail.com>
---
 kernel/rcu/rcuperf.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/kernel/rcu/rcuperf.c b/kernel/rcu/rcuperf.c
index 09ffa36..fb45a26 100644
--- a/kernel/rcu/rcuperf.c
+++ b/kernel/rcu/rcuperf.c
@@ -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 &&
-- 
2.7.0

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] rcuperf: Do not wake up shutdown wait queue if "shutdown" is false.
  2016-02-07 12:31 [PATCH] rcuperf: Do not wake up shutdown wait queue if "shutdown" is false Artem Savkov
@ 2016-02-07 19:43 ` Paul E. McKenney
  0 siblings, 0 replies; 2+ messages in thread
From: Paul E. McKenney @ 2016-02-07 19:43 UTC (permalink / raw)
  To: Artem Savkov; +Cc: linux-kernel

On Sun, Feb 07, 2016 at 01:31:39PM +0100, Artem Savkov wrote:
> 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.
> 
> Signed-off-by: Artem Savkov <artem.savkov@gmail.com>

Good catch!  Queued for testing and review.

								Thanx, Paul

> ---
>  kernel/rcu/rcuperf.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/kernel/rcu/rcuperf.c b/kernel/rcu/rcuperf.c
> index 09ffa36..fb45a26 100644
> --- a/kernel/rcu/rcuperf.c
> +++ b/kernel/rcu/rcuperf.c
> @@ -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 &&
> -- 
> 2.7.0
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-02-07 19:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-07 12:31 [PATCH] rcuperf: Do not wake up shutdown wait queue if "shutdown" is false Artem Savkov
2016-02-07 19:43 ` Paul E. McKenney

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).