2008-04-18 01:33:30 Pthread on BF54X/uClinux
Meihui Fan (CHINA)
Message: 54450
It seems link pthread into a program to run on BF54X/uClinux will make the process go into sleeping state.
The simple testing code is:
$ cat foo.c
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <pthread.h>
int main(void) { for (;;) printf("foo\n"); return 0; }
The toolchain version is:
$ bfin-linux-uclibc-gcc-4.1.2 -v
Using built-in specs.
Target: bfin-linux-uclibc
Configured with: /home/mhfan/devel/hhbf/uClinux-hg/toolchain/gcc-4.1/configure --build=i686-pc-linux-gnu --host=i686-pc-linux-gnu --target=bfin-linux-uclibc --prefix=/usr/local/toolchain-hhbf --enable-threads=posix --enable-shared --with-sysroot=/usr/local/toolchain-hhbf/bfin-linux-uclibc/runtime --disable-libstdcxx-pch --enable-languages=c,c++ --disable-symvers --disable-libssp --disable-libffi --enable-clocale=generic --enable-version-specific-runtime-libs --enable-__cxa_atexit
Thread model: posix
gcc version 4.1.2 (ADI svn)
Build with different flag:
$ bfin-linux-uclibc-gcc-4.1.2 foo.c -o foo
$ bfin-linux-uclibc-gcc-4.1.2 -pthread foo.c -o foo.pthread
Run the program on the target in background:
BF54X # ./foo > /dev/null &
BF54X # ./foo.pthread > /dev/null &
BF54X # ps
PID USER VSZ STAT COMMAND
1 0 560 S init
2 0 0 SW< [kthreadd]
3 0 0 SW< [ksoftirqd/0]
4 0 0 SW< [events/0]
5 0 0 SW< [khelper]
6 0 0 SW< [kblockd/0]
7 0 0 SW< [kmmcd]
8 0 0 SW [pdflush]
9 0 0 SW [pdflush]
10 0 0 SW< [kswapd0]
11 0 0 SW< [aio/0]
12 0 0 SW< [mtdblockd]
21 0 0 SW< [mmcqd]
23 0 668 R -/bin/msh
29 0 440 R ./foo
30 0 516 R ./foo.pthread
31 0 560 R ps
Nothing bad so far.
BF54X # sleep 30; ps
PID USER VSZ STAT COMMAND
1 0 560 S init
2 0 0 SW< [kthreadd]
3 0 0 SW< [ksoftirqd/0]
4 0 0 SW< [events/0]
5 0 0 SW< [khelper]
6 0 0 SW< [kblockd/0]
7 0 0 SW< [kmmcd]
8 0 0 SW [pdflush]
9 0 0 SW [pdflush]
10 0 0 SW< [kswapd0]
11 0 0 SW< [aio/0]
12 0 0 SW< [mtdblockd]
21 0 0 SW< [mmcqd]
23 0 668 R -/bin/msh
29 0 440 R ./foo
30 0 516 S ./foo.pthread
33 0 560 R ps
Here we get a problem: why foo.pthread goes into sleeping state now???
Is this a toolchain/kernel BUG?
QuoteReplyEditDelete
2008-04-18 13:11:28 Re: Pthread on BF54X/uClinux
Robin Getz (UNITED STATES)
Message: 54492 Meihui:
I talked to Mike, and he has been able to replicate on 537 - so I don't know why we have not noticed before.
We are digging into it, and will get back to you.
-Robin
QuoteReplyEditDelete
2008-04-24 13:54:39 Re: Pthread on BF54X/uClinux
SÃrgio Trofino (BRAZIL)
Message: 54881 Hi, Robin
I am using the BF537-STAMP, which run an image of uClinux_svn compiled with toolchain_svn.
Using the version of the svn or Release2008 I have problems in implementing the code attached.
It seems to me that the problem is with the function "mutex_unlock" because with the toolchain Release2008 accused of a mistake in libpthread.so Null Pointer + 0x8b42, which will be noticed the "mutex_unlock."
If find a solution, I kind enough to inform me also.
Regards
Sérgio Trofino
cond_signal.c
QuoteReplyEditDelete
2008-04-24 14:41:11 Re: Pthread on BF54X/uClinux
Robin Getz (UNITED STATES)
Message: 54886 SÃrgio:
Yeah, Mike is working on it - and has reproduced it, and is figuring it out.
-Robin
QuoteReplyEditDelete
2008-04-25 18:28:52 Re: Pthread on BF54X/uClinux
Mike Frysinger (UNITED STATES)
Message: 54967 the latest svn trunk should have this fixed now
QuoteReplyEditDelete