Skip to contentSkip to conversation

Fixes and workarounds for the cond issues

GIT PULL Jan Kiszka 4 participants 15 messages Mar 2, 2010 – Mar 8, 2010 1 message not in the archive

lore
Share & tools
lore

Jan Kiszka

author
#0 lore raw

The following changes since commit af93ec87f975b387243127090b578d57922b38dc:
Gilles Chanteperdrix (1):
posix: fix recursive condvar implementation

are available in the git repository at:

git://git.xenomai.org/xenomai-jki.git for-upstream

These patches pass basic testings, specifically our extended testsuite, but I'm still unhappy with the workaround. Specifically the fact that we lose -EINTR as valid return code for the Native side is fairly annoying.

For that reason, I will continue to work out fixed prologue/epilogue syscalls for both skins that up-to-date user space will be able to benefit from (native kernel space part is already done). The majority of users will continue to update kernel and user space synchronously anyway, for the rest we will provide these workarounds here.

Jan Kiszka (8):
testsuite: Fix posix mutex test for non-auto-shadow setups
testsuite: Add timed mutex and cond tests
Native: Fix error signedness in rt_cont_wait_until
Native: Fix return code of in-kernel rt_cond_wait[_until]
Native: Ensure to re-acquire the mutex on cond_wait return
Native: Work around for error code corruption in rt_cond_wait[_until]
POSIX: Fix signess issue in EFAULT path of cond_wait_prologue
POSIX: Work around for error code corruption in pthread_cond_[timed]wait

 ksrc/skins/native/cond.c           |   19 +++--
 ksrc/skins/native/syscall.c        |   30 +++++-
 ksrc/skins/posix/syscall.c         |   29 ++++--
 src/skins/native/cond.c            |    6 +-
 src/testsuite/unit/mutex-torture.c |  185 ++++++++++++++++++++++++++++++------
 5 files changed, 213 insertions(+), 56 deletions(-)
#1 lore raw
In reply to Jan Kiszka
Quoted 12 lines · Jan Kiszka

The following changes since commit af93ec87f975b387243127090b578d57922b38dc:
Gilles Chanteperdrix (1):
posix: fix recursive condvar implementation

are available in the git repository at:

git://git.xenomai.org/xenomai-jki.git for-upstream

These patches pass basic testings, specifically our extended testsuite, but I'm still unhappy with the workaround. Specifically the fact that we lose -EINTR as valid return code for the Native side is fairly annoying.

Quoted 5 lines

For that reason, I will continue to work out fixed prologue/epilogue syscalls for both skins that up-to-date user space will be able to benefit from (native kernel space part is already done). The majority of users will continue to update kernel and user space synchronously anyway, for the rest we will provide these workarounds here.

Let us calm down, and avoid pushing changes which are worse than the issue they try and correct. I will not publish anything on these issues before this week-end. Instead of modifying the mutex-torture unt test, I will try and write a condvar-torture unit test, which exhaustively test all the return values of pthread_cond_wait/rt_cond_wait, including interruption by signals during the cond_wait, and the epilogue.

Signature · 1 line
					    Gilles.
author
#4 lore raw
Quoted 19 lines · Gilles Chanteperdrix
Quoted 12 lines · Jan Kiszka

The following changes since commit af93ec87f975b387243127090b578d57922b38dc:
Gilles Chanteperdrix (1):
posix: fix recursive condvar implementation

are available in the git repository at:

git://git.xenomai.org/xenomai-jki.git for-upstream

These patches pass basic testings, specifically our extended testsuite, but I'm still unhappy with the workaround. Specifically the fact that we lose -EINTR as valid return code for the Native side is fairly annoying.

Quoted 5 lines

For that reason, I will continue to work out fixed prologue/epilogue syscalls for both skins that up-to-date user space will be able to benefit from (native kernel space part is already done). The majority of users will continue to update kernel and user space synchronously anyway, for the rest we will provide these workarounds here.

Quoted 6 lines

Let us calm down, and avoid pushing changes which are worse than the issue they try and correct. I will not publish anything on these issues before this week-end. Instead of modifying the mutex-torture unt test, I will try and write a condvar-torture unit test, which exhaustively test all the return values of pthread_cond_wait/rt_cond_wait, including interruption by signals during the cond_wait, and the epilogue.

Fine with me. By then, we may also have feedback from our field tests. And should have finished writing the new syscall sets.

Will you also split up the torture test to leave the timed mutex test case in or should I do this?

Jan

Signature · 2 lines
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux
author
#5 lore raw
Quoted 26 lines · Jan Kiszka
Quoted 18 lines · Gilles Chanteperdrix
Quoted 12 lines · Jan Kiszka

The following changes since commit af93ec87f975b387243127090b578d57922b38dc:
Gilles Chanteperdrix (1):
posix: fix recursive condvar implementation

are available in the git repository at:

git://git.xenomai.org/xenomai-jki.git for-upstream

These patches pass basic testings, specifically our extended testsuite, but I'm still unhappy with the workaround. Specifically the fact that we lose -EINTR as valid return code for the Native side is fairly annoying.

Quoted 5 lines

For that reason, I will continue to work out fixed prologue/epilogue syscalls for both skins that up-to-date user space will be able to benefit from (native kernel space part is already done). The majority of users will continue to update kernel and user space synchronously anyway, for the rest we will provide these workarounds here.

Quoted 6 lines

Let us calm down, and avoid pushing changes which are worse than the issue they try and correct. I will not publish anything on these issues before this week-end. Instead of modifying the mutex-torture unt test, I will try and write a condvar-torture unit test, which exhaustively test all the return values of pthread_cond_wait/rt_cond_wait, including interruption by signals during the cond_wait, and the epilogue.

Quoted 2 lines

Fine with me. By then, we may also have feedback from our field tests. And should have finished writing the new syscall sets.

    / \
    /me
Quoted 4 lines

Will you also split up the torture test to leave the timed mutex test case in or should I do this?

Jan

Signature · 2 lines
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux
#3 lore raw

Re: [Xenomai-core] ADEOS patch for LPC3250

In reply to Pierre Ficheux
Quoted 6 lines · Pierre Ficheux

Hi all,

Do you know if there is any work on porting ADEOS to NXP LPC3250 (ARM926EJ-S) ?

http://ics.nxp.com/products/lpc3000/lpc32x0

It would be nice if you could avoid replying a random mail when asking an un related question. I would have expected a better knowledge of netiquette from an old-timer as you, Pierre :-)

No, I have not heard of any I-pipe port to NXP LPC3250. The ARM core does not really matter for an ARM port, as the timer, interrupt controller, and GPIO demux are the only thing which need to be considered and are not part of the core.

Regards.

Signature · 4 lines
Gilles Chanteperdrix, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
#6 lore raw
In reply to Jan Kiszka
Quoted 26 lines · Jan Kiszka
Quoted 18 lines · Gilles Chanteperdrix
Quoted 12 lines · Jan Kiszka

The following changes since commit af93ec87f975b387243127090b578d57922b38dc:
Gilles Chanteperdrix (1):
posix: fix recursive condvar implementation

are available in the git repository at:

git://git.xenomai.org/xenomai-jki.git for-upstream

These patches pass basic testings, specifically our extended testsuite, but I'm still unhappy with the workaround. Specifically the fact that we lose -EINTR as valid return code for the Native side is fairly annoying.

Quoted 5 lines

For that reason, I will continue to work out fixed prologue/epilogue syscalls for both skins that up-to-date user space will be able to benefit from (native kernel space part is already done). The majority of users will continue to update kernel and user space synchronously anyway, for the rest we will provide these workarounds here.

Quoted 6 lines

Let us calm down, and avoid pushing changes which are worse than the issue they try and correct. I will not publish anything on these issues before this week-end. Instead of modifying the mutex-torture unt test, I will try and write a condvar-torture unit test, which exhaustively test all the return values of pthread_cond_wait/rt_cond_wait, including interruption by signals during the cond_wait, and the epilogue.

Quoted 2 lines

Fine with me. By then, we may also have feedback from our field tests. And should have finished writing the new syscall sets.

Do not bother, I intend to handle all this.

Quoted 3 lines

Will you also split up the torture test to leave the timed mutex test case in or should I do this?

Ok. Will add the timeout tests to the mutex torture test.

Quoted 3 lines

Jan

Signature · 1 line
					    Gilles.
author
#7 lore raw
Quoted 26 lines · Gilles Chanteperdrix
Quoted 25 lines · Jan Kiszka
Quoted 24 lines · Gilles Chanteperdrix
Quoted 12 lines · Jan Kiszka

The following changes since commit af93ec87f975b387243127090b578d57922b38dc:
Gilles Chanteperdrix (1):
posix: fix recursive condvar implementation

are available in the git repository at:

git://git.xenomai.org/xenomai-jki.git for-upstream

These patches pass basic testings, specifically our extended testsuite, but I'm still unhappy with the workaround. Specifically the fact that we lose -EINTR as valid return code for the Native side is fairly annoying.

Quoted 5 lines

For that reason, I will continue to work out fixed prologue/epilogue syscalls for both skins that up-to-date user space will be able to benefit from (native kernel space part is already done). The majority of users will continue to update kernel and user space synchronously anyway, for the rest we will provide these workarounds here.

Let us calm down, and avoid pushing changes which are worse than the issue they try and correct. I will not publish anything on these issues before this week-end. Instead of modifying the mutex-torture unt test, I will try and write a condvar-torture unit test, which exhaustively test all the return values of pthread_cond_wait/rt_cond_wait, including interruption by signals during the cond_wait, and the epilogue.

Quoted 5 lines
Quoted 2 lines

Fine with me. By then, we may also have feedback from our field tests. And should have finished writing the new syscall sets.

Do not bother, I intend to handle all this.

That would be wasted effort as I'm half through (POSIX is missing). Will post my suggestion so that you have at least a chance to pick what you like.

Quoted 5 lines
Quoted 2 lines

Will you also split up the torture test to leave the timed mutex test case in or should I do this?

Ok. Will add the timeout tests to the mutex torture test.

Jan

Signature · 2 lines
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux
#9 lore raw
In reply to a message not in the archive
Quoted 2 lines · John

I merged some changes from git://git.xenomai.org/xenomai-jki.git for-upstream to my xenomai-2.5.1 release distribution
to include the rt_cond_wait and pthread_cond_[timed]wait work arounds. I also merged changes to the mutex_torture.c. Everything builds and most tests seem to pass but I get the following output from the mutex-torture tests:

You are probably missng the changes for recursive_cond_wait for the posix skin which were commited in the development branch. You do not see it because the new mutex-torture tests were added before the recursive cond test.

Quoted 13 lines
[email protected]# ./mutex-torture-native
simple_wait
recursive_wait
timed_mutex
FAILURE: timed_waiter, waited 3.870 us
[email protected]# ./mutex-torture-posix
simple_wait
recursive_wait
errorcheck_wait
timed_mutex
FAILURE: timed_mutex mutex_destroy: 22 (Invalid argument)
Quoted 1 line

Do you have suggestions on how to resolve these errors hopefully without moving to the full development branch?

This kind of thing is exactly the reason why I told I would work quietly on this issue. Things will be ready on monday, but it would help us a great deal if you could test the development branch on monday, at the same time as when we are validating it on our test platforms.

Can not do better right now.

Signature · 1 line
					    Gilles.
#15 lore raw
In reply to a message not in the archive
Quoted 1 line · John

I merged some changes from git://git.xenomai.org/xenomai-jki.git

for-upstream to my xenomai-2.5.1 release distribution

Quoted 2 lines

to include the rt_cond_wait and pthread_cond_[timed]wait work arounds.

I also merged changes to the mutex_torture.c. Everything builds and most tests seem to pass but I get the following output from the mutex-torture tests:

Quoted 13 lines
[email protected]# ./mutex-torture-native
simple_wait
recursive_wait
timed_mutex
FAILURE: timed_waiter, waited 3.870 us
[email protected]# ./mutex-torture-posix
simple_wait
recursive_wait
errorcheck_wait
timed_mutex
FAILURE: timed_mutex mutex_destroy: 22 (Invalid argument)
Quoted 2 lines

Do you have suggestions on how to resolve these errors hopefully without moving to the full development branch?

Ok. I found and fixed this bug. It was a bug in the testcase. It would really help us, however, if you could pull the full development branch, and just give it a quick test to see if it fixes the current issue. It is our hope that this development branch is close to what 2.5.2 will be.

Signature · 1 line
					    Gilles.
#10 lore raw
In reply to Gilles Chanteperdrix

I configured and built with linux-2.6.32.7 and xenomai-jki for-upstream snapshot: f98569c8eec5df605f806ff58e789668720805ee. I noticed that you removed the PTHREAD_WARNSW so I removed the call to pthread_set_mode_np to remove the following errors:

PosixThread/PosixThread.cpp:1607: error: 'PTHREAD_WARNSW' was not declared in this scope PosixThread/PosixThread.cpp:1607: error: 'pthread_set_mode_np' was not declared in this scope

I am able to run all of my user space application code and unit test code which uses CanFestival open source CAN library. I am also able to run the xeno-test which runs to completion with no errors. When I run the mutex-torture tests I still get the following errors which I have not looked into in more detail yet:

[email protected]# ./mutex-torture-native
simple_wait
recursive_wait
timed_mutex
FAILURE: timed_waiter, waited 4.110 us
[email protected]# ./mutex-torture-posix
simple_wait
recursive_wait
errorcheck_wait
timed_mutex
FAILURE: timed_mutex mutex_destroy: 22 (Invalid argument)

I am now looking at xenomai-rpm branch which one is close to 2.5.2 release?

--

John

-----Original Message-----
From: Gilles Chanteperdrix [mailto:[email protected]
Sent: Friday, March 05, 2010 1:37 PM
To: Charlton, John
Cc: '[email protected]'; xenomai-core
Subject: Re: [pull request] Fixes and workarounds for the cond issues

Quoted 2 lines · John

I merged some changes from git://git.xenomai.org/xenomai-jki.git
for-upstream to my xenomai-2.5.1 release distribution to include the rt_cond_wait and pthread_cond_[timed]wait work arounds. I also merged changes to the mutex_torture.c. Everything builds and most tests seem to pass but I get the following output from the mutex-torture tests:

You are probably missng the changes for recursive_cond_wait for the posix skin which were commited in the development branch. You do not see it because the new mutex-torture tests were added before the recursive cond test.

Quoted 9 lines
[email protected]# ./mutex-torture-native simple_wait 
recursive_wait timed_mutex
FAILURE: timed_waiter, waited 3.870 us [email protected]
./mutex-torture-posix simple_wait recursive_wait errorcheck_wait 
timed_mutex
FAILURE: timed_mutex mutex_destroy: 22 (Invalid argument)

Do you have suggestions on how to resolve these errors hopefully without moving to the full development branch?

This kind of thing is exactly the reason why I told I would work quietly on this issue. Things will be ready on monday, but it would help us a great deal if you could test the development branch on monday, at the same time as when we are validating it on our test platforms.

Can not do better right now.

Signature · 1 line
					    Gilles.
#11 lore raw
Quoted 4 lines · John

I configured and built with linux-2.6.32.7 and xenomai-jki for-upstream snapshot: f98569c8eec5df605f806ff58e789668720805ee. I noticed that you removed the PTHREAD_WARNSW so I removed the call to pthread_set_mode_np to remove the following errors:

PosixThread/PosixThread.cpp:1607: error: 'PTHREAD_WARNSW' was not declared in this scope PosixThread/PosixThread.cpp:1607: error: 'pthread_set_mode_np' was not declared in this scope

This should come with #include <pthread.h>, provided you use xeno-config --posix-cflags (soon to be deprecated way) or xeno-config --skin=posix --cflags
to get the compilation flags.

Quoted 2 lines

I am able to run all of my user space application code and unit test

code which uses CanFestival open source CAN library. I am also able to run the xeno-test which runs to completion with no errors. When I run the mutex-torture tests I still get the following errors which I have not looked into in more detail yet:

Quoted 14 lines

[email protected]# ./mutex-torture-native
simple_wait
recursive_wait
timed_mutex
FAILURE: timed_waiter, waited 4.110 us
[email protected]# ./mutex-torture-posix
simple_wait
recursive_wait
errorcheck_wait
timed_mutex
FAILURE: timed_mutex mutex_destroy: 22 (Invalid argument)
Quoted 1 line

I am now looking at xenomai-rpm branch which one is close to 2.5.2 release?

the master branch of the xenomai-2.5 repository. As explained here:
http://www.xenomai.org/index.php/Main_Page

in the "Fetching the source code repositories"

Signature · 1 line
					    Gilles.
#12 lore raw

Yes with the xenomai-2.5 branch latest as of 1900 UTC everything works without error including the mutex-torture tests (output below):

[email protected]# ./mutex-torture-native
simple_wait
recursive_wait
timed_mutex
mode_switch
pi_wait
lock_stealing
NOTE: lock_stealing mutex_trylock: not supported
simple_condwait
recursive_condwait
Test OK
[email protected]# ./mutex-torture-posix 
simple_wait
recursive_wait
errorcheck_wait
timed_mutex
mode_switch
pi_wait
lock_stealing
NOTE: lock_stealing mutex_trylock: not supported
simple_condwait
recursive_condwait
Test OK
[email protected]

pthread_set_mode_np(NULL, PTHREAD_WARNSW) also works with this branch. Thank you for the help.

--

John

-----Original Message-----
From: Gilles Chanteperdrix [mailto:[email protected]
Sent: Monday, March 08, 2010 1:47 PM
To: Charlton, John
Cc: '[email protected]'; xenomai-core
Subject: Re: [pull request] Fixes and workarounds for the cond issues

Quoted 6 lines · John

I configured and built with linux-2.6.32.7 and xenomai-jki for-upstream snapshot: f98569c8eec5df605f806ff58e789668720805ee. I noticed that you removed the PTHREAD_WARNSW so I removed the call to pthread_set_mode_np to remove the following errors:

PosixThread/PosixThread.cpp:1607: error: 'PTHREAD_WARNSW' was not declared in this scope
PosixThread/PosixThread.cpp:1607: error: 'pthread_set_mode_np' was not declared in this scope

This should come with #include <pthread.h>, provided you use xeno-config --posix-cflags (soon to be deprecated way) or xeno-config --skin=posix --cflags to get the compilation flags.

Quoted 2 lines

I am able to run all of my user space application code and unit test

code which uses CanFestival open source CAN library. I am also able to run the xeno-test which runs to completion with no errors. When I run the mutex-torture tests I still get the following errors which I have not looked into in more detail yet:

Quoted 10 lines

[email protected]# ./mutex-torture-native simple_wait 
recursive_wait timed_mutex
FAILURE: timed_waiter, waited 4.110 us [email protected]
./mutex-torture-posix simple_wait recursive_wait errorcheck_wait 
timed_mutex
FAILURE: timed_mutex mutex_destroy: 22 (Invalid argument)

I am now looking at xenomai-rpm branch which one is close to 2.5.2 release?

the master branch of the xenomai-2.5 repository. As explained here:
http://www.xenomai.org/index.php/Main_Page

in the "Fetching the source code repositories"

Signature · 1 line
					    Gilles.
#13 lore raw
Quoted 27 lines · John

Yes with the xenomai-2.5 branch latest as of 1900 UTC everything works without error including the mutex-torture tests (output below):

[email protected]# ./mutex-torture-native
simple_wait
recursive_wait
timed_mutex
mode_switch
pi_wait
lock_stealing
NOTE: lock_stealing mutex_trylock: not supported
simple_condwait
recursive_condwait
Test OK
[email protected]# ./mutex-torture-posix 
simple_wait
recursive_wait
errorcheck_wait
timed_mutex
mode_switch
pi_wait
lock_stealing
NOTE: lock_stealing mutex_trylock: not supported
simple_condwait
recursive_condwait
Test OK
[email protected]# 
Quoted 1 line

pthread_set_mode_np(NULL, PTHREAD_WARNSW) also works with this branch. Thank you for the help.

You also have cond-torture-posix, and cond-torture-native, which should test, among other things, the fix for the condition variable bug you had.

Signature · 1 line
					    Gilles.
#14 lore raw

These tests also pass:

[email protected]# ./cond-torture-native
simple_condwait
relative_condwait
absolute_condwait
sig_norestart_condwait
sig_restart_condwait
sig_norestart_condwait_mutex
sig_restart_condwait_mutex
sig_norestart_double
sig_restart_double
cond_destroy_whilewait
Test OK
[email protected]# ./cond-torture-posix
simple_condwait
relative_condwait
absolute_condwait
sig_norestart_condwait
sig_restart_condwait
sig_norestart_condwait_mutex
sig_restart_condwait_mutex
sig_norestart_double
sig_restart_double
cond_destroy_whilewait
Test OK
[email protected]#

If you want me to run other tests let me know. I have run xeno-test as well as these torture tests. My unit test code tests a custom sja1000 can driver that I wrote based on the xenomai rtcan_peak_pci.c driver module. If you want source for that I will send it but it is of limited value since it is written for our custom PLX9030 PCI interface.

--

John

-----Original Message-----
From: Gilles Chanteperdrix [mailto:[email protected]
Sent: Monday, March 08, 2010 3:42 PM
To: Charlton, John
Cc: '[email protected]'; xenomai-core
Subject: Re: [pull request] Fixes and workarounds for the cond issues

Quoted 11 lines · John

Yes with the xenomai-2.5 branch latest as of 1900 UTC everything works without error including the mutex-torture tests (output below):

[email protected]# ./mutex-torture-native simple_wait 
recursive_wait timed_mutex mode_switch pi_wait lock_stealing
NOTE: lock_stealing mutex_trylock: not supported simple_condwait 
recursive_condwait Test OK [email protected]
./mutex-torture-posix simple_wait recursive_wait errorcheck_wait 
timed_mutex mode_switch pi_wait lock_stealing
NOTE: lock_stealing mutex_trylock: not supported simple_condwait 
recursive_condwait Test OK [email protected]#
Quoted 1 line

pthread_set_mode_np(NULL, PTHREAD_WARNSW) also works with this branch. Thank you for the help.

You also have cond-torture-posix, and cond-torture-native, which should test, among other things, the fix for the condition variable bug you had.

Signature · 1 line
					    Gilles.