[RFC 5/5] RISC-V: Expand PTHREAD_STACK_MIN to support RVV environment

H.J. Lu hjl.tools@gmail.com
Wed Sep 15 14:31:11 GMT 2021


On Wed, Sep 15, 2021 at 3:42 AM Florian Weimer via Libc-alpha
<libc-alpha@sourceware.org> wrote:
>
> * Joseph Myers:
>
> > On Mon, 13 Sep 2021, Vincent Chen wrote:
> >
> >> In order to support all pthread operations in the RVV environment, here
> >> PTHREAD_STACK_MIN is set to 4 times GLRO(dl_minsigstacksize), and the
> >> default PTHREAD_STACK_MIN is expanded to 20K bytes.
> >
> > A change to PTHREAD_STACK_MIN has been considered an ABI change in the
> > past, requiring new symbol versions for pthread_attr_setstack and
> > pthread_attr_setstacksize to ensure that binaries built with the old
> > PTHREAD_STACK_MIN definition continue to work rather than failing because
> > the old size is too small.  You may need symbol versioning updates for
> > those functions in RISC-V if you make such a change.  (All the existing
> > versioning support for this in architecture-independent files assumes the
> > change in value was done before libpthread was merged into libc, so there
> > will be some extra work involved in being the first architecture to
> > increase PTHREAD_STACK_MIN after that merge.)
>
> Instead it may make sense to leave PTHREAD_STACK_MIN as is and switch to
> the dynamic version (same for the SIGSTKSZ constants).
>

I don't know what problem RISC-V ran into.   It should be fixed with:

commit 5d98a7dae955bafa6740c26eaba9c86060ae0344
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Mon Jun 21 12:42:56 2021 -0700

    Define PTHREAD_STACK_MIN to sysconf(_SC_THREAD_STACK_MIN)

    The constant PTHREAD_STACK_MIN may be too small for some processors.
    Rename _SC_SIGSTKSZ_SOURCE to _DYNAMIC_STACK_SIZE_SOURCE.  When
    _DYNAMIC_STACK_SIZE_SOURCE or _GNU_SOURCE are defined, define
    PTHREAD_STACK_MIN to sysconf(_SC_THREAD_STACK_MIN) which is changed
    to MIN (PTHREAD_STACK_MIN, sysconf(_SC_MINSIGSTKSZ)).

    Consolidate <bits/local_lim.h> with <bits/pthread_stack_min.h> to
    provide a constant target specific PTHREAD_STACK_MIN value.

    Reviewed-by: Carlos O'Donell <carlos@redhat.com>

--
H.J.


More information about the Libc-alpha mailing list