NPTL support on PPC32 (MPC5200) ?

Stephen Warren SWarren at nvidia.com
Sat Oct 9 02:26:22 EST 2004


Hello everyone.

I'm trying to run a fairly heavily multi-threaded application on the
Motorola/Freescale MPC5200 platform. So far, we're having a few
performance problems. Freescale has profiled the application using
strace and shown that a lot of our CPU time goes into executing the kill
and rt_sigsuspend system calls, which we understand are used in the
implementation of the threading library.

So, I figured I'd see if NPTL (Native Posix Threads Library) would help
us out at all. I found and attempted to use a utility named crosstool
(0.28-rc37) from http://kegel.com/crosstool/ to build a new toolchain
supporting this.

I made a few changes to crosstool.sh in an attempt to request NPTL.
These are shown later in the email.

However, I'm getting an error from the configure of glibc:

...
/home/swarren/src/crosstool-0.28-rc37/build/powerpc-603e-linux-gnu/gcc-3
.4-20041001-glibc-20041004/glibc-20041004/configure --prefix=/usr
--build=i686-pc-linux-gnu --host=powerpc-603e-linux-gnu
--enable-kernel=2.4.24 --without-cvs --without-gd --with-tls
--with-__thread --enable-shared --enable-add-ons=nptl
--with-headers=/usr/local/ppc_82xx/powerpc-603e-linux-gnu/gcc-3.4-200410
01-glibc-20041004/powerpc-603e-linux-gnu/include
...
running configure fragment for nptl/sysdeps/pthread
checking for forced unwind support... no
configure: error: forced unwind support is required

I've tried various combinations of:

gcc-3.4.2        (release)
gcc-3.4-20041001 (10/01 snapshot)
glibc-2.3.3      (release)
glibc-20041004   (10/04 snapshot)
binutils-2.15    (release)
binutils-041007) (10/07 snapshot)
kernel 2.4.24    (release)
kernel 2.6.8     (release)

My question is - can anybody tell me, or point me at a website that
definitively tells me:

1) Is NPTL available on PPC at all? I assume so, since I found one of
the original announcement of NPTL, which mentions performance on a large
SMP PPC system.

2) Which kernels have the required support for NPTL - I believe 2.6.x
does. I know RedHat back-ported it to their 2.4.x kernels for RedHat 9
(at least x86). Did it get back-ported into any official 2.4.x kernel,
such as the 2.4.24 I tried?

3) Which glibc and gcc do I need. I found webpages that indicate gcc >=
3.4.x is required for toolchain thread/TLS support, and NPTL is part of
glibc >= 2.3.x.

4) Which binutils should work?

5) Am I missing some configure options for glibc? Or, binutils or gcc?

So far, I'm downloading all GNU tools from gnu.org, or a mirror, and
kernels from kernel.org. Should I try PPC-specific branches for any of
this?

Note: I'd really like 2.4.x support if it's available - I need a
DMA-enabled IDE driver for the MPC5200, and so far, all I have is a
patched 2.4.24 directly from Freescale (which apparently they're working
on integrating back into the kernel at www.denx.de) Eventually, we
intend to use a Montavista-based system. We were using MV Linux 3.0
(before we hit problems with IDE DMA) which uses kernel 2.4.18.

Thanks for any help, or pointers to good resources. I spent most of
yesterday googling and trying out different gcc/glibc/kernel
combinations, and couldn't get past this.

Modifications I made to crosstool.sh to request NPTL:

(Note that if I remove just the second part of this patch, it all builds
fine, but using the old Linuxthreads instead of NPTL)

===============================================================
[swarren at swarren-linux crosstool-0.28-rc37]$ diff crosstool.sh.orig
crosstool.sh
365,367c365,367
<       --enable-kernel=2.4.3 \
<         --without-cvs --disable-profile --disable-debug --without-gd \
<         --without-tls --without-__thread \
---
>       --enable-kernel=2.4.24 \
>         --without-cvs --without-gd \
>         --with-tls --with-__thread \
369c369
<         --enable-add-ons${GLIBC_ADDON_OPTIONS}
--with-headers=$HEADERDIR
---
>         --enable-add-ons=nptl --with-headers=$HEADERDIR
===============================================================

I created my own top-level build script and .dat files based upon the
existing ones:

===============================================================
[swarren at swarren-linux crosstool-0.28-rc37]$ cat demo-ppc603e.sh 
#!/bin/sh
set -ex
TARBALLS_DIR=$HOME/archive
RESULT_TOP=/usr/local/ppc_82xx
export TARBALLS_DIR RESULT_TOP
GCC_LANGUAGES="c,c++"
export GCC_LANGUAGES

# Really, you should do the mkdir before running this,
# and chown /opt/crosstool to yourself so you don't need to run as root.
mkdir -p $RESULT_TOP

# Build the toolchain.  Takes a couple hours and a couple gigabytes.
eval `cat powerpc-603e.dat gcc-3.4-20041001-glibc-20041004.dat` sh
all.sh --notest

echo Done.
===============================================================

===============================================================
[swarren at swarren-linux crosstool-0.28-rc37]$ cat
gcc-3.4-20041001-glibc-20041004.dat
BINUTILS_DIR=binutils-2.15
GCC_DIR=gcc-3.4-20041001
GLIBC_DIR=glibc-20041004
LINUX_DIR=linux-2.6.8
===============================================================

-- 
Stephen Warren, Software Engineer, NVIDIA, Fort Collins, CO
swarren at nvidia.com        http://www.nvidia.com/
swarren at wwwdotorg.org     http://www.wwwdotorg.org/pgp.html



More information about the Linuxppc-embedded mailing list