linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: linux-kernel@vger.kernel.org
Cc: mingo@kernel.org, jiangshanlai@gmail.com, dipankar@in.ibm.com,
	akpm@linux-foundation.org, mathieu.desnoyers@efficios.com,
	josh@joshtriplett.org, tglx@linutronix.de, peterz@infradead.org,
	rostedt@goodmis.org, dhowells@redhat.com, edumazet@google.com,
	dvhart@linux.intel.com, fweisbec@gmail.com, oleg@redhat.com,
	bobby.prani@gmail.com,
	"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Subject: [PATCH tip/core/rcu 5/8] waketorture: Add hrtimer support
Date: Wed, 15 Jun 2016 15:28:25 -0700	[thread overview]
Message-ID: <1466029708-11359-5-git-send-email-paulmck@linux.vnet.ibm.com> (raw)
In-Reply-To: <20160615222756.GA10695@linux.vnet.ibm.com>

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
---
 kernel/rcu/waketorture.c                           | 50 ++++++++++++++++++----
 tools/testing/selftests/rcutorture/configs/wake/SH | 19 ++++++++
 .../selftests/rcutorture/configs/wake/SH.boot      |  1 +
 3 files changed, 61 insertions(+), 9 deletions(-)
 create mode 100644 tools/testing/selftests/rcutorture/configs/wake/SH
 create mode 100644 tools/testing/selftests/rcutorture/configs/wake/SH.boot

diff --git a/kernel/rcu/waketorture.c b/kernel/rcu/waketorture.c
index 3068a5c858c8..bf04c65296bd 100644
--- a/kernel/rcu/waketorture.c
+++ b/kernel/rcu/waketorture.c
@@ -62,12 +62,12 @@ torture_param(int, stat_interval, 60,
 	     "Number of seconds between stats printk()s");
 torture_param(bool, verbose, true,
 	     "Enable verbose debugging printk()s");
-torture_param(int, wait_duration, 3,
-	     "Number of jiffies to wait each iteration");
+torture_param(int, wait_duration, 127,
+	     "Number of microseconds to wait each iteration");
 torture_param(int, wait_grace, 20,
 	     "Number of jiffies before complaining about long wait");
 
-static char *torture_type = "sti";
+static char *torture_type = "sh";
 module_param(torture_type, charp, 0444);
 MODULE_PARM_DESC(torture_type, "Type of wait to torture (sti, stui, ...)");
 
@@ -94,18 +94,40 @@ MODULE_PARM_DESC(torture_runnable, "Start waketorture at boot");
  */
 
 struct wake_torture_ops {
-	signed long (*wait)(signed long timeout);
+	void (*wait)(void);
 	const char *name;
 };
 
 static struct wake_torture_ops *cur_ops;
 
 /*
+ * Definitions for schedule_hrtimeout() torture testing.
+ */
+
+static void wait_schedule_hrtimeout(void)
+{
+	ktime_t wait = ns_to_ktime(wait_duration * 1000);
+
+	set_current_state(TASK_UNINTERRUPTIBLE);
+	schedule_hrtimeout(&wait, HRTIMER_MODE_REL);
+}
+
+static struct wake_torture_ops sh_ops = {
+	.wait		= wait_schedule_hrtimeout,
+	.name		= "sh"
+};
+
+/*
  * Definitions for schedule_timeout_interruptible() torture testing.
  */
 
+static void wait_schedule_timeout_interruptible(void)
+{
+	schedule_timeout_interruptible((wait_duration + 999) / 1000);
+}
+
 static struct wake_torture_ops sti_ops = {
-	.wait		= schedule_timeout_interruptible,
+	.wait		= wait_schedule_timeout_interruptible,
 	.name		= "sti"
 };
 
@@ -113,8 +135,13 @@ static struct wake_torture_ops sti_ops = {
  * Definitions for schedule_timeout_uninterruptible() torture testing.
  */
 
+static void wait_schedule_timeout_uninterruptible(void)
+{
+	schedule_timeout_uninterruptible((wait_duration + 999) / 1000);
+}
+
 static struct wake_torture_ops stui_ops = {
-	.wait		= schedule_timeout_uninterruptible,
+	.wait		= wait_schedule_timeout_uninterruptible,
 	.name		= "stui"
 };
 
@@ -149,7 +176,7 @@ static int wake_torture_waiter(void *arg)
 		waiter_cts[me] = false;
 		__this_cpu_add(waiter_cputime, trace_clock_local() - ts);
 		preempt_enable();
-		cur_ops->wait(wait_duration);
+		cur_ops->wait();
 		preempt_disable();
 		ts = trace_clock_local();
 		waiter_iter[me]++;
@@ -167,7 +194,10 @@ static int wake_torture_waiter(void *arg)
 			} else {
 				waiter_cts[i] = true;
 				waiter_kicks[i]++;
-				pr_alert("%s%s wake_torture_waiter(): P%d failing to awaken!\n", torture_type, TORTURE_FLAG, waiter_tasks[i]->pid);
+				pr_alert("%s%s wake_torture_waiter(): P%d (%#lx) failing to awaken!\n",
+					 torture_type, TORTURE_FLAG,
+					 waiter_tasks[i]->pid,
+					 waiter_tasks[i]->state);
 				rcu_ftrace_dump(DUMP_ALL);
 				wake_up_process(waiter_tasks[i]);
 				mutex_unlock(&waiter_mutex);
@@ -312,7 +342,9 @@ wake_torture_init(void)
 {
 	int i;
 	int firsterr = 0;
-	static struct wake_torture_ops *torture_ops[] = { &sti_ops, &stui_ops };
+	static struct wake_torture_ops *torture_ops[] = {
+		&sh_ops, &sti_ops, &stui_ops
+	};
 
 	if (!torture_init_begin(torture_type, verbose, &torture_runnable))
 		return -EBUSY;
diff --git a/tools/testing/selftests/rcutorture/configs/wake/SH b/tools/testing/selftests/rcutorture/configs/wake/SH
new file mode 100644
index 000000000000..7a17c503b382
--- /dev/null
+++ b/tools/testing/selftests/rcutorture/configs/wake/SH
@@ -0,0 +1,19 @@
+CONFIG_SMP=y
+CONFIG_NR_CPUS=16
+CONFIG_PREEMPT_NONE=n
+CONFIG_PREEMPT_VOLUNTARY=n
+CONFIG_PREEMPT=y
+#CHECK#CONFIG_PREEMPT_RCU=y
+CONFIG_HZ_PERIODIC=y
+CONFIG_NO_HZ_IDLE=n
+CONFIG_NO_HZ_FULL=n
+CONFIG_RCU_TRACE=y
+CONFIG_HOTPLUG_CPU=y
+CONFIG_RCU_FANOUT=2
+CONFIG_RCU_FANOUT_LEAF=2
+CONFIG_RCU_NOCB_CPU=n
+CONFIG_DEBUG_LOCK_ALLOC=n
+CONFIG_RCU_BOOST=y
+CONFIG_RCU_KTHREAD_PRIO=2
+CONFIG_DEBUG_OBJECTS_RCU_HEAD=n
+CONFIG_RCU_EXPERT=y
diff --git a/tools/testing/selftests/rcutorture/configs/wake/SH.boot b/tools/testing/selftests/rcutorture/configs/wake/SH.boot
new file mode 100644
index 000000000000..a631c878cb27
--- /dev/null
+++ b/tools/testing/selftests/rcutorture/configs/wake/SH.boot
@@ -0,0 +1 @@
+rcupdate.rcu_expedited waketorture.torture_type=sh
-- 
2.5.2

  parent reply	other threads:[~2016-06-15 22:29 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-15 22:27 [PATCH RFC tip/core/rcu 0/8] Waketorture, not for inclusion Paul E. McKenney
2016-06-15 22:28 ` [PATCH tip/core/rcu 1/8] waketorture: Add a wakeup-torture module Paul E. McKenney
2016-06-15 22:28 ` [PATCH tip/core/rcu 2/8] waketorture: Update scripting to accommodate waketorture Paul E. McKenney
2016-06-15 22:28 ` [PATCH tip/core/rcu 3/8] waketorture: Don't kick unless grace period or request Paul E. McKenney
2016-06-15 22:28 ` [PATCH tip/core/rcu 4/8] waketorture: Add utilization measurement Paul E. McKenney
2016-06-15 22:28 ` Paul E. McKenney [this message]
2016-06-15 22:28 ` [PATCH tip/core/rcu 6/8] torture: Make waketorture always hotplug the same CPU Paul E. McKenney
2016-06-15 22:28 ` [PATCH tip/core/rcu 7/8] torture: Make waketorture kill test if no hotpluggable CPUs Paul E. McKenney
2016-06-15 22:28 ` [PATCH tip/core/rcu 8/8] torture: Affinity waiter tasks away from hotpluggable CPU Paul E. McKenney

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1466029708-11359-5-git-send-email-paulmck@linux.vnet.ibm.com \
    --to=paulmck@linux.vnet.ibm.com \
    --cc=akpm@linux-foundation.org \
    --cc=bobby.prani@gmail.com \
    --cc=dhowells@redhat.com \
    --cc=dipankar@in.ibm.com \
    --cc=dvhart@linux.intel.com \
    --cc=edumazet@google.com \
    --cc=fweisbec@gmail.com \
    --cc=jiangshanlai@gmail.com \
    --cc=josh@joshtriplett.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=mingo@kernel.org \
    --cc=oleg@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).