mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: LKML <linux-kernel@vger.kernel.org>
Cc: Andrew Morton <akpm@osdl.org>, Ingo Molnar <mingo@elte.hu>
Subject: [patch 3/3] rtmutex: Modify rtmutex-tester to test the setscheduler propagation
Date: Thu, 22 Jun 2006 09:08:40 -0000	[thread overview]
Message-ID: <20060622082812.721695000@cruncher.tec.linutronix.de> (raw)
In-Reply-To: <20060622082758.669511000@cruncher.tec.linutronix.de>

[-- Attachment #1: rt-mutex-fix-tester-for-setsched-tests.patch --]
[-- Type: text/plain, Size: 13789 bytes --]


Make test suite setscheduler calls asynchronously. Remove the waits in the test
cases and add a new testcase to verify the correctness of the setscheduler
priority propagation.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>

 kernel/rtmutex-tester.c                               |   32 +--
 scripts/rt-tester/check-all.sh                        |    1 
 scripts/rt-tester/t2-l1-2rt-sameprio.tst              |    2 
 scripts/rt-tester/t2-l1-pi.tst                        |    2 
 scripts/rt-tester/t2-l1-signal.tst                    |    2 
 scripts/rt-tester/t2-l2-2rt-deadlock.tst              |    2 
 scripts/rt-tester/t3-l1-pi-1rt.tst                    |    3 
 scripts/rt-tester/t3-l1-pi-2rt.tst                    |    3 
 scripts/rt-tester/t3-l1-pi-3rt.tst                    |    3 
 scripts/rt-tester/t3-l1-pi-signal.tst                 |    3 
 scripts/rt-tester/t3-l1-pi-steal.tst                  |    3 
 scripts/rt-tester/t3-l2-pi.tst                        |    3 
 scripts/rt-tester/t4-l2-pi-deboost.tst                |    4 
 scripts/rt-tester/t5-l4-pi-boost-deboost-setsched.tst |  183 ++++++++++++++++++
 scripts/rt-tester/t5-l4-pi-boost-deboost.tst          |    5 
 15 files changed, 202 insertions(+), 49 deletions(-)

Index: linux-2.6.17-mm/scripts/rt-tester/check-all.sh
===================================================================
--- linux-2.6.17-mm.orig/scripts/rt-tester/check-all.sh	2006-06-22 10:26:10.000000000 +0200
+++ linux-2.6.17-mm/scripts/rt-tester/check-all.sh	2006-06-22 10:26:11.000000000 +0200
@@ -18,4 +18,5 @@
 testit t3-l2-pi.tst
 testit t4-l2-pi-deboost.tst
 testit t5-l4-pi-boost-deboost.tst
+testit t5-l4-pi-boost-deboost-setsched.tst
 
Index: linux-2.6.17-mm/kernel/rtmutex-tester.c
===================================================================
--- linux-2.6.17-mm.orig/kernel/rtmutex-tester.c	2006-06-22 10:26:10.000000000 +0200
+++ linux-2.6.17-mm/kernel/rtmutex-tester.c	2006-06-22 10:26:11.000000000 +0200
@@ -46,7 +46,7 @@
 	RTTEST_LOCKINTNOWAIT,	/* 6 Lock interruptible no wait in wakeup, data = lockindex */
 	RTTEST_LOCKCONT,	/* 7 Continue locking after the wakeup delay */
 	RTTEST_UNLOCK,		/* 8 Unlock, data = lockindex */
-	RTTEST_LOCKBKL, 	/* 9 Lock BKL */
+	RTTEST_LOCKBKL,		/* 9 Lock BKL */
 	RTTEST_UNLOCKBKL,	/* 10 Unlock BKL */
 	RTTEST_SIGNAL,		/* 11 Signal other test thread, data = thread id */
 	RTTEST_RESETEVENT = 98,	/* 98 Reset event counter */
@@ -55,7 +55,6 @@
 
 static int handle_op(struct test_thread_data *td, int lockwakeup)
 {
-	struct sched_param schedpar;
 	int i, id, ret = -EINVAL;
 
 	switch(td->opcode) {
@@ -63,17 +62,6 @@
 	case RTTEST_NOP:
 		return 0;
 
-	case RTTEST_SCHEDOT:
-		schedpar.sched_priority = 0;
-		ret = sched_setscheduler(current, SCHED_NORMAL, &schedpar);
-		if (!ret)
-			set_user_nice(current, 0);
-		return ret;
-
-	case RTTEST_SCHEDRT:
-		schedpar.sched_priority = td->opdata;
-		return sched_setscheduler(current, SCHED_FIFO, &schedpar);
-
 	case RTTEST_LOCKCONT:
 		td->mutexes[td->opdata] = 1;
 		td->event = atomic_add_return(1, &rttest_event);
@@ -310,9 +298,10 @@
 static ssize_t sysfs_test_command(struct sys_device *dev, const char *buf,
 				  size_t count)
 {
+	struct sched_param schedpar;
 	struct test_thread_data *td;
 	char cmdbuf[32];
-	int op, dat, tid;
+	int op, dat, tid, ret;
 
 	td = container_of(dev, struct test_thread_data, sysdev);
 	tid = td->sysdev.id;
@@ -334,6 +323,21 @@
 		return -EINVAL;
 
 	switch (op) {
+	case RTTEST_SCHEDOT:
+		schedpar.sched_priority = 0;
+		ret = sched_setscheduler(threads[tid], SCHED_NORMAL, &schedpar);
+		if (ret)
+			return ret;
+		set_user_nice(current, 0);
+		break;
+
+	case RTTEST_SCHEDRT:
+		schedpar.sched_priority = dat;
+		ret = sched_setscheduler(threads[tid], SCHED_FIFO, &schedpar);
+		if (ret)
+			return ret;
+		break;
+
 	case RTTEST_SIGNAL:
 		send_sig(SIGHUP, threads[tid], 0);
 		break;
Index: linux-2.6.17-mm/scripts/rt-tester/t2-l1-2rt-sameprio.tst
===================================================================
--- linux-2.6.17-mm.orig/scripts/rt-tester/t2-l1-2rt-sameprio.tst	2006-06-22 10:26:10.000000000 +0200
+++ linux-2.6.17-mm/scripts/rt-tester/t2-l1-2rt-sameprio.tst	2006-06-22 10:26:11.000000000 +0200
@@ -57,9 +57,7 @@
 
 # Set schedulers
 C: schedfifo:		0: 	80
-W: opcodeeq:		0: 	0
 C: schedfifo:		1: 	80
-W: opcodeeq:		1: 	0
 
 # T0 lock L0
 C: locknowait:		0: 	0
Index: linux-2.6.17-mm/scripts/rt-tester/t2-l1-pi.tst
===================================================================
--- linux-2.6.17-mm.orig/scripts/rt-tester/t2-l1-pi.tst	2006-06-22 10:26:10.000000000 +0200
+++ linux-2.6.17-mm/scripts/rt-tester/t2-l1-pi.tst	2006-06-22 10:26:11.000000000 +0200
@@ -57,9 +57,7 @@
 
 # Set schedulers
 C: schedother:		0: 	0
-W: opcodeeq:		0: 	0
 C: schedfifo:		1: 	80
-W: opcodeeq:		1: 	0
 
 # T0 lock L0
 C: locknowait:		0: 	0
Index: linux-2.6.17-mm/scripts/rt-tester/t2-l1-signal.tst
===================================================================
--- linux-2.6.17-mm.orig/scripts/rt-tester/t2-l1-signal.tst	2006-06-22 10:26:10.000000000 +0200
+++ linux-2.6.17-mm/scripts/rt-tester/t2-l1-signal.tst	2006-06-22 10:26:11.000000000 +0200
@@ -57,9 +57,7 @@
 
 # Set schedulers
 C: schedother:		0: 	0
-W: opcodeeq:		0: 	0
 C: schedother:		1: 	0
-W: opcodeeq:		1: 	0
 
 # T0 lock L0
 C: locknowait:		0: 	0
Index: linux-2.6.17-mm/scripts/rt-tester/t2-l2-2rt-deadlock.tst
===================================================================
--- linux-2.6.17-mm.orig/scripts/rt-tester/t2-l2-2rt-deadlock.tst	2006-06-22 10:26:10.000000000 +0200
+++ linux-2.6.17-mm/scripts/rt-tester/t2-l2-2rt-deadlock.tst	2006-06-22 10:26:11.000000000 +0200
@@ -57,9 +57,7 @@
 
 # Set schedulers
 C: schedfifo:		0: 	80
-W: opcodeeq:		0: 	0
 C: schedfifo:		1: 	80
-W: opcodeeq:		1: 	0
 
 # T0 lock L0
 C: locknowait:		0: 	0
Index: linux-2.6.17-mm/scripts/rt-tester/t3-l1-pi-1rt.tst
===================================================================
--- linux-2.6.17-mm.orig/scripts/rt-tester/t3-l1-pi-1rt.tst	2006-06-22 10:26:10.000000000 +0200
+++ linux-2.6.17-mm/scripts/rt-tester/t3-l1-pi-1rt.tst	2006-06-22 10:26:11.000000000 +0200
@@ -57,11 +57,8 @@
 
 # Set schedulers
 C: schedother:		0: 	0
-W: opcodeeq:		0: 	0
 C: schedother:		1: 	0
-W: opcodeeq:		1: 	0
 C: schedfifo:		2: 	82
-W: opcodeeq:		2: 	0
 
 # T0 lock L0
 C: locknowait:		0: 	0
Index: linux-2.6.17-mm/scripts/rt-tester/t3-l1-pi-2rt.tst
===================================================================
--- linux-2.6.17-mm.orig/scripts/rt-tester/t3-l1-pi-2rt.tst	2006-06-22 10:26:10.000000000 +0200
+++ linux-2.6.17-mm/scripts/rt-tester/t3-l1-pi-2rt.tst	2006-06-22 10:26:11.000000000 +0200
@@ -57,11 +57,8 @@
 
 # Set schedulers
 C: schedother:		0: 	0
-W: opcodeeq:		0: 	0
 C: schedfifo:		1: 	81
-W: opcodeeq:		1: 	0
 C: schedfifo:		2: 	82
-W: opcodeeq:		2: 	0
 
 # T0 lock L0
 C: locknowait:		0: 	0
Index: linux-2.6.17-mm/scripts/rt-tester/t3-l1-pi-3rt.tst
===================================================================
--- linux-2.6.17-mm.orig/scripts/rt-tester/t3-l1-pi-3rt.tst	2006-06-22 10:26:10.000000000 +0200
+++ linux-2.6.17-mm/scripts/rt-tester/t3-l1-pi-3rt.tst	2006-06-22 10:26:11.000000000 +0200
@@ -57,11 +57,8 @@
 
 # Set schedulers
 C: schedfifo:		0: 	80
-W: opcodeeq:		0: 	0
 C: schedfifo:		1: 	81
-W: opcodeeq:		1: 	0
 C: schedfifo:		2: 	82
-W: opcodeeq:		2: 	0
 
 # T0 lock L0
 C: locknowait:		0: 	0
Index: linux-2.6.17-mm/scripts/rt-tester/t3-l1-pi-signal.tst
===================================================================
--- linux-2.6.17-mm.orig/scripts/rt-tester/t3-l1-pi-signal.tst	2006-06-22 10:26:10.000000000 +0200
+++ linux-2.6.17-mm/scripts/rt-tester/t3-l1-pi-signal.tst	2006-06-22 10:26:11.000000000 +0200
@@ -55,11 +55,8 @@
 
 # Set priorities
 C: schedother:		0: 	0
-W: opcodeeq:		0: 	0
 C: schedfifo:		1: 	80
-W: opcodeeq:		1: 	0
 C: schedfifo:		2: 	81
-W: opcodeeq:		2: 	0
 
 # T0 lock L0
 C: lock:		0:	0
Index: linux-2.6.17-mm/scripts/rt-tester/t3-l1-pi-steal.tst
===================================================================
--- linux-2.6.17-mm.orig/scripts/rt-tester/t3-l1-pi-steal.tst	2006-06-22 10:26:10.000000000 +0200
+++ linux-2.6.17-mm/scripts/rt-tester/t3-l1-pi-steal.tst	2006-06-22 10:26:11.000000000 +0200
@@ -57,11 +57,8 @@
 
 # Set schedulers
 C: schedother:		0: 	0
-W: opcodeeq:		0: 	0
 C: schedfifo:		1: 	80
-W: opcodeeq:		1: 	0
 C: schedfifo:		2: 	81
-W: opcodeeq:		2: 	0
 
 # T0 lock L0
 C: lock:		0: 	0
Index: linux-2.6.17-mm/scripts/rt-tester/t3-l2-pi.tst
===================================================================
--- linux-2.6.17-mm.orig/scripts/rt-tester/t3-l2-pi.tst	2006-06-22 10:26:10.000000000 +0200
+++ linux-2.6.17-mm/scripts/rt-tester/t3-l2-pi.tst	2006-06-22 10:26:11.000000000 +0200
@@ -57,11 +57,8 @@
 
 # Set schedulers
 C: schedother:		0: 	0
-W: opcodeeq:		0: 	0
 C: schedother:		1: 	0
-W: opcodeeq:		1: 	0
 C: schedfifo:		2: 	82
-W: opcodeeq:		2: 	0
 
 # T0 lock L0
 C: locknowait:		0: 	0
Index: linux-2.6.17-mm/scripts/rt-tester/t4-l2-pi-deboost.tst
===================================================================
--- linux-2.6.17-mm.orig/scripts/rt-tester/t4-l2-pi-deboost.tst	2006-06-22 10:26:10.000000000 +0200
+++ linux-2.6.17-mm/scripts/rt-tester/t4-l2-pi-deboost.tst	2006-06-22 10:26:11.000000000 +0200
@@ -57,13 +57,9 @@
 
 # Set schedulers
 C: schedother:		0: 	0
-W: opcodeeq:		0: 	0
 C: schedother:		1: 	0
-W: opcodeeq:		1: 	0
 C: schedfifo:		2: 	82
-W: opcodeeq:		2: 	0
 C: schedfifo:		3: 	83
-W: opcodeeq:		3: 	0
 
 # T0 lock L0
 C: locknowait:		0: 	0
Index: linux-2.6.17-mm/scripts/rt-tester/t5-l4-pi-boost-deboost-setsched.tst
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ linux-2.6.17-mm/scripts/rt-tester/t5-l4-pi-boost-deboost-setsched.tst	2006-06-22 10:26:11.000000000 +0200
@@ -0,0 +1,183 @@
+#
+# rt-mutex test
+#
+# Op: C(ommand)/T(est)/W(ait)
+# |  opcode
+# |  |     threadid: 0-7
+# |  |     |  opcode argument
+# |  |     |  |
+# C: lock: 0: 0
+#
+# Commands
+#
+# opcode	opcode argument
+# schedother	nice value
+# schedfifo	priority
+# lock		lock nr (0-7)
+# locknowait	lock nr (0-7)
+# lockint	lock nr (0-7)
+# lockintnowait	lock nr (0-7)
+# lockcont	lock nr (0-7)
+# unlock	lock nr (0-7)
+# lockbkl	lock nr (0-7)
+# unlockbkl	lock nr (0-7)
+# signal	thread to signal (0-7)
+# reset		0
+# resetevent	0
+#
+# Tests / Wait
+#
+# opcode	opcode argument
+#
+# prioeq	priority
+# priolt	priority
+# priogt	priority
+# nprioeq	normal priority
+# npriolt	normal priority
+# npriogt	normal priority
+# locked	lock nr (0-7)
+# blocked	lock nr (0-7)
+# blockedwake	lock nr (0-7)
+# unlocked	lock nr (0-7)
+# lockedbkl	dont care
+# blockedbkl	dont care
+# unlockedbkl	dont care
+# opcodeeq	command opcode or number
+# opcodelt	number
+# opcodegt	number
+# eventeq	number
+# eventgt	number
+# eventlt	number
+
+#
+# 5 threads 4 lock PI - modify priority of blocked threads
+#
+C: resetevent:		0: 	0
+W: opcodeeq:		0: 	0
+
+# Set schedulers
+C: schedother:		0: 	0
+C: schedfifo:		1: 	81
+C: schedfifo:		2: 	82
+C: schedfifo:		3: 	83
+C: schedfifo:		4: 	84
+
+# T0 lock L0
+C: locknowait:		0: 	0
+W: locked:		0: 	0
+
+# T1 lock L1
+C: locknowait:		1: 	1
+W: locked:		1: 	1
+
+# T1 lock L0
+C: lockintnowait:	1: 	0
+W: blocked:		1: 	0
+T: prioeq:		0: 	81
+
+# T2 lock L2
+C: locknowait:		2: 	2
+W: locked:		2: 	2
+
+# T2 lock L1
+C: lockintnowait:	2: 	1
+W: blocked:		2: 	1
+T: prioeq:		0: 	82
+T: prioeq:		1:	82
+
+# T3 lock L3
+C: locknowait:		3: 	3
+W: locked:		3: 	3
+
+# T3 lock L2
+C: lockintnowait:	3: 	2
+W: blocked:		3: 	2
+T: prioeq:		0: 	83
+T: prioeq:		1:	83
+T: prioeq:		2:	83
+
+# T4 lock L3
+C: lockintnowait:	4:	3
+W: blocked:		4: 	3
+T: prioeq:		0: 	84
+T: prioeq:		1:	84
+T: prioeq:		2:	84
+T: prioeq:		3:	84
+
+# Reduce prio of T4
+C: schedfifo:		4: 	80
+T: prioeq:		0: 	83
+T: prioeq:		1:	83
+T: prioeq:		2:	83
+T: prioeq:		3:	83
+T: prioeq:		4:	80
+
+# Increase prio of T4
+C: schedfifo:		4: 	84
+T: prioeq:		0: 	84
+T: prioeq:		1:	84
+T: prioeq:		2:	84
+T: prioeq:		3:	84
+T: prioeq:		4:	84
+
+# Reduce prio of T3
+C: schedfifo:		3: 	80
+T: prioeq:		0: 	84
+T: prioeq:		1:	84
+T: prioeq:		2:	84
+T: prioeq:		3:	84
+T: prioeq:		4:	84
+
+# Increase prio of T3
+C: schedfifo:		3: 	85
+T: prioeq:		0: 	85
+T: prioeq:		1:	85
+T: prioeq:		2:	85
+T: prioeq:		3:	85
+T: prioeq:		4:	84
+
+# Reduce prio of T3
+C: schedfifo:		3: 	83
+T: prioeq:		0: 	84
+T: prioeq:		1:	84
+T: prioeq:		2:	84
+T: prioeq:		3:	84
+T: prioeq:		4:	84
+
+# Signal T4
+C: signal:		4: 	0
+W: unlocked:		4: 	3
+T: prioeq:		0: 	83
+T: prioeq:		1:	83
+T: prioeq:		2:	83
+T: prioeq:		3:	83
+
+# Signal T3
+C: signal:		3: 	0
+W: unlocked:		3: 	2
+T: prioeq:		0: 	82
+T: prioeq:		1:	82
+T: prioeq:		2:	82
+
+# Signal T2
+C: signal:		2: 	0
+W: unlocked:		2: 	1
+T: prioeq:		0: 	81
+T: prioeq:		1:	81
+
+# Signal T1
+C: signal:		1: 	0
+W: unlocked:		1: 	0
+T: priolt:		0: 	1
+
+# Unlock and exit
+C: unlock:		3:	3
+C: unlock:		2:	2
+C: unlock:		1:	1
+C: unlock:		0:	0
+
+W: unlocked:		3:	3
+W: unlocked:		2:	2
+W: unlocked:		1:	1
+W: unlocked:		0:	0
+
Index: linux-2.6.17-mm/scripts/rt-tester/t5-l4-pi-boost-deboost.tst
===================================================================
--- linux-2.6.17-mm.orig/scripts/rt-tester/t5-l4-pi-boost-deboost.tst	2006-06-22 10:26:10.000000000 +0200
+++ linux-2.6.17-mm/scripts/rt-tester/t5-l4-pi-boost-deboost.tst	2006-06-22 10:26:11.000000000 +0200
@@ -57,15 +57,10 @@
 
 # Set schedulers
 C: schedother:		0: 	0
-W: opcodeeq:		0: 	0
 C: schedfifo:		1: 	81
-W: opcodeeq:		1: 	0
 C: schedfifo:		2: 	82
-W: opcodeeq:		2: 	0
 C: schedfifo:		3: 	83
-W: opcodeeq:		3: 	0
 C: schedfifo:		4: 	84
-W: opcodeeq:		4: 	0
 
 # T0 lock L0
 C: locknowait:		0: 	0

--


      parent reply	other threads:[~2006-06-22  9:10 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-06-22  9:08 [patch 0/3] rtmutex: Propagate priority setting into lock chains Thomas Gleixner
2006-06-22  9:08 ` [patch 1/3] Drop tasklist lock in do_sched_setscheduler Thomas Gleixner
2006-06-23  1:48   ` Andrew Morton
2006-06-23  6:01     ` Thomas Gleixner
2006-06-24  8:07   ` Andrew Morton
2006-06-24  8:25     ` Thomas Gleixner
2006-06-22  9:08 ` [patch 2/3] rtmutex: Propagate priority settings into PI lock chains Thomas Gleixner
2006-06-22 14:20   ` Steven Rostedt
2006-06-22 18:02     ` Esben Nielsen
2006-06-23  6:27       ` Steven Rostedt
2006-06-23  2:08     ` Andrew Morton
2006-06-23  9:28       ` [PATCH -mm] bug if setscheduler is called from interrupt context Steven Rostedt
2006-06-23  2:06   ` [patch 2/3] rtmutex: Propagate priority settings into PI lock chains Andrew Morton
2006-06-23 16:26     ` Thomas Gleixner
2006-06-22  9:08 ` Thomas Gleixner [this message]

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=20060622082812.721695000@cruncher.tec.linutronix.de \
    --to=tglx@linutronix.de \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    /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

all inboxes | Powered by JetHome®