Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp3438780imm; Sun, 10 Jun 2018 16:46:55 -0700 (PDT) X-Google-Smtp-Source: ADUXVKILtdE01pYzwb+mXAV/0ihysNqmD2ax6ylSXS1HJ4rMDvlfxp/CMMeWQ/rdUOJb73dLZPi7 X-Received: by 2002:a63:9d81:: with SMTP id i123-v6mr12746097pgd.162.1528674415170; Sun, 10 Jun 2018 16:46:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528674415; cv=none; d=google.com; s=arc-20160816; b=nMCZYanMP8xSqx/AH06qj7971NFv4uLt6wxQBLPYY9rubBfPj+xwBGGOfcnRxzPshW h6d9dc7zPV29+p2JnLoo9CR0uvNARoelMgiZqHJo/+x3Ohpj24omSAzWREo5Pl65+E17 DBcI3G/xXAJnidyhVRXOpXsMPpQBIgY4PzUQFdN4pPA2Uhfg+pGamxk8I3KOVwkh49t+ qgPGnwO/e8zJHAgeH+6Yhfst48mVUAML7jSEsi42s3csvrZHyGaCpvJkTKal0A8ftwM9 h31FMxQCbXLKVCytg2gaiXMbVEWmkzNj6SWGKsl5Q0lzePi7ChJ+w4o8fpfkhreLGdtv GoAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=plNzHcAhpungQm78VxafCFi2EDjeTT64qkFxxYjePAU=; b=UiVTISvqTXoyclBRkz/DBbRzz5Uey+pE8PCDbJhVHLWx64B2q9/OQfR+zHc9dPcVm9 IDSC+IZKEvRYCwrmRnVU2I1L3nK/gpSJW1LJkKSmhqfDv07YRvT9CnnupSOexBM0hV/5 exvb+UniUALvId0ybueIxFnlGInLEUCivLFrNPGwu2zs6aE/3edW5nbZGWDT3+Oh2JDb JcePnZsQc8iJkoQATuGWLtE+EBZG5APR4Pp+QceyiMPrx1WasbMEVB9srQ/ham3iyznr dtusE9o7wzOmY6y36NsJ0AwAif3j7HhcreOzaqmwqKgcj5sp0+peECUKxpt6BUD+o/we dmAQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=eNozJIFI; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g83-v6si39240171pfg.225.2018.06.10.16.46.29; Sun, 10 Jun 2018 16:46:55 -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; dkim=pass header.i=@google.com header.s=20161025 header.b=eNozJIFI; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753689AbeFJXp7 (ORCPT + 99 others); Sun, 10 Jun 2018 19:45:59 -0400 Received: from mail-pf0-f194.google.com ([209.85.192.194]:33162 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753531AbeFJXp5 (ORCPT ); Sun, 10 Jun 2018 19:45:57 -0400 Received: by mail-pf0-f194.google.com with SMTP id b17-v6so9282291pfi.0 for ; Sun, 10 Jun 2018 16:45:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=plNzHcAhpungQm78VxafCFi2EDjeTT64qkFxxYjePAU=; b=eNozJIFI6hQd7Lv2ig9iNzmInQpinrSaaqC/35SfvgP24kaf1EuhPDZGTcSFLr78eL WBmiVbMtXqdOJJ/xiyV4dsVeEjcene5UwwxZoNeBu5viLVoir+qKWrT2Jgj+qDOAP0mK Bjsr1GUy78XTmGD7oqeuFH8UzIovASXMs4RSTmkRv7TGEmhdlT+rFkbWwuKXfZeiX1nc iSv8e649xExdbDXzjh6gmUfNe7cDZq5RBZb3bTosnbzqVRD3fv1htVTjzbdGciVxPaei 3p1MfjlBg9vUBGDrl3UEuLyqRXMIWV3UueUARXLekgg/WtvWDYKdFv4/s9v7MYASZVf1 XTdA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=plNzHcAhpungQm78VxafCFi2EDjeTT64qkFxxYjePAU=; b=Prx3ON5t5flm80e1Gls7daxL3LGsF9/NUndAmThOWOEFIJMWvWlNYblxzF7pkEnWYh 6C8TCqo2U1iPV3QnC4itWz8UhgwFAesnYngw6BPcxXuUqNz8drWJpmWzAEybQZo2mjZt 7Fe5yjKI6TI4bu9hld0had87h9kKt/NjQEIafR83BzyLRptB6kTPPr9fdLI3hsipetQi tbgTeaaQesTFIofonhXqEUUzq8aWepLLv4TXiLqthEZLhJ91JbO7LzVlvXPGPk6beXPK iXHmsHkPBjmNDMeqknmJKYpeTYC2uWFhJmpiUsK4fJRS5dmebWzxxwSak/vUMYeCht15 L4ow== X-Gm-Message-State: APt69E0+3HWGZ2EQKXJo/hyNo7jOkce8YFgeYZGg+JBauHcta9b7XvOy tFuCXu8kpHA8r9i5Yx2Xka0do8bcA6E= X-Received: by 2002:a65:51c9:: with SMTP id i9-v6mr10502094pgq.202.1528674356525; Sun, 10 Jun 2018 16:45:56 -0700 (PDT) Received: from joelaf.mtv.corp.google.com ([2620:0:1000:1600:3122:ea9c:d178:eb]) by smtp.gmail.com with ESMTPSA id x72-v6sm64939133pff.176.2018.06.10.16.45.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 10 Jun 2018 16:45:55 -0700 (PDT) From: Joel Fernandes X-Google-Original-From: Joel Fernandes To: linux-kernel@vger.kernel.org Cc: kernel-team@android.com, "Joel Fernandes (Google)" , Josh Triplett , Lai Jiangshan , Mathieu Desnoyers , mingo@redhat.com, "Paul E. McKenney" , Steven Rostedt , tglx@linutronix.de Subject: [PATCH 1/2] rcutorture: Disable RT throttling for boost tests Date: Sun, 10 Jun 2018 16:45:43 -0700 Message-Id: <20180610234544.150933-1-joel@joelfernandes.org> X-Mailer: git-send-email 2.18.0.rc1.242.g61856ae69a-goog Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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) --- 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