Re: [Xenomai-core] problem in pthread_mutex_lock/unlock

2010-06-18 Thread Gilles Chanteperdrix
Nero Fernandez wrote:
> Hi,
> 
> Please find an archive attached, containing :
>  - a program for testing context-switch-latency using posix-APIs
>for native linux kernel and xenomai-posix-skin (userspace).
>  - Makefile to build it using xenomai

Your program is very long to tell fast. But it seems you are using the
mutex as if they were recursive. Xenomai posix skin mutexes used to be
recursive by default, but no longer are.

Also note that your code does not check the return value of the posix
skin services, which is a really bad idea.

-- 
Gilles.

___
Xenomai-core mailing list
Xenomai-core@gna.org
https://mail.gna.org/listinfo/xenomai-core


[Xenomai-core] problem in pthread_mutex_lock/unlock

2010-06-18 Thread Nero Fernandez
Hi,

Please find an archive attached, containing :
 - a program for testing context-switch-latency using posix-APIs
   for native linux kernel and xenomai-posix-skin (userspace).
 - Makefile to build it using xenomai

In brief, the attempt is to spawn a bunch of pthreads, which share pairs
of read-write pthread-mutexes in a circular fashion, as shown below, and
measure the time taken for to complete a (rel_mtx_0 - acq_mtx_n) by
pthread_0
( - threads try to acquire read mutexes and release write_mutexes)

pthread_0:write_mtx  =   pthread_1:read_mtx
pthread_1:write_mtx  =   pthread_2:read_mtx
..
pthread_(n-1):write_mtx  =   pthread_1:write_mtx
pthread_n:write_mtx  =   pthread_0:read_mtx

The program runs fine on native linux userspace (ARM, x86) , but the
in the xenomai-space, threads lock up at trying to acquire their respective
read_mutexes.

A similar attempt using message-queues runs fine.

Am running a version between 2.5.2 and 2.5.3.
Will try to check with 2.5.3 as well.

Following is my current xeno-config
# ./xeno-config
xeno-config --verbose
--version="2.5.2"
--cc="arm-linux-gcc"
--arch="arm"
--prefix="/opt/xeno_utils"
--xeno-cflags="-I/opt/xeno_utils/include -D_GNU_SOURCE -D_REENTRANT
-Wall -pipe -D__XENO__"
--xeno-ldflags="-L/opt/xeno_utils/lib -lxenomai -lpthread "
--posix-cflags=""
--posix-ldflags="-Wl,--wrap,pthread_create
-Wl,--wrap,pthread_setschedparam -Wl,--wrap,"


context_switch_latency.tgz
Description: GNU Zip compressed data
___
Xenomai-core mailing list
Xenomai-core@gna.org
https://mail.gna.org/listinfo/xenomai-core