diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2006-06-27 05:55:01 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-06-27 20:32:47 -0400 |
commit | 0bafd214e4ba55dc1fb81a3031d0249292f1bc05 (patch) | |
tree | 754b3ad381078c57061515549642889b19aaf86d /kernel | |
parent | e74c69f46d93d29eea0ad8647863d1c6488f0f55 (diff) |
[PATCH] rtmutex: Modify rtmutex-tester to test the setscheduler propagation
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>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/rtmutex-tester.c | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/kernel/rtmutex-tester.c b/kernel/rtmutex-tester.c index fe211ba3a5b5..e82c2f848249 100644 --- a/kernel/rtmutex-tester.c +++ b/kernel/rtmutex-tester.c | |||
@@ -46,7 +46,7 @@ enum test_opcodes { | |||
46 | RTTEST_LOCKINTNOWAIT, /* 6 Lock interruptible no wait in wakeup, data = lockindex */ | 46 | RTTEST_LOCKINTNOWAIT, /* 6 Lock interruptible no wait in wakeup, data = lockindex */ |
47 | RTTEST_LOCKCONT, /* 7 Continue locking after the wakeup delay */ | 47 | RTTEST_LOCKCONT, /* 7 Continue locking after the wakeup delay */ |
48 | RTTEST_UNLOCK, /* 8 Unlock, data = lockindex */ | 48 | RTTEST_UNLOCK, /* 8 Unlock, data = lockindex */ |
49 | RTTEST_LOCKBKL, /* 9 Lock BKL */ | 49 | RTTEST_LOCKBKL, /* 9 Lock BKL */ |
50 | RTTEST_UNLOCKBKL, /* 10 Unlock BKL */ | 50 | RTTEST_UNLOCKBKL, /* 10 Unlock BKL */ |
51 | RTTEST_SIGNAL, /* 11 Signal other test thread, data = thread id */ | 51 | RTTEST_SIGNAL, /* 11 Signal other test thread, data = thread id */ |
52 | RTTEST_RESETEVENT = 98, /* 98 Reset event counter */ | 52 | RTTEST_RESETEVENT = 98, /* 98 Reset event counter */ |
@@ -55,7 +55,6 @@ enum test_opcodes { | |||
55 | 55 | ||
56 | static int handle_op(struct test_thread_data *td, int lockwakeup) | 56 | static int handle_op(struct test_thread_data *td, int lockwakeup) |
57 | { | 57 | { |
58 | struct sched_param schedpar; | ||
59 | int i, id, ret = -EINVAL; | 58 | int i, id, ret = -EINVAL; |
60 | 59 | ||
61 | switch(td->opcode) { | 60 | switch(td->opcode) { |
@@ -63,17 +62,6 @@ static int handle_op(struct test_thread_data *td, int lockwakeup) | |||
63 | case RTTEST_NOP: | 62 | case RTTEST_NOP: |
64 | return 0; | 63 | return 0; |
65 | 64 | ||
66 | case RTTEST_SCHEDOT: | ||
67 | schedpar.sched_priority = 0; | ||
68 | ret = sched_setscheduler(current, SCHED_NORMAL, &schedpar); | ||
69 | if (!ret) | ||
70 | set_user_nice(current, 0); | ||
71 | return ret; | ||
72 | |||
73 | case RTTEST_SCHEDRT: | ||
74 | schedpar.sched_priority = td->opdata; | ||
75 | return sched_setscheduler(current, SCHED_FIFO, &schedpar); | ||
76 | |||
77 | case RTTEST_LOCKCONT: | 65 | case RTTEST_LOCKCONT: |
78 | td->mutexes[td->opdata] = 1; | 66 | td->mutexes[td->opdata] = 1; |
79 | td->event = atomic_add_return(1, &rttest_event); | 67 | td->event = atomic_add_return(1, &rttest_event); |
@@ -310,9 +298,10 @@ static int test_func(void *data) | |||
310 | static ssize_t sysfs_test_command(struct sys_device *dev, const char *buf, | 298 | static ssize_t sysfs_test_command(struct sys_device *dev, const char *buf, |
311 | size_t count) | 299 | size_t count) |
312 | { | 300 | { |
301 | struct sched_param schedpar; | ||
313 | struct test_thread_data *td; | 302 | struct test_thread_data *td; |
314 | char cmdbuf[32]; | 303 | char cmdbuf[32]; |
315 | int op, dat, tid; | 304 | int op, dat, tid, ret; |
316 | 305 | ||
317 | td = container_of(dev, struct test_thread_data, sysdev); | 306 | td = container_of(dev, struct test_thread_data, sysdev); |
318 | tid = td->sysdev.id; | 307 | tid = td->sysdev.id; |
@@ -334,6 +323,21 @@ static ssize_t sysfs_test_command(struct sys_device *dev, const char *buf, | |||
334 | return -EINVAL; | 323 | return -EINVAL; |
335 | 324 | ||
336 | switch (op) { | 325 | switch (op) { |
326 | case RTTEST_SCHEDOT: | ||
327 | schedpar.sched_priority = 0; | ||
328 | ret = sched_setscheduler(threads[tid], SCHED_NORMAL, &schedpar); | ||
329 | if (ret) | ||
330 | return ret; | ||
331 | set_user_nice(current, 0); | ||
332 | break; | ||
333 | |||
334 | case RTTEST_SCHEDRT: | ||
335 | schedpar.sched_priority = dat; | ||
336 | ret = sched_setscheduler(threads[tid], SCHED_FIFO, &schedpar); | ||
337 | if (ret) | ||
338 | return ret; | ||
339 | break; | ||
340 | |||
337 | case RTTEST_SIGNAL: | 341 | case RTTEST_SIGNAL: |
338 | send_sig(SIGHUP, threads[tid], 0); | 342 | send_sig(SIGHUP, threads[tid], 0); |
339 | break; | 343 | break; |