[PATCH][BZ #16159] Do not backtrace recursively.
Ondřej Bílka
neleai@seznam.cz
Wed Nov 20 13:41:00 GMT 2013
On Mon, Nov 18, 2013 at 11:03:53AM +0000, Thorsten Glaser wrote:
> OndÅej BÃlka <neleai <at> seznam.cz> writes:
>
> > --- a/ports/sysdeps/m68k/backtrace.c
> > +++ b/ports/sysdeps/m68k/backtrace.c
>
> > + static __thread int recursed = 0;
>
> m68k has a huge penalty for TLS (at least one syscall).
>
Ok, so we need more involved code. A tls access is only needed not to
run __libc_once twice initialization routine contains dlopen/lock which is
even slower. For that we need to define reentrant version of
libc_once and handle its failures.
A second question would be why you have slow TLS? As m68k are mostly
single core you could add a alternative TLS access without syscall
overhead.
You need to add in kernel a syscall where you specify a static TCB address
and kernel will save/restore it on context switches.
To support possible future multithread processors you could for example
check if a TCB pointer is null and proceed with syscall.
More information about the Libc-alpha
mailing list