mbox series

[v5,0/2] Improve surplus TLS accounting

Message ID cover.1592841472.git.szabolcs.nagy@arm.com
Headers show
Series Improve surplus TLS accounting | expand

Message

Szabolcs Nagy June 22, 2020, 4:20 p.m. UTC
Addressed the review comments, the tricky static TLS accounting
bits are unchanged. These are still outstanding:

> Subsequent followup after committing this:
> - We need to fix tst-manyaudit.
> - We should be able to count how many spaces we need based on LD_AUDIT
>   or DT_AUDIT and enable up to that amount.

Reran the tests on aarch64 and x86.

Szabolcs Nagy (2):
  rtld: Add rtld.nns tunable for the number of supported namespaces
  rtld: Avoid using up static TLS surplus for optimizations [BZ #25051]

 csu/libc-tls.c             |  31 +++++-----
 elf/Makefile               |  29 +++++++++-
 elf/dl-reloc.c             |  37 +++++++++---
 elf/dl-tls.c               |  56 ++++++++++++++++--
 elf/dl-tunables.list       |  14 +++++
 elf/dynamic-link.h         |   5 +-
 elf/rtld.c                 |   3 +
 elf/tst-tls-ie-dlmopen.c   | 114 +++++++++++++++++++++++++++++++++++++
 elf/tst-tls-ie-mod.h       |  40 +++++++++++++
 elf/tst-tls-ie-mod0.c      |   4 ++
 elf/tst-tls-ie-mod1.c      |   4 ++
 elf/tst-tls-ie-mod2.c      |   4 ++
 elf/tst-tls-ie-mod3.c      |   4 ++
 elf/tst-tls-ie-mod4.c      |   4 ++
 elf/tst-tls-ie-mod5.c      |   4 ++
 elf/tst-tls-ie-mod6.c      |   4 ++
 elf/tst-tls-ie.c           | 113 ++++++++++++++++++++++++++++++++++++
 manual/tunables.texi       |  38 +++++++++++++
 sysdeps/generic/ldsodefs.h |  11 ++++
 19 files changed, 487 insertions(+), 32 deletions(-)
 create mode 100644 elf/tst-tls-ie-dlmopen.c
 create mode 100644 elf/tst-tls-ie-mod.h
 create mode 100644 elf/tst-tls-ie-mod0.c
 create mode 100644 elf/tst-tls-ie-mod1.c
 create mode 100644 elf/tst-tls-ie-mod2.c
 create mode 100644 elf/tst-tls-ie-mod3.c
 create mode 100644 elf/tst-tls-ie-mod4.c
 create mode 100644 elf/tst-tls-ie-mod5.c
 create mode 100644 elf/tst-tls-ie-mod6.c
 create mode 100644 elf/tst-tls-ie.c

Comments

Szabolcs Nagy June 26, 2020, 10:50 a.m. UTC | #1
The 06/22/2020 17:20, Szabolcs Nagy wrote:
> Addressed the review comments, the tricky static TLS accounting
> bits are unchanged. These are still outstanding:
> 
> > Subsequent followup after committing this:
> > - We need to fix tst-manyaudit.
> > - We should be able to count how many spaces we need based on LD_AUDIT
> >   or DT_AUDIT and enable up to that amount.
> 
> Reran the tests on aarch64 and x86.
> 
> Szabolcs Nagy (2):
>   rtld: Add rtld.nns tunable for the number of supported namespaces
>   rtld: Avoid using up static TLS surplus for optimizations [BZ #25051]

since Carlos reviewed v4
https://sourceware.org/pipermail/libc-alpha/2020-June/115179.html
i attach the v4 to v5 diff in case that helps the review.

i assume the tst-auditmany fix would be something like

void
_dl_tls_static_surplus_init (size_t naudit)
{
  nns = TUNABLE_GET (nns, size_t, NULL);
  if (nns > DL_NNS)
    nns = DL_NNS; // nns = 1 when !SHARED

  if (DL_NNS - nns < naudit)
    _dl_fatal_printf ("too many auditors");
  nns += naudit;

  GLRO(dl_tls_static_surplus) = nns * X + ...;
}

default nns=4 and DL_NNS=16 allows 12 audit modules
(tst-auditmany needs 9) and auditors don't use up
the surplus tls reserved for the application.