From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754726AbcBGTnH (ORCPT ); Sun, 7 Feb 2016 14:43:07 -0500 Received: from e36.co.us.ibm.com ([32.97.110.154]:44506 "EHLO e36.co.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750997AbcBGTnE (ORCPT ); Sun, 7 Feb 2016 14:43:04 -0500 X-IBM-Helo: d03dlp02.boulder.ibm.com X-IBM-MailFrom: paulmck@linux.vnet.ibm.com X-IBM-RcptTo: linux-kernel@vger.kernel.org Date: Sun, 7 Feb 2016 11:43:02 -0800 From: "Paul E. McKenney" To: Artem Savkov Cc: linux-kernel@vger.kernel.org Subject: Re: [PATCH] rcuperf: Do not wake up shutdown wait queue if "shutdown" is false. Message-ID: <20160207194302.GX6719@linux.vnet.ibm.com> Reply-To: paulmck@linux.vnet.ibm.com References: <1454848299-25194-1-git-send-email-artem.savkov@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1454848299-25194-1-git-send-email-artem.savkov@gmail.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16020719-0021-0000-0000-000016D4013E Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 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 >