From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754286AbcHSCHg (ORCPT ); Thu, 18 Aug 2016 22:07:36 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:40716 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754111AbcHSCHX (ORCPT ); Thu, 18 Aug 2016 22:07:23 -0400 X-IBM-Helo: d03dlp02.boulder.ibm.com X-IBM-MailFrom: paulmck@linux.vnet.ibm.com Date: Thu, 18 Aug 2016 09:20:31 -0700 From: "Paul E. McKenney" To: Sebastian Andrzej Siewior Cc: linux-kernel@vger.kernel.org, Peter Zijlstra , Ingo Molnar , rt@linutronix.de, Josh Triplett , Steven Rostedt , Mathieu Desnoyers , Lai Jiangshan Subject: Re: [PATCH 07/16] rcu: rcutorture: Convert to hotplug state machine Reply-To: paulmck@linux.vnet.ibm.com References: <20160818125731.27256-1-bigeasy@linutronix.de> <20160818125731.27256-8-bigeasy@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160818125731.27256-8-bigeasy@linutronix.de> User-Agent: Mutt/1.5.21 (2010-09-15) X-TM-AS-GCONF: 00 X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16081816-0004-0000-0000-0000102B70A3 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00005613; HX=3.00000240; KW=3.00000007; PH=3.00000004; SC=3.00000181; SDB=6.00746461; UDB=6.00351932; IPR=6.00518999; BA=6.00004668; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00012379; XFM=3.00000011; UTC=2016-08-18 16:20:43 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16081816-0005-0000-0000-00007817E5E6 Message-Id: <20160818162031.GO3482@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2016-08-18_08:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1604210000 definitions=main-1608180209 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Aug 18, 2016 at 02:57:22PM +0200, Sebastian Andrzej Siewior wrote: > Install the callbacks via the state machine and let the core invoke > the callbacks on the already online CPUs. > > Cc: Josh Triplett > Cc: "Paul E. McKenney" > Cc: Steven Rostedt > Cc: Mathieu Desnoyers > Cc: Lai Jiangshan > Signed-off-by: Sebastian Andrzej Siewior Queued for testing and review, thank you! Thanx, Paul > --- > kernel/rcu/rcutorture.c | 52 +++++++++++++------------------------------------ > 1 file changed, 14 insertions(+), 38 deletions(-) > > diff --git a/kernel/rcu/rcutorture.c b/kernel/rcu/rcutorture.c > index ac29017623e5..bf08fee53dc7 100644 > --- a/kernel/rcu/rcutorture.c > +++ b/kernel/rcu/rcutorture.c > @@ -1366,12 +1366,12 @@ rcu_torture_print_module_parms(struct rcu_torture_ops *cur_ops, const char *tag) > onoff_interval, onoff_holdoff); > } > > -static void rcutorture_booster_cleanup(int cpu) > +static int rcutorture_booster_cleanup(unsigned int cpu) > { > struct task_struct *t; > > if (boost_tasks[cpu] == NULL) > - return; > + return 0; > mutex_lock(&boost_mutex); > t = boost_tasks[cpu]; > boost_tasks[cpu] = NULL; > @@ -1379,9 +1379,10 @@ static void rcutorture_booster_cleanup(int cpu) > > /* This must be outside of the mutex, otherwise deadlock! */ > torture_stop_kthread(rcu_torture_boost, t); > + return 0; > } > > -static int rcutorture_booster_init(int cpu) > +static int rcutorture_booster_init(unsigned int cpu) > { > int retval; > > @@ -1581,28 +1582,7 @@ static void rcu_torture_barrier_cleanup(void) > } > } > > -static int rcutorture_cpu_notify(struct notifier_block *self, > - unsigned long action, void *hcpu) > -{ > - long cpu = (long)hcpu; > - > - switch (action & ~CPU_TASKS_FROZEN) { > - case CPU_ONLINE: > - case CPU_DOWN_FAILED: > - (void)rcutorture_booster_init(cpu); > - break; > - case CPU_DOWN_PREPARE: > - rcutorture_booster_cleanup(cpu); > - break; > - default: > - break; > - } > - return NOTIFY_OK; > -} > - > -static struct notifier_block rcutorture_cpu_nb = { > - .notifier_call = rcutorture_cpu_notify, > -}; > +static enum cpuhp_state rcutor_hp; > > static void > rcu_torture_cleanup(void) > @@ -1642,11 +1622,8 @@ rcu_torture_cleanup(void) > for (i = 0; i < ncbflooders; i++) > torture_stop_kthread(rcu_torture_cbflood, cbflood_task[i]); > if ((test_boost == 1 && cur_ops->can_boost) || > - test_boost == 2) { > - unregister_cpu_notifier(&rcutorture_cpu_nb); > - for_each_possible_cpu(i) > - rcutorture_booster_cleanup(i); > - } > + test_boost == 2) > + cpuhp_remove_state(rcutor_hp); > > /* > * Wait for all RCU callbacks to fire, then do flavor-specific > @@ -1873,14 +1850,13 @@ rcu_torture_init(void) > test_boost == 2) { > > boost_starttime = jiffies + test_boost_interval * HZ; > - register_cpu_notifier(&rcutorture_cpu_nb); > - for_each_possible_cpu(i) { > - if (cpu_is_offline(i)) > - continue; /* Heuristic: CPU can go offline. */ > - firsterr = rcutorture_booster_init(i); > - if (firsterr) > - goto unwind; > - } > + > + firsterr = cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "RCU_TORTURE", > + rcutorture_booster_init, > + rcutorture_booster_cleanup); > + if (firsterr < 0) > + goto unwind; > + rcutor_hp = firsterr; > } > firsterr = torture_shutdown_init(shutdown_secs, rcu_torture_cleanup); > if (firsterr) > -- > 2.9.3 >