Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp4187867imm; Mon, 11 Jun 2018 08:19:04 -0700 (PDT) X-Google-Smtp-Source: ADUXVKL6mS2v/AZElpdL3b9L9iVFAlk5mfEsQB9pFNieqwhtoZk6eRz55L24EoxsTFsgkQZunSn0 X-Received: by 2002:a65:560f:: with SMTP id l15-v6mr11456980pgs.260.1528730344031; Mon, 11 Jun 2018 08:19:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528730343; cv=none; d=google.com; s=arc-20160816; b=O77sAr4b0LOpXCM5lpt1tLXMPJxsf1GruGgs42800Cwpraw7w4cA2T0S9dRKKaEnSh otESpINlHv5WJ5RTsAY1ALmCDiXlhMKuGBwkHoyXZzeH3EYSQA1qC4wUc3FfRwoEhsll 0LrVlA5AyYajt/0y7vHSsV4Az9zyEAHN+wBNF3v4pV9gXlHLMNJ0I74w6fu9DbW0lnOp 4vhUDAkI+DDQ+XH8XPzbewarTnhFVUkn3kN/a3vV9mP7r2AxqaXYf9HrTnPCLiXviQTP mgTrJceJoz4FLTeSgWNVrsxqq/qGW5BgubpOXkI7egvRCq785EBwLMQrvyFy6kK4gqMb TZ0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:user-agent:in-reply-to :content-disposition:mime-version:references:reply-to:subject:cc:to :from:date:arc-authentication-results; bh=2YukFyXJBDg+OlUjG9oy89jjy0pERGrJBRiwje+bOb4=; b=n3z/I+maABT2pzVCZtZaiU59hKg0PYFdiFQuXbMUXbWWFVt+l5EarFy0UDkLHDT5dz W0VKsqs6N4UU1bYnrgDw9CENn5sSpySkwTZeesTiWhKynWEmAkK/akTE7wmZF4SChw+t 4JWQwSZY9Z0X2K9ucXg15NMs7BQtuIq62F3WWtHIGNVIx4che5JxYe6mrbwt7TqYOJNQ xMtnMjMG7138kwOCVgN2GakIrPcOUwO9mAKQlmM774OS79LVuyonCYPF95VDqm1W2iDR hWnjH+agj2+3/mLth4eyiYjCf+CpersPN1bF+vP3HuREK+nnijZjoT0dG1+eTeWKBg4R wYiQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l4-v6si63623813plb.213.2018.06.11.08.18.49; Mon, 11 Jun 2018 08:19:03 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932831AbeFKPSK (ORCPT + 99 others); Mon, 11 Jun 2018 11:18:10 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:55160 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932678AbeFKPSE (ORCPT ); Mon, 11 Jun 2018 11:18:04 -0400 Received: from pps.filterd (m0098421.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w5BFFAAC123617 for ; Mon, 11 Jun 2018 11:18:04 -0400 Received: from e11.ny.us.ibm.com (e11.ny.us.ibm.com [129.33.205.201]) by mx0a-001b2d01.pphosted.com with ESMTP id 2jhudt8mrd-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 11 Jun 2018 11:18:03 -0400 Received: from localhost by e11.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 11 Jun 2018 11:18:03 -0400 Received: from b01cxnp22034.gho.pok.ibm.com (9.57.198.24) by e11.ny.us.ibm.com (146.89.104.198) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Mon, 11 Jun 2018 11:18:00 -0400 Received: from b01ledav003.gho.pok.ibm.com (b01ledav003.gho.pok.ibm.com [9.57.199.108]) by b01cxnp22034.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w5BFHxNA3998072 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 11 Jun 2018 15:17:59 GMT Received: from b01ledav003.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 098FFB206C; Mon, 11 Jun 2018 11:17:59 -0400 (EDT) Received: from b01ledav003.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E78D7B2065; Mon, 11 Jun 2018 11:17:58 -0400 (EDT) Received: from paulmck-ThinkPad-W541 (unknown [9.85.157.62]) by b01ledav003.gho.pok.ibm.com (Postfix) with ESMTP; Mon, 11 Jun 2018 11:17:58 -0400 (EDT) Received: by paulmck-ThinkPad-W541 (Postfix, from userid 1000) id 98B7B16C997C; Mon, 11 Jun 2018 05:56:58 -0700 (PDT) Date: Mon, 11 Jun 2018 05:56:58 -0700 From: "Paul E. McKenney" To: Joel Fernandes Cc: linux-kernel@vger.kernel.org, kernel-team@android.com, "Joel Fernandes (Google)" , Josh Triplett , Lai Jiangshan , Mathieu Desnoyers , mingo@redhat.com, Steven Rostedt , tglx@linutronix.de Subject: Re: [PATCH 1/2] rcutorture: Disable RT throttling for boost tests Reply-To: paulmck@linux.vnet.ibm.com References: <20180610234544.150933-1-joel@joelfernandes.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180610234544.150933-1-joel@joelfernandes.org> User-Agent: Mutt/1.5.21 (2010-09-15) X-TM-AS-GCONF: 00 x-cbid: 18061115-2213-0000-0000-000002B6E842 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00009170; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000265; SDB=6.01045450; UDB=6.00535337; IPR=6.00824427; MB=3.00021581; MTD=3.00000008; XFM=3.00000015; UTC=2018-06-11 15:18:02 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18061115-2214-0000-0000-00005A7111FF Message-Id: <20180611125658.GR3593@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-06-11_07:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1805220000 definitions=main-1806110175 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Jun 10, 2018 at 04:45:43PM -0700, Joel Fernandes wrote: > From: "Joel Fernandes (Google)" > > Currently rcutorture is not able to torture RCU boosting properly. This > is because the rcutorture's boost threads which are doing the torturing > may be throttled due to RT throttling. > > This patch makes rcutorture use the right torture technique (unthrottled > rcutorture boost tasks) for torturing RCU so that the test fails > correctly when no boost is available. > > Currently this requires accessing sysctl_sched_rt_runtime directly, but > that should be Ok since rcutorture is test code. Such direct access is > also only possible if rcutorture is used as a built-in so make it > conditional on that. > > Signed-off-by: Joel Fernandes (Google) Thank you, Joel! I have queued these for testing and review. Peter Zijlstra might have some feedback on variable access, but will test first. Thanx, Paul > --- > kernel/rcu/rcutorture.c | 29 +++++++++++++++++++++++++++++ > 1 file changed, 29 insertions(+) > > diff --git a/kernel/rcu/rcutorture.c b/kernel/rcu/rcutorture.c > index 5219e7ccd8a4..00e06349d7bb 100644 > --- a/kernel/rcu/rcutorture.c > +++ b/kernel/rcu/rcutorture.c > @@ -55,6 +55,7 @@ > #include > #include > #include > +#include > > #include "rcu.h" > > @@ -772,6 +773,32 @@ static void rcu_torture_boost_cb(struct rcu_head *head) > smp_store_release(&rbip->inflight, 0); > } > > +static int old_rt_runtime = -1; > + > +static void rcu_torture_disable_rt_throttle(void) > +{ > + /* > + * Disable RT throttling so that rcutorture's boost threads don't get > + * throttled. Only possible if rcutorture is built-in otherwise the > + * user should manually do this by setting the sched_rt_period_us and > + * sched_rt_runtime sysctls. > + */ > + if (!IS_BUILTIN(CONFIG_RCU_TORTURE_TEST) || old_rt_runtime != -1) > + return; > + > + old_rt_runtime = sysctl_sched_rt_runtime; > + sysctl_sched_rt_runtime = -1; > +} > + > +static void rcu_torture_enable_rt_throttle(void) > +{ > + if (!IS_BUILTIN(CONFIG_RCU_TORTURE_TEST) || old_rt_runtime == -1) > + return; > + > + sysctl_sched_rt_runtime = old_rt_runtime; > + old_rt_runtime = -1; > +} > + > static int rcu_torture_boost(void *arg) > { > unsigned long call_rcu_time; > @@ -1510,6 +1537,7 @@ static int rcutorture_booster_cleanup(unsigned int cpu) > mutex_lock(&boost_mutex); > t = boost_tasks[cpu]; > boost_tasks[cpu] = NULL; > + rcu_torture_enable_rt_throttle(); > mutex_unlock(&boost_mutex); > > /* This must be outside of the mutex, otherwise deadlock! */ > @@ -1526,6 +1554,7 @@ static int rcutorture_booster_init(unsigned int cpu) > > /* Don't allow time recalculation while creating a new task. */ > mutex_lock(&boost_mutex); > + rcu_torture_disable_rt_throttle(); > VERBOSE_TOROUT_STRING("Creating rcu_torture_boost task"); > boost_tasks[cpu] = kthread_create_on_node(rcu_torture_boost, NULL, > cpu_to_node(cpu), > -- > 2.18.0.rc1.242.g61856ae69a-goog >