mbox series

[00/11] nds32 glibc Port v1

Message ID 1525617685-32083-1-git-send-email-vincentc@andestech.com
Headers show
Series nds32 glibc Port v1 | expand

Message

Vincent Chen May 6, 2018, 2:41 p.m. UTC
Hi, this serious of patch contains glibc port for Andes nds32 ISA. This is a
32 bit target using Linux-generic. The nds32 port for Linux had been included in
4.17-rc1. For testing convenience, the minimum kernel version is temporarily set
as 4.16. The nds32 ports for GCC and Binutils in upstream are too old to compile
this patchset. My colleagues are trying to upload the latest patch to upstream.
Before they finish, we put workable GCC and Binutils in the private git
repository and people can use them to build nds32 glibc toolchain. By the way,
the patch of build-many-glibcs.py for Andes nds32 port does not be included in
this patchest because we need to replace all download path with our private git
repository in build-many-glibcs.py. Therefore, we provide another
build-many-glibcs.py whose name is nds32-build-many-glibcs.py for nds32 in
the nds32 glibc git repository. The git repository path of each component for
nds32 is listed as below.

1. GCC git repo path:
  path: https://github.com/andestech/gcc.git
  branch: nds32-6.3.0-open
2. Binutils git repo path:
  path: https://github.com/andestech/binutils.git 
  branch: nds32-binutils-2.30-branch-open
3. Glibc git repo
  path: https://github.com/andestech/glibc.git 
  branch: nds32-glibc-2.27-v0
  i. nds32's build-many-glibcs.py
     https://github.com/andestech/glibc/blob/nds32-glibc-2.27-v0/sysdeps/nds32/misc/nds32-build-many-glibcs.py
4. Linux git repo
  path: https://github.com/andestech/linux/commits/master 
  branch: master

  In this patchset, the port for nds32 FPU extension is not included. We plan to
add it after the FPU ports for nds32 is accepted by Linux. Therefore, we keep
some flexibility in code for the ports of nds32 FPU extension.
  The port has been cross-tested on the FPGA board running Linux 4.17-rc2. In
order to avoid false timeout, we set a large number to TIMEOUTFACTOR. In
addition, we found many testcases in conform fails because some nds32 predefined
macro lack double underscore prefix in this version nds32 gcc. This bug will be
fixed in newer nds32 gcc version which is based on gcc 8.1.0 and we will upload
it after few weeks. For testing convenience, we create a temporary patch which
add these illegal macros to ISO C90 keywords in conform/conformtest.pl to skip
these failures. This temporary patch will be removed after we upload newer nds32
gcc version to our private github. 
(Temporary patch: https://github.com/andestech/glibc/commit/8b76851ba91eed053 )

The summary of glibc testsuite is listed as follows which includs the above 
temporary patch:

Summary of test results that the extra tests are included:
    14 FAIL
  4886 PASS
    10 UNSUPPORTED

Detail result:
https://github.com/andestech/glibc/blob/nds32-glibc-2.27-v0/sysdeps/nds32/misc/glibc_final_testing_result

The reasons for the 14 FAIL cases are listed as bellow.
1. nptl (8 FAIL cases)
   i. The following 6 testcase fail because the testing environment lacks native
      python: 
      ./nptl/test-condattr-printers.test-result
      ./nptl/test-cond-printers.test-result
      ./nptl/test-mutexattr-printers.test-result
      ./nptl/test-mutex-printers.test-result
      ./nptl/test-rwlockattr-printers.test-result
      ./nptl/test-rwlock-printers.test-result

   ii.The tst-cancel7 and tst-cancel7x fails because the 1 second timeout, at
      108-th line in tst-cancel7.c, is not enough for child thread to finish all
      work before system(). In other words, parent thread executes
      xpthread_cancel () before child thread executes system(). Therefore, child
      thread cannot write self-pid on pidfile and error message 'could not read
      pid' is got. The nds32 port can pass this testing after we extend the
      timeout to 5 seconds.
2. misc (3 FAIL cases)
   i. A new flag, RWF_APPEND, for preadv2/pwritev2 is added in Linux 4.16. This
      change causes expected ENOTSUP does not be caught in misc/tst-preadvwritev2
      and misc/tst-preadvwritev64v2. The nds32 ports can pass these two cases
      after adding the new flag RWF_APPEND to sysdeps/unix/sysv/linux/bits/uio-ext.h
      and misc/ tst-preadvwritev2-common.c.
   ii.The misc/test-errno-linux occasionally fails in sendfile function because
      EINVAL is caught rather than EBADF. The reason is due to uninitialized
      local variable 'off'. When 'off' is a negative number, the errno is set as
      EINVAL in glibc sendfile function before issuing sendfile syscall. The
      nds32 port can always pass the testing after initializing variable 'off'
      to zero.
3. stdio-common (1 FAIL case)
   i. The required memory size for stdio-common/bug22 testcase is more than 2 GB
      but the DRAM size on our FPGA is just 2GB. Therefore, the errno is set as
      ENOMEM instead of EOVERFLOW.
4. sunrpc (1 FAIL case)
   i. sunrpc/bug20790 fails because the testing environment lacks native cpp
5. malloc(1 FAIL case)
   i. malloc/tst-malloc-usable-tunables randomly fails. We hadn't found the root
      causes but we found some people encountered the same failure on the
      Internet. They think this failure is due to kernel bug. Therefore, we
      temporarily treat it as a false positive case for glibc.
      (https://www.mail-archive.com/debian-glibc@lists.debian.org/msg57118.html)

We imitate the RISC-V patchset to create our patches. Che-Wei and I volunteer to
be port maintainer. Thanks to everyone who helped us and contributed to it. :)
Any feedback is welcome.

Comments

Joseph Myers May 8, 2018, 2:45 p.m. UTC | #1
On Sun, 6 May 2018, vincentc wrote:

>    Hi, this serious of patch contains glibc port for Andes nds32 ISA. 

To confirm: all the work on this port is covered by the copyright 
assignment

GLIBC GDB GCC BINUTILS  Andes Technology        Taiwan  2009-12-16
Assigns Past and Future Changes

?

> repository and people can use them to build nds32 glibc toolchain. By the way,
> the patch of build-many-glibcs.py for Andes nds32 port does not be included in

It's still useful to have the changes that just add builds for all 
relevant ABI or other variants, even if they don't work until those 
changes to the other components are upstream, because having the ABI 
variants there may help point to other things in the review.

For example: what is the full list of incompatible ABIs supported by this 
port that would be listed at <https://sourceware.org/glibc/wiki/ABIList>?  
Based on the code in the port, it has at least big-endian and 
little-endian variants, so at least two ABIs.  Those ABIs should have 
different dynamic linker names, as for AArch64 (see my recent comments on 
the C-Sky port) - and likewise any other incompatible ABI variants.

>    ii.The tst-cancel7 and tst-cancel7x fails because the 1 second timeout, at
>       108-th line in tst-cancel7.c, is not enough for child thread to finish all
>       work before system(). In other words, parent thread executes
>       xpthread_cancel () before child thread executes system(). Therefore, child
>       thread cannot write self-pid on pidfile and error message 'could not read
>       pid' is got. The nds32 port can pass this testing after we extend the
>       timeout to 5 seconds.

See bug 14232.

> 2. misc (3 FAIL cases)
>    i. A new flag, RWF_APPEND, for preadv2/pwritev2 is added in Linux 4.16. This
>       change causes expected ENOTSUP does not be caught in misc/tst-preadvwritev2
>       and misc/tst-preadvwritev64v2. The nds32 ports can pass these two cases
>       after adding the new flag RWF_APPEND to sysdeps/unix/sysv/linux/bits/uio-ext.h
>       and misc/ tst-preadvwritev2-common.c.

But that's been fixed since commit 
f2652643d7234c08205b75f527191c2e2b35251f (3 Apr).  Are you sure you are 
testing relative to a recent git version of glibc?

(The ABI baselines need updating for my change to remove absolute symbols 
from ABI baselines, but that change went in two days before your patch 
series posting, whereas the RWF_SUPPORTED change went in a month ago.)

As further examples of updates needed to reflect current glibc, patch 8 
includes sigcontextinfo.h macros that I globally removed as unused in 
commit a44061398c3b531b37e134a6a97accb2251fa28a (22 Mar), while patch 7 
includes a readahead implementation, but Adhemerval consolidated those in 
commit c57bf7c15ba179168d01f7c6acde7ecbf5dd9cd8 so there shouldn't be any 
such architecture-specific implementations needed any more.  Patch 5 
includes a math_private.h file that shouldn't be needed since my 
refactoring in February.
Vincent Chen May 9, 2018, 5:21 a.m. UTC | #2
On Tue, May 08, 2018 at 10:45:57PM +0800, Joseph Myers wrote:
> On Sun, 6 May 2018, vincentc wrote:
> 
> >    Hi, this serious of patch contains glibc port for Andes nds32 ISA. 
> 
> To confirm: all the work on this port is covered by the copyright 
> assignment
> 
> GLIBC GDB GCC BINUTILS  Andes Technology        Taiwan  2009-12-16
> Assigns Past and Future Changes
> 
> ?
>

Yes

 
> > repository and people can use them to build nds32 glibc toolchain. By the way,
> > the patch of build-many-glibcs.py for Andes nds32 port does not be included in
> 
> It's still useful to have the changes that just add builds for all 
> relevant ABI or other variants, even if they don't work until those 
> changes to the other components are upstream, because having the ABI 
> variants there may help point to other things in the review.
> 
> For example: what is the full list of incompatible ABIs supported by this 
> port that would be listed at <https://sourceware.org/glibc/wiki/ABIList>?  
> Based on the code in the port, it has at least big-endian and 
> little-endian variants, so at least two ABIs.  Those ABIs should have 
> different dynamic linker names, as for AArch64 (see my recent comments on 
> the C-Sky port) - and likewise any other incompatible ABI variants.
> 
Ok, we will add nds32 port to build-many-glibcs.py and re-name the dynamic linker
based on support ABI in next version patch. In addition, we plan to remove 
big-endian support in next patch because we don't have stable platform to 
finishing the testing.

By the way, does this port possibly go upstream before the latest nds32 port of
gcc and binutil are upstream?


> >    ii.The tst-cancel7 and tst-cancel7x fails because the 1 second timeout, at
> >       108-th line in tst-cancel7.c, is not enough for child thread to finish all
> >       work before system(). In other words, parent thread executes
> >       xpthread_cancel () before child thread executes system(). Therefore, child
> >       thread cannot write self-pid on pidfile and error message 'could not read
> >       pid' is got. The nds32 port can pass this testing after we extend the
> >       timeout to 5 seconds.
> 
> See bug 14232.
> 

> > 2. misc (3 FAIL cases)
> >    i. A new flag, RWF_APPEND, for preadv2/pwritev2 is added in Linux 4.16. This
> >       change causes expected ENOTSUP does not be caught in misc/tst-preadvwritev2
> >       and misc/tst-preadvwritev64v2. The nds32 ports can pass these two cases
> >       after adding the new flag RWF_APPEND to sysdeps/unix/sysv/linux/bits/uio-ext.h
> >       and misc/ tst-preadvwritev2-common.c.
> 
> But that's been fixed since commit 
> f2652643d7234c08205b75f527191c2e2b35251f (3 Apr).  Are you sure you are 
> testing relative to a recent git version of glibc?
> 
> (The ABI baselines need updating for my change to remove absolute symbols 
> from ABI baselines, but that change went in two days before your patch 
> series posting, whereas the RWF_SUPPORTED change went in a month ago.)
> 
> As further examples of updates needed to reflect current glibc, patch 8 
> includes sigcontextinfo.h macros that I globally removed as unused in 
> commit a44061398c3b531b37e134a6a97accb2251fa28a (22 Mar), while patch 7 
> includes a readahead implementation, but Adhemerval consolidated those in 
> commit c57bf7c15ba179168d01f7c6acde7ecbf5dd9cd8 so there shouldn't be any 
> such architecture-specific implementations needed any more.  Patch 5 
> includes a math_private.h file that shouldn't be needed since my 
> refactoring in February.
> 

The testing is based on glibc 2.27 released commit.
(commit 406e7a023158b08a0908f381459f273a984c6fd328363cb)
I will follow your comment to modify and test the port based on the latest glibc
version again.


Thanks

Vincent Chen 


> -- 
> Joseph S. Myers
> joseph@codesourcery.com
Joseph Myers May 9, 2018, 12:10 p.m. UTC | #3
On Wed, 9 May 2018, Vincent Chen wrote:

> By the way, does this port possibly go upstream before the latest nds32 port of
> gcc and binutil are upstream?

No.  For a glibc port to go upstream, all the build dependencies must be 
upstream (generally meaning GCC, binutils, Linux kernel - and, likewise, 
if one of those ports is removed upstream, that means the glibc port will 
be removed as well, as recently happened to the tile port because that 
Linux kernel port was removed).  They only need to be upstream in the 
respective development mainlines, not on release branches.
Vincent Chen May 9, 2018, 1:49 p.m. UTC | #4
On Wed, May 09, 2018 at 08:10:37PM +0800, Joseph Myers wrote:
> On Wed, 9 May 2018, Vincent Chen wrote:
> 
> > By the way, does this port possibly go upstream before the latest nds32 port of
> > gcc and binutil are upstream?
> 
> No.  For a glibc port to go upstream, all the build dependencies must be 
> upstream (generally meaning GCC, binutils, Linux kernel - and, likewise, 
> if one of those ports is removed upstream, that means the glibc port will 
> be removed as well, as recently happened to the tile port because that 
> Linux kernel port was removed).  They only need to be upstream in the 
> respective development mainlines, not on release branches.
>

OK, I got it.

Thanks for your reply.

Best regards
Vincent
 
> -- 
> Joseph S. Myers
> joseph@codesourcery.com