[PATCH] rtmutex: Modify rtmutex-tester to test the setscheduler propagation
authorThomas Gleixner <tglx@linutronix.de>
Tue, 27 Jun 2006 09:55:01 +0000 (02:55 -0700)
committerLinus Torvalds <torvalds@g5.osdl.org>
Wed, 28 Jun 2006 00:32:47 +0000 (17:32 -0700)
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>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
15 files changed:
kernel/rtmutex-tester.c
scripts/rt-tester/check-all.sh
scripts/rt-tester/t2-l1-2rt-sameprio.tst
scripts/rt-tester/t2-l1-pi.tst
scripts/rt-tester/t2-l1-signal.tst
scripts/rt-tester/t2-l2-2rt-deadlock.tst
scripts/rt-tester/t3-l1-pi-1rt.tst
scripts/rt-tester/t3-l1-pi-2rt.tst
scripts/rt-tester/t3-l1-pi-3rt.tst
scripts/rt-tester/t3-l1-pi-signal.tst
scripts/rt-tester/t3-l1-pi-steal.tst
scripts/rt-tester/t3-l2-pi.tst
scripts/rt-tester/t4-l2-pi-deboost.tst
scripts/rt-tester/t5-l4-pi-boost-deboost-setsched.tst [new file with mode: 0644]
scripts/rt-tester/t5-l4-pi-boost-deboost.tst

index fe211ba3a5b5df0836712fec7996b716e5b555a7..e82c2f848249462f64faecda994cae841af02b27 100644 (file)
@@ -46,7 +46,7 @@ enum test_opcodes {
        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 @@ enum test_opcodes {
 
 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 @@ static int handle_op(struct test_thread_data *td, int lockwakeup)
        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 int test_func(void *data)
 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 @@ static ssize_t sysfs_test_command(struct sys_device *dev, const char *buf,
                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 ac45c3e65a354350c1283d59b49cf13417ac6dfe..43098afe74311669fd7cea7ca342415ba47d5bae 100644 (file)
@@ -18,4 +18,5 @@ testit t3-l1-pi-steal.tst
 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 a2b6f2aae755acc35c66d8af8ed31ebef3e8c3f4..8821f27cc8be6aea6db61b07a7255b651da16bf8 100644 (file)
@@ -57,9 +57,7 @@ W: opcodeeq:          0:      0
 
 # 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 aa4c8940acd6b905dc1ac3c74eea12962d47716c..cde1f189a02bf29075cdf102fd9244af42bd26c7 100644 (file)
@@ -57,9 +57,7 @@ W: opcodeeq:          0:      0
 
 # 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 c47ba06af2097a62566f9c089808fec238be19ef..3ab0bfc49950ee076032bf7b1bd828a86690e76d 100644 (file)
@@ -57,9 +57,7 @@ W: opcodeeq:          0:      0
 
 # 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 0cee476b206e2666964e21bac5c09b81532c1737..f4b5d5d6215fd9808dc8eefb0bccf36b7ece2d80 100644 (file)
@@ -57,9 +57,7 @@ W: opcodeeq:          0:      0
 
 # 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 a5eaf7ed5d5480c8ae501cd80835eaef29c78d38..63440ca2cce9e83efe8be4c4771e6483c923019e 100644 (file)
@@ -57,11 +57,8 @@ W: opcodeeq:         0:      0
 
 # 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 c622391a8afe8b7bddb15a354c5c613e76dd2e68..e5816fe67df324caf96908b45dbf7372b81aa826 100644 (file)
@@ -57,11 +57,8 @@ W: opcodeeq:         0:      0
 
 # 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 b5057fb13e09589f7e202a362e9e4128d590f5f4..718b82b5d3bbe09bccc6329699e5f30db8449e0c 100644 (file)
@@ -57,11 +57,8 @@ W: opcodeeq:         0:      0
 
 # 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 3e427daa33ffc00c92c2192ed61447e7750bde2f..c6e2135634985f4af3c75cad81d2306f82803157 100644 (file)
@@ -55,11 +55,8 @@ W: opcodeeq:         0:      0
 
 # 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 72c24a9e4be4ab130bd38aa5f2670318d409c6b5..f53749d59d79d2beca742a0674ccb10bedb9cc50 100644 (file)
@@ -57,11 +57,8 @@ W: opcodeeq:         0:      0
 
 # 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 2ba0dced48fa95b459c0bf0ccbe9b62c48b2238f..cdc3e4fd7bac6375062ab1cda98c97d6bf176f65 100644 (file)
@@ -57,11 +57,8 @@ W: opcodeeq:         0:      0
 
 # 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 01f1a80fa02a4224386e5ff5a335010f8564f767..baa14137f47354e7d60ebd798b3887156a118340 100644 (file)
@@ -57,13 +57,9 @@ W: opcodeeq:         0:      0
 
 # 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
diff --git a/scripts/rt-tester/t5-l4-pi-boost-deboost-setsched.tst b/scripts/rt-tester/t5-l4-pi-boost-deboost-setsched.tst
new file mode 100644 (file)
index 0000000..e6ec0c8
--- /dev/null
@@ -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 efa0788c1189f0966e30066665327bc686808436..ca64f8bbf4bc7a4f25f6db6560f37bff527ca30c 100644 (file)
@@ -57,15 +57,10 @@ W: opcodeeq:                0:      0
 
 # 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