Skip to contentSkip to conversation

Posix mutex unit test fails on git head

Xenomai-core Jan Kiszka 2 participants 9 messages Mar 2, 2010

lore
Share & tools
lore

Jan Kiszka

author
#0 lore raw

Gilles,

can you (or someone else) confirm this:

# mutex-torture-posix
simple_wait
simple mutex_lock 1: 1 (Operation not permitted)

I'm on a x86_64 target (2.6.32.8 with latest I-pipe), Xenomai is unpatched git head.

[ But I'm currently facing general stability issues with 2.6.32 again. And sigtest is failing loudly here, typically hard lockups. Ugh. ]

Jan

Signature · 2 lines
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux
author
#1 lore raw
Quoted 11 lines · Jan Kiszka

Gilles,

can you (or someone else) confirm this:

# mutex-torture-posix
simple_wait
simple mutex_lock 1: 1 (Operation not permitted)

I'm on a x86_64 target (2.6.32.8 with latest I-pipe), Xenomai is unpatched git head.

Looks like a bug in the test case: We do not wrap sched_setscheduler which it uses, and my config does not auto-shadow main. Fix will follow.

Jan

Signature · 2 lines
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux
#2 lore raw
Quoted 9 lines · Jan Kiszka
Quoted 8 lines · Jan Kiszka

Gilles,

can you (or someone else) confirm this:

# mutex-torture-posix
simple_wait
simple mutex_lock 1: 1 (Operation not permitted)
Quoted 6 lines
Quoted 3 lines

I'm on a x86_64 target (2.6.32.8 with latest I-pipe), Xenomai is unpatched git head.

Looks like a bug in the test case: We do not wrap sched_setscheduler which it uses, and my config does not auto-shadow main. Fix will follow.

The test works here, but fails in cond_signaler, mutex_lock 2, just checked out v2.5.1 to see if we already had the bug.

Quoted 3 lines

Jan

Signature · 1 line
					    Gilles.
author
#3 lore raw
Quoted 10 lines · Gilles Chanteperdrix
Quoted 9 lines · Jan Kiszka
Quoted 8 lines · Jan Kiszka

Gilles,

can you (or someone else) confirm this:

# mutex-torture-posix
simple_wait
simple mutex_lock 1: 1 (Operation not permitted)
Quoted 9 lines
Quoted 5 lines
Quoted 3 lines

I'm on a x86_64 target (2.6.32.8 with latest I-pipe), Xenomai is unpatched git head.

Looks like a bug in the test case: We do not wrap sched_setscheduler which it uses, and my config does not auto-shadow main. Fix will follow.

The test works here, but fails in cond_signaler, mutex_lock 2, just checked out v2.5.1 to see if we already had the bug.

Weird. Works for me with this fix:

src/testsuite/unit/mutex-torture.c +1 -1
index 70bda14..ebdd4f2 100644
@@ -657,7 +657,7 @@ int main(void)
 	/* Set scheduling parameters for the current process */
 #ifdef XENO_POSIX
 	sparam.sched_priority = 2;
-	sched_setscheduler(0, SCHED_FIFO, &sparam);
+	pthread_setschedparam(pthread_self(), SCHED_FIFO, &sparam);
 #else /* __NATIVE_SKIN__ */
 	rt_task_shadow(&main_tid, "main_task", 2, 0);
 #endif /* __NATIVE_SKIN__ */
# mutex-torture-posix
simple_wait
recursive_wait
errorcheck_wait
mode_switch
pi_wait
lock_stealing
lock_stealing mutex_trylock: not supported
simple_condwait
recursive_condwait
cond_signaler, mutex_lock 2 waited 0.854 us

Jan

Signature · 2 lines
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux
#4 lore raw
Quoted 37 lines · Jan Kiszka
Quoted 10 lines · Gilles Chanteperdrix
Quoted 9 lines · Jan Kiszka
Quoted 8 lines · Jan Kiszka

Gilles,

can you (or someone else) confirm this:

# mutex-torture-posix
simple_wait
simple mutex_lock 1: 1 (Operation not permitted)
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

I'm on a x86_64 target (2.6.32.8 with latest I-pipe), Xenomai is unpatched git head.

Looks like a bug in the test case: We do not wrap sched_setscheduler which it uses, and my config does not auto-shadow main. Fix will follow.

The test works here, but fails in cond_signaler, mutex_lock 2, just checked out v2.5.1 to see if we already had the bug.

Weird. Works for me with this fix:

src/testsuite/unit/mutex-torture.c +1 -1
index 70bda14..ebdd4f2 100644
@@ -657,7 +657,7 @@ int main(void)
 	/* Set scheduling parameters for the current process */
 #ifdef XENO_POSIX
 	sparam.sched_priority = 2;
-	sched_setscheduler(0, SCHED_FIFO, &sparam);
+	pthread_setschedparam(pthread_self(), SCHED_FIFO, &sparam);
 #else /* __NATIVE_SKIN__ */
 	rt_task_shadow(&main_tid, "main_task", 2, 0);
 #endif /* __NATIVE_SKIN__ */
Quoted 11 lines
# mutex-torture-posix
simple_wait
recursive_wait
errorcheck_wait
mode_switch
pi_wait
lock_stealing
lock_stealing mutex_trylock: not supported
simple_condwait
recursive_condwait
cond_signaler, mutex_lock 2 waited 0.854 us

No, that is a bug. We should have waited 10ms, and we wait less than a us.

Signature · 1 line
					    Gilles.
author
#5 lore raw
Quoted 37 lines · Gilles Chanteperdrix
Quoted 36 lines · Jan Kiszka
Quoted 10 lines · Gilles Chanteperdrix
Quoted 9 lines · Jan Kiszka
Quoted 8 lines · Jan Kiszka

Gilles,

can you (or someone else) confirm this:

# mutex-torture-posix
simple_wait
simple mutex_lock 1: 1 (Operation not permitted)
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

I'm on a x86_64 target (2.6.32.8 with latest I-pipe), Xenomai is unpatched git head.

Looks like a bug in the test case: We do not wrap sched_setscheduler which it uses, and my config does not auto-shadow main. Fix will follow.

The test works here, but fails in cond_signaler, mutex_lock 2, just checked out v2.5.1 to see if we already had the bug.

Weird. Works for me with this fix:

src/testsuite/unit/mutex-torture.c +1 -1
index 70bda14..ebdd4f2 100644
@@ -657,7 +657,7 @@ int main(void)
 	/* Set scheduling parameters for the current process */
 #ifdef XENO_POSIX
 	sparam.sched_priority = 2;
-	sched_setscheduler(0, SCHED_FIFO, &sparam);
+	pthread_setschedparam(pthread_self(), SCHED_FIFO, &sparam);
 #else /* __NATIVE_SKIN__ */
 	rt_task_shadow(&main_tid, "main_task", 2, 0);
 #endif /* __NATIVE_SKIN__ */
Quoted 14 lines
Quoted 11 lines
# mutex-torture-posix
simple_wait
recursive_wait
errorcheck_wait
mode_switch
pi_wait
lock_stealing
lock_stealing mutex_trylock: not supported
simple_condwait
recursive_condwait
cond_signaler, mutex_lock 2 waited 0.854 us

No, that is a bug. We should have waited 10ms, and we wait less than a us.

Ah - well, we do not properly return ETIMEDOUT anymore, do we?

Jan

Signature · 2 lines
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux
#6 lore raw
Quoted 52 lines · Jan Kiszka
Quoted 37 lines · Gilles Chanteperdrix
Quoted 36 lines · Jan Kiszka
Quoted 10 lines · Gilles Chanteperdrix
Quoted 9 lines · Jan Kiszka
Quoted 8 lines · Jan Kiszka

Gilles,

can you (or someone else) confirm this:

# mutex-torture-posix
simple_wait
simple mutex_lock 1: 1 (Operation not permitted)
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

I'm on a x86_64 target (2.6.32.8 with latest I-pipe), Xenomai is unpatched git head.

Looks like a bug in the test case: We do not wrap sched_setscheduler which it uses, and my config does not auto-shadow main. Fix will follow.

The test works here, but fails in cond_signaler, mutex_lock 2, just checked out v2.5.1 to see if we already had the bug.

Weird. Works for me with this fix:

src/testsuite/unit/mutex-torture.c +1 -1
index 70bda14..ebdd4f2 100644
@@ -657,7 +657,7 @@ int main(void)
 	/* Set scheduling parameters for the current process */
 #ifdef XENO_POSIX
 	sparam.sched_priority = 2;
-	sched_setscheduler(0, SCHED_FIFO, &sparam);
+	pthread_setschedparam(pthread_self(), SCHED_FIFO, &sparam);
 #else /* __NATIVE_SKIN__ */
 	rt_task_shadow(&main_tid, "main_task", 2, 0);
 #endif /* __NATIVE_SKIN__ */
Quoted 13 lines
Quoted 11 lines
# mutex-torture-posix
simple_wait
recursive_wait
errorcheck_wait
mode_switch
pi_wait
lock_stealing
lock_stealing mutex_trylock: not supported
simple_condwait
recursive_condwait
cond_signaler, mutex_lock 2 waited 0.854 us

No, that is a bug. We should have waited 10ms, and we wait less than a us.

Quoted 1 line

Ah - well, we do not properly return ETIMEDOUT anymore, do we?

No, it is a recursive mutex issue. We are able to acquire a mutex, whereas we should not, someone else has it. What I do not understand, is that I am sure I had tested this before the 2.5.0 release, and that even with the 2.5.0 the test fails.

Quoted 3 lines

Jan

Signature · 1 line
					    Gilles.
#7 lore raw
In reply to Gilles Chanteperdrix
Quoted 37 lines · Gilles Chanteperdrix
Quoted 36 lines · Jan Kiszka
Quoted 10 lines · Gilles Chanteperdrix
Quoted 9 lines · Jan Kiszka
Quoted 8 lines · Jan Kiszka

Gilles,

can you (or someone else) confirm this:

# mutex-torture-posix
simple_wait
simple mutex_lock 1: 1 (Operation not permitted)
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

I'm on a x86_64 target (2.6.32.8 with latest I-pipe), Xenomai is unpatched git head.

Looks like a bug in the test case: We do not wrap sched_setscheduler which it uses, and my config does not auto-shadow main. Fix will follow.

The test works here, but fails in cond_signaler, mutex_lock 2, just checked out v2.5.1 to see if we already had the bug.

Weird. Works for me with this fix:

src/testsuite/unit/mutex-torture.c +1 -1
index 70bda14..ebdd4f2 100644
@@ -657,7 +657,7 @@ int main(void)
 	/* Set scheduling parameters for the current process */
 #ifdef XENO_POSIX
 	sparam.sched_priority = 2;
-	sched_setscheduler(0, SCHED_FIFO, &sparam);
+	pthread_setschedparam(pthread_self(), SCHED_FIFO, &sparam);
 #else /* __NATIVE_SKIN__ */
 	rt_task_shadow(&main_tid, "main_task", 2, 0);
 #endif /* __NATIVE_SKIN__ */
Quoted 14 lines
Quoted 11 lines
# mutex-torture-posix
simple_wait
recursive_wait
errorcheck_wait
mode_switch
pi_wait
lock_stealing
lock_stealing mutex_trylock: not supported
simple_condwait
recursive_condwait
cond_signaler, mutex_lock 2 waited 0.854 us

No, that is a bug. We should have waited 10ms, and we wait less than a us.

Ok. Should be fixed by commit af93ec87f975b387243127090b578d57922b38dc. The bug was on the same goddamn pass as the one we are trying to fix to return proper return values to user-space.

Signature · 1 line
					    Gilles.
author
#8 lore raw
Quoted 52 lines · Gilles Chanteperdrix
Quoted 37 lines · Gilles Chanteperdrix
Quoted 36 lines · Jan Kiszka
Quoted 10 lines · Gilles Chanteperdrix
Quoted 9 lines · Jan Kiszka
Quoted 8 lines · Jan Kiszka

Gilles,

can you (or someone else) confirm this:

# mutex-torture-posix
simple_wait
simple mutex_lock 1: 1 (Operation not permitted)
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

I'm on a x86_64 target (2.6.32.8 with latest I-pipe), Xenomai is unpatched git head.

Looks like a bug in the test case: We do not wrap sched_setscheduler which it uses, and my config does not auto-shadow main. Fix will follow.

The test works here, but fails in cond_signaler, mutex_lock 2, just checked out v2.5.1 to see if we already had the bug.

Weird. Works for me with this fix:

src/testsuite/unit/mutex-torture.c +1 -1
index 70bda14..ebdd4f2 100644
@@ -657,7 +657,7 @@ int main(void)
 	/* Set scheduling parameters for the current process */
 #ifdef XENO_POSIX
 	sparam.sched_priority = 2;
-	sched_setscheduler(0, SCHED_FIFO, &sparam);
+	pthread_setschedparam(pthread_self(), SCHED_FIFO, &sparam);
 #else /* __NATIVE_SKIN__ */
 	rt_task_shadow(&main_tid, "main_task", 2, 0);
 #endif /* __NATIVE_SKIN__ */
Quoted 13 lines
Quoted 11 lines
# mutex-torture-posix
simple_wait
recursive_wait
errorcheck_wait
mode_switch
pi_wait
lock_stealing
lock_stealing mutex_trylock: not supported
simple_condwait
recursive_condwait
cond_signaler, mutex_lock 2 waited 0.854 us

No, that is a bug. We should have waited 10ms, and we wait less than a us.

Quoted 4 lines

Ok. Should be fixed by commit af93ec87f975b387243127090b578d57922b38dc. The bug was on the same goddamn pass as the one we are trying to fix to return proper return values to user-space.

Yes, looks good!

I've hacked up some additional (basic) test cases for times mutex and cond waiting, and now I'm looking into the posix side of that infamous workaround.

Jan