libpthread cleanup: L4 port, PowerPC port

2012-08-04 Thread Thomas Schwinge
Hi!

I'm currently having a look at a few pending libpthread issues.  Before
getting to these, I'd first like to propose some cleanup.  I have not yet
tested these changes, but will do so once they're generally approved.

There has been a libpthread port for Hurd on L4 use, which is dead, and
has been superseded by a Viengoos port, which has its own branches:
master-viengoos and its successor, master-viengoos-on-bare-metal.  This
project is curently stalled, too, and when it is revived, it should first
merge generic improvements (as well as port the Hurd/Mach changes to
Viengoos as necessary) from master (and possibly also be completely
merged back into master).  Therefore, the L4 port in master is a)
completely out of date, and b) dead, so I propose to remove it.  OK?

Remove L4 port.

* TODO: Update.
* Makefile.am: Remove file.
* headers.m4: Likewise.
* signal/README: Likewise.
* signal/TODO: Likewise.
* signal/kill.c: Likewise.
* signal/pt-kill-siginfo-np.c: Likewise.
* signal/sig-internal.c: Likewise.
* signal/sig-internal.h: Likewise.
* signal/sigaction.c: Likewise.
* signal/sigaltstack.c: Likewise.
* signal/signal-dispatch.c: Likewise.
* signal/signal.h: Likewise.
* signal/sigpending.c: Likewise.
* signal/sigsuspend.c: Likewise.
* signal/sigtimedwait.c: Likewise.
* signal/sigwaiter.c: Likewise.
* signal/sigwaitinfo.c: Likewise.
* sysdeps/generic/killpg.c: Likewise.
* sysdeps/generic/raise.c: Likewise.
* sysdeps/generic/sigaddset.c: Likewise.
* sysdeps/generic/sigdelset.c: Likewise.
* sysdeps/generic/sigemptyset.c: Likewise.
* sysdeps/generic/sigfillset.c: Likewise.
* sysdeps/generic/siginterrupt.c: Likewise.
* sysdeps/generic/sigismember.c: Likewise.
* sysdeps/generic/signal.c: Likewise.
* sysdeps/generic/sigwait.c: Likewise.
* sysdeps/l4/bits/pthread-np.h: Likewise.
* sysdeps/l4/hurd/bits/pthread-np.h: Likewise.
* sysdeps/l4/hurd/ia32/pt-machdep.c: Likewise.
* sysdeps/l4/hurd/ia32/pt-setup.c: Likewise.
* sysdeps/l4/hurd/ia32/signal-dispatch-lowlevel.c: Likewise.
* sysdeps/l4/hurd/powerpc/pt-machdep.c: Likewise.
* sysdeps/l4/hurd/powerpc/pt-setup.c: Likewise.
* sysdeps/l4/hurd/pt-block.c: Likewise.
* sysdeps/l4/hurd/pt-kill.c: Likewise.
* sysdeps/l4/hurd/pt-setactivity-np.c: Likewise.
* sysdeps/l4/hurd/pt-sigstate-destroy.c: Likewise.
* sysdeps/l4/hurd/pt-sigstate-init.c: Likewise.
* sysdeps/l4/hurd/pt-sigstate.c: Likewise.
* sysdeps/l4/hurd/pt-startup.c: Likewise.
* sysdeps/l4/hurd/pt-sysdep.c: Likewise.
* sysdeps/l4/hurd/pt-sysdep.h: Likewise.
* sysdeps/l4/hurd/pt-thread-alloc.c: Likewise.
* sysdeps/l4/hurd/pt-thread-halt.c: Likewise.
* sysdeps/l4/hurd/pt-thread-start.c: Likewise.
* sysdeps/l4/hurd/pt-wakeup.c: Likewise.
* sysdeps/l4/hurd/sig-sysdep.h: Likewise.
* sysdeps/l4/hurd/sigprocmask.c: Likewise.
* sysdeps/l4/pt-block.c: Likewise.
* sysdeps/l4/pt-docancel.c: Likewise.
* sysdeps/l4/pt-pool-np.c: Likewise.
* sysdeps/l4/pt-spin.c: Likewise.
* sysdeps/l4/pt-stack-alloc.c: Likewise.
* sysdeps/l4/pt-thread-alloc.c: Likewise.
* sysdeps/l4/pt-thread-dealloc.c: Likewise.
* sysdeps/l4/pt-thread-halt.c: Likewise.
* sysdeps/l4/pt-thread-start.c: Likewise.
* sysdeps/l4/pt-timedblock.c: Likewise.
* sysdeps/l4/pt-wakeup.c: Likewise.

diff --git a/TODO b/TODO
index d7e54da..8b087b1 100644
--- a/TODO
+++ b/TODO
@@ -142,36 +142,3 @@
 
 ** TLS
   Support for TLS is only implemented for Mach/Hurd (x86).
-
-* L4 Specific Issues
-** Stack
-*** Size
-   The stack size is defined to be a single page in
-   sysdeps/l4/hurd/pt-sysdep.h.  Once we are able to setup regions,
-   this can be expanded to two megs as suggested by the Mach version.
-   Until then, however, we need to allocate too much physical memory.
-*** Deallocation
-   __thread_stack_dealloc currently does not deallocate the stack.
-   For a proper implementation, we need a working memory manager.
-
-** Scheduling
-*** yield
-   [L4] We cannot use yield for spin locks as L4 only yields to threads of
-   priority which are greater than or equal to the yielding thread.
-   If there are threads of lower priority, they are not considered;
-   the yielding thread is just placed back on the processor.  This
-   introduces priority inversion quite quickly.  L4 will not add a
-   priority suppression function call.  As such, we need to do
-   an ipc with a small time out and then use exponential back off to
-   do the actual waiting.  This sucks.
-
-** Stub code
-  [L4] We include  in pt-start.c, however, we need a library
-  so we do not have to play with the corba stuff.
-
-** Root server and Task server
-*** Getting the tids.
-   pt-start.c has a wonderfully evil hack that will never work well.
-
-** Paging
-  We set the pager to the root server. Evil.  Fix this in pt-start.c.
[Removed files omitted.]


Also, I propose to remove the incomplete and unmaintained PowerPC port.
OK?

Remove PowerPC port.

* TODO: Update.
* sysdeps/powerpc/bits/machine-lock.h: Remove file.
* sysdeps/powerpc/bits/memory.h: Likewise.
* sysdeps/powerpc/bits/spin-lock.h: Likewise.
* 

Re: libpthread cleanup: L4 port, PowerPC port

2012-08-04 Thread Neal H. Walfield
At Sat, 4 Aug 2012 12:34:28 +0200,
Thomas Schwinge wrote:
> There has been a libpthread port for Hurd on L4 use, which is dead, and
> has been superseded by a Viengoos port, which has its own branches:

For what it is worth, the L4 port works directly on L4: no further OS
personality support is required.  On the other hand, no one actually
uses it so I guess it is okay to remove it.

> master-viengoos and its successor, master-viengoos-on-bare-metal.

master-viengoos is an implementation of Viengoos that runs on L4.
viengoos-on-bare-metal runs directly on x86-64 (and it a bit more
advanced) and provides everything that master-viengoos does and more.
I unfortunately never got around to issuing the right git commands to
make turn it into the master branch.

> * signal/README: Likewise.
> * signal/TODO: Likewise.
> * signal/kill.c: Likewise.
> * signal/pt-kill-siginfo-np.c: Likewise.
> * signal/sig-internal.c: Likewise.
> * signal/sig-internal.h: Likewise.
> * signal/sigaction.c: Likewise.
> * signal/sigaltstack.c: Likewise.
> * signal/signal-dispatch.c: Likewise.
> * signal/signal.h: Likewise.
> * signal/sigpending.c: Likewise.
> * signal/sigsuspend.c: Likewise.
> * signal/sigtimedwait.c: Likewise.
> * signal/sigwaiter.c: Likewise.
> * signal/sigwaitinfo.c: Likewise.
> * sysdeps/generic/killpg.c: Likewise.
> * sysdeps/generic/raise.c: Likewise.
> * sysdeps/generic/sigaddset.c: Likewise.
> * sysdeps/generic/sigdelset.c: Likewise.
> * sysdeps/generic/sigemptyset.c: Likewise.
> * sysdeps/generic/sigfillset.c: Likewise.
> * sysdeps/generic/siginterrupt.c: Likewise.
> * sysdeps/generic/sigismember.c: Likewise.
> * sysdeps/generic/signal.c: Likewise.
> * sysdeps/generic/sigwait.c: Likewise.

I think these are also used by the Viengoos port.  Are you suggesting
to remove both the L4 and the Viengoos ports or just the L4 port?

> Also, I propose to remove the incomplete and unmaintained PowerPC port.
> OK?

I have no objections to this.

> In August 2008, Neal has been porting over some generic changes from the
> Viengoos branch to master, and I'm now identifying if there are
> additional changes to be ported.

That's a good idea.  Unfortunately, I don't remember how far I got.

Note: libpthread is not without its problems, e.g., lack of testing in
the wild.  I still think the better way forward is to use Glibc's
pthread, if possible.

Neal



Re: libpthread cleanup: L4 port, PowerPC port

2012-08-04 Thread Thomas Schwinge
Hi!

On Sat, 04 Aug 2012 13:02:10 +0200, "Neal H. Walfield"  
wrote:
> At Sat, 4 Aug 2012 12:34:28 +0200,
> Thomas Schwinge wrote:
> > There has been a libpthread port for Hurd on L4 use, which is dead, and
> > has been superseded by a Viengoos port, which has its own branches:
> 
> For what it is worth, the L4 port works directly on L4: no further OS
> personality support is required.  On the other hand, no one actually
> uses it so I guess it is okay to remove it.

Yes -- and the nice thing about each Git repository clone carrying the
whole history is that it can rather easily be resurrected if needed.

> > master-viengoos and its successor, master-viengoos-on-bare-metal.
> 
> master-viengoos is an implementation of Viengoos that runs on L4.
> viengoos-on-bare-metal runs directly on x86-64 (and it a bit more
> advanced) and provides everything that master-viengoos does and more.
> I unfortunately never got around to issuing the right git commands to
> make turn it into the master branch.

Note that I'm talking about branches of the hurd/libpthread.git
repository, which contains only the libpthread branches (as used by Hurd
on Mach: master, old L4: master, Viengoos: master-viengoos and
viengoos-on-bare-metal), and not the hurd/viengoos.git repository which
contains all the other Viengoos code.

> > * signal/README: Likewise.
> > * signal/TODO: Likewise.
> > * signal/kill.c: Likewise.
> > * signal/pt-kill-siginfo-np.c: Likewise.
> > * signal/sig-internal.c: Likewise.
> > * signal/sig-internal.h: Likewise.
> > * signal/sigaction.c: Likewise.
> > * signal/sigaltstack.c: Likewise.
> > * signal/signal-dispatch.c: Likewise.
> > * signal/signal.h: Likewise.
> > * signal/sigpending.c: Likewise.
> > * signal/sigsuspend.c: Likewise.
> > * signal/sigtimedwait.c: Likewise.
> > * signal/sigwaiter.c: Likewise.
> > * signal/sigwaitinfo.c: Likewise.
> > * sysdeps/generic/killpg.c: Likewise.
> > * sysdeps/generic/raise.c: Likewise.
> > * sysdeps/generic/sigaddset.c: Likewise.
> > * sysdeps/generic/sigdelset.c: Likewise.
> > * sysdeps/generic/sigemptyset.c: Likewise.
> > * sysdeps/generic/sigfillset.c: Likewise.
> > * sysdeps/generic/siginterrupt.c: Likewise.
> > * sysdeps/generic/sigismember.c: Likewise.
> > * sysdeps/generic/signal.c: Likewise.
> > * sysdeps/generic/sigwait.c: Likewise.
> 
> I think these are also used by the Viengoos port.  Are you suggesting
> to remove both the L4 and the Viengoos ports or just the L4 port?

I only intend to clean up libpthread's master branch (that is, remove its
old L4 port).  On libpthread's master-viengoos and viengoos-on-bare-metal
branches, the Viengoos-specific code stays as-is, and can continue to
evolve there, with the long-term goal of eventually merging it back into
libpthread's master branch as a new Viengoos port of libpthread.  (I
guess that you only started using Viengoos-specific branches for
libpthread for the reason of being able to easily do changes in the
generic libpthread code without disturbing/having to adapt the Hurd on
Mach port.)

> > In August 2008, Neal has been porting over some generic changes from the
> > Viengoos branch to master, and I'm now identifying if there are
> > additional changes to be ported.
> 
> That's a good idea.  Unfortunately, I don't remember how far I got.

It's not very much that is missing; I think I already extracted most of
it, and will post that soon.


> Note: libpthread is not without its problems, e.g., lack of testing in
> the wild.  I still think the better way forward is to use Glibc's
> pthread, if possible.

Yes, but I think given the testing it is seeing via Debian GNU/Hurd, your
libpthread not so bad actually.  In the long term, and given someone
willing to do it, a NPTL port would of course be possible/preferable/...,
too.  But I don't think that's a priority currently.


Grüße,
 Thomas


pgp9byjWzOVRv.pgp
Description: PGP signature


Re: libpthread cleanup: L4 port, PowerPC port

2012-08-04 Thread Neal H. Walfield
At Sat, 4 Aug 2012 15:02:46 +0200,
Thomas Schwinge wrote:
> > > master-viengoos and its successor, master-viengoos-on-bare-metal.
> > 
> > master-viengoos is an implementation of Viengoos that runs on L4.
> > viengoos-on-bare-metal runs directly on x86-64 (and it a bit more
> > advanced) and provides everything that master-viengoos does and more.
> > I unfortunately never got around to issuing the right git commands to
> > make turn it into the master branch.
> 
> Note that I'm talking about branches of the hurd/libpthread.git
> repository, which contains only the libpthread branches (as used by Hurd
> on Mach: master, old L4: master, Viengoos: master-viengoos and
> viengoos-on-bare-metal), and not the hurd/viengoos.git repository which
> contains all the other Viengoos code.

That's what I thought you meant.

> > > * signal/README: Likewise.
> > > * signal/TODO: Likewise.
> > > * signal/kill.c: Likewise.
> > > * signal/pt-kill-siginfo-np.c: Likewise.
> > > * signal/sig-internal.c: Likewise.
> > > * signal/sig-internal.h: Likewise.
> > > * signal/sigaction.c: Likewise.
> > > * signal/sigaltstack.c: Likewise.
> > > * signal/signal-dispatch.c: Likewise.
> > > * signal/signal.h: Likewise.
> > > * signal/sigpending.c: Likewise.
> > > * signal/sigsuspend.c: Likewise.
> > > * signal/sigtimedwait.c: Likewise.
> > > * signal/sigwaiter.c: Likewise.
> > > * signal/sigwaitinfo.c: Likewise.
> > > * sysdeps/generic/killpg.c: Likewise.
> > > * sysdeps/generic/raise.c: Likewise.
> > > * sysdeps/generic/sigaddset.c: Likewise.
> > > * sysdeps/generic/sigdelset.c: Likewise.
> > > * sysdeps/generic/sigemptyset.c: Likewise.
> > > * sysdeps/generic/sigfillset.c: Likewise.
> > > * sysdeps/generic/siginterrupt.c: Likewise.
> > > * sysdeps/generic/sigismember.c: Likewise.
> > > * sysdeps/generic/signal.c: Likewise.
> > > * sysdeps/generic/sigwait.c: Likewise.
> > 
> > I think these are also used by the Viengoos port.  Are you suggesting
> > to remove both the L4 and the Viengoos ports or just the L4 port?
> 
> I only intend to clean up libpthread's master branch (that is, remove its
> old L4 port).

Ok.  I still think that the above files are generic and not L4
specific.

> On libpthread's master-viengoos and viengoos-on-bare-metal
> branches, the Viengoos-specific code stays as-is, and can continue to
> evolve there, with the long-term goal of eventually merging it back into
> libpthread's master branch as a new Viengoos port of libpthread.  (I
> guess that you only started using Viengoos-specific branches for
> libpthread for the reason of being able to easily do changes in the
> generic libpthread code without disturbing/having to adapt the Hurd on
> Mach port.)

My recollection is that Hurd was in CVS at the time.  You(?) created
 libpthread.git later.

> Yes, but I think given the testing it is seeing via Debian GNU/Hurd, your
> libpthread not so bad actually.  In the long term, and given someone
> willing to do it, a NPTL port would of course be possible/preferable/...,
> too.  But I don't think that's a priority currently.

If you have time, I'd recommend that you also take a look at the
asserts and disable the more expensive ones.  For instance in
sysdeps/mach/hurd/pt-sysdep.h, _pthread_self checks that the
thread->kernel_thread matches _mach_thread_self().  This requires two
system calls!  _pthread_self should be fast...

Neal



Re: libpthread cleanup: L4 port, PowerPC port

2012-08-04 Thread Thomas Schwinge
Hi!

On Sat, 04 Aug 2012 15:16:22 +0200, "Neal H. Walfield"  
wrote:
> At Sat, 4 Aug 2012 15:02:46 +0200,
> Thomas Schwinge wrote:
> > > > * signal/README: Likewise.
> > > > * signal/TODO: Likewise.
> > > > * signal/kill.c: Likewise.
> > > > * signal/pt-kill-siginfo-np.c: Likewise.
> > > > * signal/sig-internal.c: Likewise.
> > > > * signal/sig-internal.h: Likewise.
> > > > * signal/sigaction.c: Likewise.
> > > > * signal/sigaltstack.c: Likewise.
> > > > * signal/signal-dispatch.c: Likewise.
> > > > * signal/signal.h: Likewise.
> > > > * signal/sigpending.c: Likewise.
> > > > * signal/sigsuspend.c: Likewise.
> > > > * signal/sigtimedwait.c: Likewise.
> > > > * signal/sigwaiter.c: Likewise.
> > > > * signal/sigwaitinfo.c: Likewise.
> > > > * sysdeps/generic/killpg.c: Likewise.
> > > > * sysdeps/generic/raise.c: Likewise.
> > > > * sysdeps/generic/sigaddset.c: Likewise.
> > > > * sysdeps/generic/sigdelset.c: Likewise.
> > > > * sysdeps/generic/sigemptyset.c: Likewise.
> > > > * sysdeps/generic/sigfillset.c: Likewise.
> > > > * sysdeps/generic/siginterrupt.c: Likewise.
> > > > * sysdeps/generic/sigismember.c: Likewise.
> > > > * sysdeps/generic/signal.c: Likewise.
> > > > * sysdeps/generic/sigwait.c: Likewise.
> > > 
> > > I think these are also used by the Viengoos port.  Are you suggesting
> > > to remove both the L4 and the Viengoos ports or just the L4 port?
> > 
> > I only intend to clean up libpthread's master branch (that is, remove its
> > old L4 port).
> 
> Ok.  I still think that the above files are generic and not L4
> specific.

Does that mean you'd like to keep them available in the master branch,
though unused there?  (In principle I'm fine either way, but have a
tendency towards only having code live in the repositories that is
actually being used.)


> > On libpthread's master-viengoos and viengoos-on-bare-metal
> > branches, the Viengoos-specific code stays as-is, and can continue to
> > evolve there, with the long-term goal of eventually merging it back into
> > libpthread's master branch as a new Viengoos port of libpthread.  (I
> > guess that you only started using Viengoos-specific branches for
> > libpthread for the reason of being able to easily do changes in the
> > generic libpthread code without disturbing/having to adapt the Hurd on
> > Mach port.)
> 
> My recollection is that Hurd was in CVS at the time.  You(?) created
>  libpthread.git later.

I did do the conversion/extraction of libpthread, yes.  There were two
copies: one in the hurd repository, one in the hurd-l4 one, which I
combined into a single Git one, at the appropriate branch point.  And it
indeed seems you/we created the separate Viengoos branches later on.


> > Yes, but I think given the testing it is seeing via Debian GNU/Hurd, your
> > libpthread not so bad actually.  In the long term, and given someone
> > willing to do it, a NPTL port would of course be possible/preferable/...,
> > too.  But I don't think that's a priority currently.
> 
> If you have time, I'd recommend that you also take a look at the
> asserts and disable the more expensive ones.  For instance in
> sysdeps/mach/hurd/pt-sysdep.h, _pthread_self checks that the
> thread->kernel_thread matches _mach_thread_self().  This requires two
> system calls!  _pthread_self should be fast...

Thanks, noted.


Grüße,
 Thomas


pgpEVtMIq5cyP.pgp
Description: PGP signature


Re: libpthread cleanup: L4 port, PowerPC port

2012-08-04 Thread Neal H. Walfield
At Sat, 4 Aug 2012 15:56:01 +0200,
Thomas Schwinge wrote:
> On Sat, 04 Aug 2012 15:16:22 +0200, "Neal H. Walfield"  
> wrote:
> > At Sat, 4 Aug 2012 15:02:46 +0200,
> > Thomas Schwinge wrote:
> > > > > * signal/README: Likewise.
> > > > > * signal/TODO: Likewise.
> > > > > * signal/kill.c: Likewise.
> > > > > * signal/pt-kill-siginfo-np.c: Likewise.
> > > > > * signal/sig-internal.c: Likewise.
> > > > > * signal/sig-internal.h: Likewise.
> > > > > * signal/sigaction.c: Likewise.
> > > > > * signal/sigaltstack.c: Likewise.
> > > > > * signal/signal-dispatch.c: Likewise.
> > > > > * signal/signal.h: Likewise.
> > > > > * signal/sigpending.c: Likewise.
> > > > > * signal/sigsuspend.c: Likewise.
> > > > > * signal/sigtimedwait.c: Likewise.
> > > > > * signal/sigwaiter.c: Likewise.
> > > > > * signal/sigwaitinfo.c: Likewise.
> > > > > * sysdeps/generic/killpg.c: Likewise.
> > > > > * sysdeps/generic/raise.c: Likewise.
> > > > > * sysdeps/generic/sigaddset.c: Likewise.
> > > > > * sysdeps/generic/sigdelset.c: Likewise.
> > > > > * sysdeps/generic/sigemptyset.c: Likewise.
> > > > > * sysdeps/generic/sigfillset.c: Likewise.
> > > > > * sysdeps/generic/siginterrupt.c: Likewise.
> > > > > * sysdeps/generic/sigismember.c: Likewise.
> > > > > * sysdeps/generic/signal.c: Likewise.
> > > > > * sysdeps/generic/sigwait.c: Likewise.
> > > > 
> > > > I think these are also used by the Viengoos port.  Are you suggesting
> > > > to remove both the L4 and the Viengoos ports or just the L4 port?
> > > 
> > > I only intend to clean up libpthread's master branch (that is, remove its
> > > old L4 port).
> > 
> > Ok.  I still think that the above files are generic and not L4
> > specific.
> 
> Does that mean you'd like to keep them available in the master branch,
> though unused there?  (In principle I'm fine either way, but have a
> tendency towards only having code live in the repositories that is
> actually being used.)

It's generic code.  At least glibc keeps generic code around, if I
recall correctly.  Further, one of the very nice things about this
libpthread is that it is really easy to integrate into a new OS (or
even use in a kernel).  It would be a shame to lose that feature.
But, as I'm not doing the work, you are welcome to evict this code to
make your life easier.

Neal