Commit Graph

37393 Commits

Author SHA1 Message Date
Florian Weimer
eef936eb45 nptl: Move cnd_signal into libc
The symbol was moved using scripts/move-symbol-to-libc.py.

The __pthread_cond_signal@@GLIBC_PRIVATE symbol is no longer
neded, so remove that as well.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>
2021-05-03 08:14:49 +02:00
Florian Weimer
3eab466e56 nptl: Move cnd_init into libc
The symbol was moved using scripts/move-symbol-to-libc.py.

The __pthread_cond_init@@GLIBC_PRIVATE symbol is no longer
neded, so remove that as well.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>
2021-05-03 08:14:38 +02:00
Florian Weimer
f11c293a4c nptl: Move cnd_destroy into libc
The symbol was moved using scripts/move-symbol-to-libc.py.

The __pthread_cond_destroy@@GLIBC_PRIVATE symbol is no longer
neded, so remove that as well.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>
2021-05-03 08:14:28 +02:00
Florian Weimer
0431f171da nptl: Move cnd_broadcast into libc
The symbol was moved using scripts/move-symbol-to-libc.py.

The __pthread_cond_broadcast@@GLIBC_PRIVATE symbol is no longer
neded, so remove that as well.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>
2021-05-03 08:14:17 +02:00
Florian Weimer
575295fc83 nptl: Move call_once into libc
The symbol was moved using scripts/move-symbol-to-libc.py.

This change also turns __pthread_once into a compatibility symbol
because after the call_once move, an internal call to __pthread_once
can be used.  This an adjustment to __libc_once: Outside libc (e.g.,
in nscd), it has to call pthread_once.  With __pthread_once as a
compatibility symbol, it is no longer to add a new GLIBC_2.34
version after the move from libpthread, and this commit removes
the new __pthread_once@@GLIBC_2.34 version.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>
2021-05-03 08:14:01 +02:00
Florian Weimer
ad201afe5c Add pthread-in-libc, libpthread-routines-var, librt-routines-var
These make variables can be used to add routines to different
libraries for the Hurd and Linux builds.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>
2021-05-03 08:13:32 +02:00
Raoni Fassina Firmino
23fdf8178c powerpc64le: Optimize memset for POWER10
This implementation is based on __memset_power8 and integrates a lot
of suggestions from Anton Blanchard.

The biggest difference is that it makes extensive use of stxvl to
alignment and tail code to avoid branches and small stores.  It has
three main execution paths:

a) "Short lengths" for lengths up to 64 bytes, avoiding as many
   branches as possible.

b) "General case" for larger lengths, it has an alignment section
   using stxvl to avoid branches, a 128 bytes loop and then a tail
   code, again using stxvl with few branches.

c) "Zeroing cache blocks" for lengths from 256 bytes upwards and set
   value being zero.  It is mostly the __memset_power8 code but the
   alignment phase was simplified because, at this point, address is
   already 16-bytes aligned and also changed to use vector stores.
   The tail code was also simplified to reuse the general case tail.

All unaligned stores use stxvl instructions that do not generate
alignment interrupts on POWER10, making it safe to use on
caching-inhibited memory.

On average, this implementation provides something around 30%
improvement when compared to __memset_power8.

Reviewed-by: Matheus Castanho <msc@linux.ibm.com>
Reviewed-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>
2021-04-30 18:12:08 -03:00
Tulio Magno Quites Machado Filho
e941e0ae80 powerpc64le: Optimize memcpy for POWER10
This implementation is based on __memcpy_power8_cached and integrates
suggestions from Anton Blanchard.
It benefits from loads and stores with length for short lengths and for
tail code, simplifying the code.

All unaligned memory accesses use instructions that do not generate
alignment interrupts on POWER10, making it safe to use on
caching-inhibited memory.

The main loop has also been modified in order to increase instruction
throughput by reducing the dependency on updates from previous iterations.

On average, this implementation provides around 30% improvement when
compared to __memcpy_power7 and 10% improvement in comparison to
__memcpy_power8_cached.
2021-04-30 18:12:08 -03:00
Lucas A. M. Magalhaes
dd59655e93 powerpc64le: Optimized memmove for POWER10
This patch was initially based on the __memmove_power7 with some ideas
from strncpy implementation for Power 9.

Improvements from __memmove_power7:

1. Use lxvl/stxvl for alignment code.

   The code for Power 7 uses branches when the input is not naturally
   aligned to the width of a vector. The new implementation uses
   lxvl/stxvl instead which reduces pressure on GPRs. It also allows
   the removal of branch instructions, implicitly removing branch stalls
   and mispredictions.

2. Use of lxv/stxv and lxvl/stxvl pair is safe to use on Cache Inhibited
   memory.

   On Power 10 vector load and stores are safe to use on CI memory for
   addresses unaligned to 16B. This code takes advantage of this to
   do unaligned loads.

   The unaligned loads don't have a significant performance impact by
   themselves. However doing so decreases register pressure on GPRs
   and interdependence stalls on load/store pairs. This also improved
   readability as there are now less code paths for different alignments.
   Finally this reduces the overall code size.

3. Improved performance.

   This version runs on average about 30% better than memmove_power7
   for lengths  larger than 8KB. For input lengths shorter than 8KB
   the improvement is smaller, it has on average about 17% better
   performance.

   This version has a degradation of about 50% for input lengths
   in the 0 to 31 bytes range when dest is unaligned.

Reviewed-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>
2021-04-30 18:12:08 -03:00
Joseph Myers
e046d73e5f Update kernel version to 5.12 in tst-mman-consts.py.
This patch updates the kernel version in the test tst-mman-consts.py
to 5.12.  (There are no new MAP_* constants covered by this test in
5.12 that need any other header changes.)

Tested with build-many-glibcs.py.
2021-04-29 10:50:11 +00:00
Joseph Myers
4a7c342605 Update syscall lists for Linux 5.12.
Linux 5.12 has one new syscall, mount_setattr.  Update
syscall-names.list and regenerate the arch-syscall.h headers with
build-many-glibcs.py update-syscalls.

Tested with build-many-glibcs.py.
2021-04-28 17:19:24 +00:00
Paul Zimmermann
e6eef0adc5 regenerate ulps on x86_64 with -march=native
On x86_64, when configuring glibc with CFLAGS="-O2 -g -march=native",
some tests fail. After this patch, "make check" succeeds.

Tested on Intel Core i5-4590 with gcc 10.2.1.
2021-04-28 12:46:00 +02:00
Martin Sebor
b25b067491 Pass a valid pointer to pthread_setspecific to avoid GCC 11 warning. 2021-04-27 19:07:49 -06:00
Martin Sebor
a1561c3bbe Add __attribute_access_none to disable GCC warnings [BZ #27714]
GCC 11 warns when a pointer to an uninitialized object is passed
to a function that takes a const-qualified argument.  This is done
on the assumption that most such functions read from the object.
For the rare case of a function that doesn't, GCC 11 extends
attribute access to add a new mode called none.

POSIX pthread_setspecific() is one such rare function that takes
a const void* argument but that doesn't read from the object it
points to.  To suppress the -Wmaybe-uninitialized issued by GCC
11 when the address of an uninitialized object is passed to it
(e.g., the result of malloc()), this change #defines
__attr_access_none in cdefs.h and uses the macro on the function
in sysdeps/htl/pthread.h and sysdeps/nptl/pthread.h.
2021-04-27 13:01:55 -06:00
Joseph Myers
876cdfd154 Use Linux 5.12 and GCC 11 branch in build-many-glibcs.py.
This patch makes build-many-glibcs.py use Linux 5.12 and GCC 11
branch.

Tested with build-many-glibcs.py (host-libraries, compilers and glibcs
builds).
2021-04-27 15:19:08 +00:00
Raphael Moreira Zinsly
25cb72820a powerpc: Add log IFUNC multiarch support for POWER10
Checked on ppc64le built without --with-cpu, with --with-cpu=power9
and with --disable-multi-arch.

Reviewed-by: Matheus Castanho <msc@linux.ibm.com>
2021-04-26 10:10:29 -03:00
Hanataka Shinya
82292c99b2 LC_COLLATE: Fix last character ellipsis handling (Bug 22668)
During ellipsis processing the collation cursor was not correctly
moved to the end of the ellipsis after processing.

The code inserted the new entry after the cursor, but before the
real end of the ellipsis:
                                [cursor]
... element_t <-> element_t <-> element_t <-> element_t
                  "<U0000>"     "<U0001>"     "<U007F>"
                  startp                      endp

At the end of the function we have:

                  [cursor]
... element_t <-> element_t <-> element_t
                  "<U007E>"     "<U007F>"
                                endp

The cursor should be pointing at endp, the last element in the
doubly-linked list, otherwise when execution returns to the
caller we will start inserting the next line after <U007E>.

Subsequent operations end up unlinking the ellipsis end entry or
just leaving it in the list dangling from the end.  This kind of
dangling is immediately visible in C.UTF-8 with the following
sorting from strcoll:
<U0010FFFF>
<U0000FFFF>
<U000007FF>
<U0000007F>

With the cursor correctly adjusted the end entry is correctly given
the right location and thus the right weight.

Retested and no regressions on x86_64 and i686.

Co-authored-by: Carlos O'Donell <carlos@redhat.com>
2021-04-26 08:03:32 -04:00
Noah Goldstein
7f3e7c262c x86: Optimize strchr-evex.S
No bug. This commit optimizes strchr-evex.S. The optimizations are
mostly small things such as save an ALU in the alignment process,
saving a few instructions in the loop return. The one significant
change is saving 2 instructions in the 4x loop. test-strchr,
test-strchrnul, test-wcschr, and test-wcschrnul are all passing.

Signed-off-by: Noah Goldstein <goldstein.w.n@gmail.com>
2021-04-25 10:04:39 -07:00
Noah Goldstein
ccabe7971f x86: Optimize strchr-avx2.S
No bug. This commit optimizes strchr-avx2.S. The optimizations are all
small things such as save an ALU in the alignment process, saving a
few instructions in the loop return, saving some bytes in the main
loop, and increasing the ILP in the return cases. test-strchr,
test-strchrnul, test-wcschr, and test-wcschrnul are all passing.

Signed-off-by: Noah Goldstein <goldstein.w.n@gmail.com>
2021-04-25 10:04:31 -07:00
Florian Weimer
24f261f27f nptl: Remove __h_errno_location from libpthread
The existing definition in libc will be used instead.

The symbol was moved (that is, removed) using
scripts/move-symbol-to-libc.py.
2021-04-23 18:08:38 +02:00
Florian Weimer
2b6a4307e9 nptl: Remove __res_state from libpthread
The existing definition in libc will be used instead.

The symbol was moved (that is, removed) using
scripts/move-symbol-to-libc.py.
2021-04-23 18:08:37 +02:00
Florian Weimer
4baf02b332 nptl: Move pthread_spin_trylock into libc
The symbol was moved using scripts/move-symbol-to-libc.py.
2021-04-23 17:06:48 +02:00
Florian Weimer
da8e3710d8 nptl: Move pthread_spin_lock into libc
The symbol was moved using scripts/move-symbol-to-libc.py.
2021-04-23 17:06:46 +02:00
Florian Weimer
ce4b3b7bef nptl: Move pthread_spin_init, Move pthread_spin_unlock into libc
For some architectures, the two functions are aliased, so these
symbols need to be moved at the same time.

The symbols were moved using scripts/move-symbol-to-libc.py.
2021-04-23 17:06:44 +02:00
Florian Weimer
c7b1cd4ad1 nptl: Move pthread_spin_destroy into libc
The symbol was moved using scripts/move-symbol-to-libc.py.
2021-04-23 17:06:42 +02:00
Florian Weimer
d9b600c985 nptl: Move pthread_condattr_setpshared into libc
The symbol was moved using scripts/move-symbol-to-libc.py.
2021-04-23 11:17:10 +02:00
Florian Weimer
6a75fefc2c nptl: Move pthread_condattr_setclock into libc
The symbol was moved using scripts/move-symbol-to-libc.py.
2021-04-23 11:02:54 +02:00
Florian Weimer
2a775a9ea5 nptl: Move pthread_condattr_getpshared into libc
The symbol was moved using scripts/move-symbol-to-libc.py.
2021-04-23 11:00:53 +02:00
Florian Weimer
ed00dcbbd6 nptl: Move pthread_condattr_getclock into libc
The symbol was moved using scripts/move-symbol-to-libc.py.
2021-04-23 10:55:07 +02:00
Florian Weimer
b76c066d09 nptl: Move pthread_mutexattr_settype, __pthread_mutexattr_settype into libc
And pthread_mutexattr_setkind_np as a compatibility symbol.

__pthread_mutexattr_settype is used in mtx_init from libpthread,
so this commit adds a GLIBC_2.34 symbol version for it.

The symbols were moved using scripts/move-symbol-to-libc.py.
2021-04-23 09:51:57 +02:00
Florian Weimer
1ec4cd5ab4 nptl: Move pthread_mutexattr_setrobust into libc
And pthread_mutexattr_getrobust_np as a compat symbol.

The symbols were moved using scripts/move-symbol-to-libc.py.
2021-04-23 09:51:57 +02:00
Florian Weimer
0bdd797945 pthread: Use pthread_mutexattr_setrobust in tests
pthread_mutexattr_setrobust_np is about to be deprecated.
2021-04-23 09:51:57 +02:00
Florian Weimer
8a229ee93c nptl: Move pthread_mutexattr_setpshared into libc
The symbol was moved using scripts/move-symbol-to-libc.py.
2021-04-23 09:51:57 +02:00
Florian Weimer
241ac38c33 nptl: Move pthread_mutexattr_setprotocol into libc
The symbol was moved using scripts/move-symbol-to-libc.py.
2021-04-23 09:51:57 +02:00
Florian Weimer
c66772281f nptl: Move pthread_mutexattr_setprioceiling into libc
The symbol was moved using scripts/move-symbol-to-libc.py.
2021-04-23 09:51:57 +02:00
Florian Weimer
506385d30e nptl: Move pthread_mutexattr_init, __pthread_mutexattr_init into libc
__pthread_mutexattr_init cannot be be made a compat symbol because
it is used in mtx_init, which is still in libpthread.

The symbols were moved using scripts/move-symbol-to-libc.py.
2021-04-23 09:51:56 +02:00
Florian Weimer
2a23e899e2 nptl: Move pthread_mutexattr_gettype into libc
And pthread_mutexattr_getkind_np as a compatibility symbol.
(There is no declaration in <pthread.h>, so there is no need
to add an alias or a deprecation warning there.)

The symbols were moved using scripts/move-symbol-to-libc.py.
2021-04-23 09:51:19 +02:00
Florian Weimer
9b7ab14e11 nptl: Move pthread_mutexattr_getrobust into libc
And pthread_mutexattr_getrobust_np as a compat symbol.

The symbols were moved using scripts/move-symbol-to-libc.py.
2021-04-23 09:46:03 +02:00
Florian Weimer
2e825f7d5a nptl: Move pthread_mutexattr_getpshared into libc
The symbol was moved using scripts/move-symbol-to-libc.py.
2021-04-23 09:45:48 +02:00
Florian Weimer
9f2f158b35 nptl: Move pthread_mutexattr_getprotocol into libc
The symbol was moved using scripts/move-symbol-to-libc.py.
2021-04-23 09:45:29 +02:00
Florian Weimer
d236322b6f nptl: Move pthread_mutexattr_getprioceiling into libc
The symbol was moved using scripts/move-symbol-to-libc.py.
2021-04-23 09:45:09 +02:00
Florian Weimer
fd42022a10 nptl: Move pthread_mutexattr_destroy into libc
And __pthread_mutexattr_destroy as a compat symbol (so no
GLIBC_2.34 symbol version is added for it).

The symbols were moved using scripts/move-symbol-to-libc.py.
2021-04-23 09:44:49 +02:00
Florian Weimer
a2b0f2e186 nptl: Move pthread_mutex_trylock, __pthread_mutex_trylock into libc
The symbols were moved using scripts/move-symbol-to-libc.py.

__pthread_mutex_trylock is used to implement mtx_timedlock,
which still resides in libpthread, so add a GLIBC_2.34 version
for it, to match the existing GLIBC_2.0 version.
2021-04-23 09:44:23 +02:00
Florian Weimer
4372dc7eaa nptl: Move pthread_mutex_timedlock, pthread_mutex_clocklock to libc
The symbols were moved using scripts/move-symbol-to-libc.py.
The symbol aliasing follows pthread_cond_timedwait et al.
Missing hidden prototypes had to be added to nptl/pthreadP.h
for consistency.
2021-04-23 09:43:24 +02:00
Florian Weimer
a2975191d0 nptl: Move pthread_mutex_setprioceiling into libc
The symbol was moved using scripts/move-symbol-to-libc.py.
2021-04-23 09:43:08 +02:00
Florian Weimer
4b85c6f55f nptl: Move pthread_mutex_getprioceiling into libc
The symbol was moved using scripts/move-symbol-to-libc.py.
2021-04-23 09:42:51 +02:00
Matheus Castanho
10624a97e8 powerpc: Add optimized strlen for POWER10
Improvements compared to POWER9 version:

1. Take into account first 16B comparison for aligned strings

   The previous version compares the first 16B and increments r4 by the number
   of bytes until the address is 16B-aligned, then starts doing aligned loads at
   that address. For aligned strings, this causes the first 16B to be compared
   twice, because the increment is 0. Here we calculate the next 16B-aligned
   address differently, which avoids that issue.

2. Use simple comparisons for the first ~192 bytes

   The main loop is good for big strings, but comparing 16B each time is better
   for smaller strings.  So after aligning the address to 16 Bytes, we check
   more 176B in 16B chunks.  There may be some overlaps with the main loop for
   unaligned strings, but we avoid using the more aggressive strategy too soon,
   and also allow the loop to start at a 64B-aligned address.  This greatly
   benefits smaller strings and avoids overlapping checks if the string is
   already aligned at a 64B boundary.

3. Reduce dependencies between load blocks caused by address calculation on loop

   Doing a precise time tracing on the code showed many loads in the loop were
   stalled waiting for updates to r4 from previous code blocks.  This
   implementation avoids that as much as possible by using 2 registers (r4 and
   r5) to hold addresses to be used by different parts of the code.

   Also, the previous code aligned the address to 16B, then to 64B by doing a
   few 48B loops (if needed) until the address was aligned. The main loop could
   not start until that 48B loop had finished and r4 was updated with the
   current address. Here we calculate the address used by the loop very early,
   so it can start sooner.

   The main loop now uses 2 pointers 128B apart to make pointer updates less
   frequent, and also unrolls 1 iteration to guarantee there is enough time
   between iterations to update the pointers, reducing stalled cycles.

4. Use new P10 instructions

   lxvp is used to load 32B with a single instruction, reducing contention in
   the load queue.

   vextractbm allows simplifying the tail code for the loop, replacing
   vbpermq and avoiding having to generate a permute control vector.

Reviewed-by: Paul E Murphy <murphyp@linux.ibm.com>
Reviewed-by: Raphael M Zinsly <rzinsly@linux.ibm.com>
Reviewed-by: Lucas A. M. Magalhaes <lamm@linux.ibm.com>
2021-04-22 16:18:06 -03:00
Florian Weimer
6f3e54d404 nptl: Do not build nptl/tst-pthread-gdb-attach as PIE 2021-04-22 19:54:29 +02:00
Florian Weimer
e4f1c0de9c nptl: Move pthread_kill_other_threads_np compatibility symbol into libc
And stop including the function for new architectures.
2021-04-22 19:50:16 +02:00
H.J. Lu
7fc9152e83 x86: tst-cpu-features-supports.c: Update AMX check
Pass "amx-bf16", "amx-int8" and "amx-tile", instead of "amx_bf16",
"amx_int8" and "amx_tile", to __builtin_cpu_supports for GCC 11.
2021-04-22 10:09:49 -07:00