Commit graph

20041 commits

Author SHA1 Message Date
Dimitry Ivanov
d0b5c3ad65 Fix bionic-unit-tests-glibc
Also add another test for dlsym(RTLD_NEXT, ..)

Bug: http://b/33106624
Test: run bionic-unit-tests-glibc and bionic-unit-tests
Change-Id: I340165d66bf2360b0e3273d3561a08cb5e7bd025
2016-11-28 13:09:19 -08:00
Christopher Ferris
ecebb49ac6 Add cortex-a7 specific routines.
Test: Changed angler target to use cortex-a7 and I compiled.
Test: Booted this version on angler and ran bionic-unit-tests.

Change-Id: Ice7f6ea38a2569582161a8e659d7877918c1a45a
2016-11-28 12:49:36 -08:00
Jake Weinstein
372f19e9e2 libc: ARM64: update memset/strlen/memcpy/memmove to newlib/cortex-strings
* Bionic benchmarks results at the bottom

* This is a squash of the following commits:

libc: ARM64: optimize memset.

 This is an optimized memset for AArch64.  Memset is split into 4 main
 cases: small sets of up to 16 bytes, medium of 16..96 bytes which are
 fully unrolled.  Large memsets of more than 96 bytes align the
 destination and use an unrolled loop processing 64 bytes per
 iteration.  Memsets of zero of more than 256 use the dc zva
 instruction, and there are faster versions for the common ZVA sizes 64
 or 128.  STP of Q registers is used to reduce codesize without loss of
 performance.

Change-Id: I0c5b5ec5ab8a1fd0f23eee8fbacada0be08e841f

libc: ARM64: improve performance in strlen

Change-Id: Ic20f93a0052a49bd76cd6795f51e8606ccfbf11c

libc: ARM64: Optimize memcpy.

 This is an optimized memcpy for AArch64.  Copies are split into 3 main
 cases: small copies of up to 16 bytes, medium copies of 17..96 bytes
 which are fully unrolled.  Large copies of more than 96 bytes align
 the destination and use an unrolled loop processing 64 bytes per
 iteration.  In order to share code with memmove, small and medium
 copies read all data before writing, allowing any kind of overlap.  On
 a random copy test memcpy is 40.8% faster on A57 and 28.4% on A53.

Change-Id: Ibb9483e45bbc0e8ca3d5ce98a31c55dfd8a5ac28

libc: AArch64: Tune memcpy

* Further tuning for performance.

Change-Id: Id08eaab885f9743fa7575077924a947c1b88e4ff

libc: ARM64: optimize memmove for Cortex-A53

* Sadly does not work on Denver or Kryo, so can't go to generic

 This is an optimized memmove for AArch64.  All copies of up to 96
 bytes and all backward copies are done by the new memcpy.  The only
 remaining case is large forward copies which are done in the same way
 as the memcpy loop, but copying from the end rather than the start.

Tested on the Nextbit Robin with MSM8992 (Snapdragon 808):

Before
BM_string_memcmp/8                          1000k         27    0.286 GiB/s
BM_string_memcmp/64                           50M         20    3.053 GiB/s
BM_string_memcmp/512                          20M        126    4.060 GiB/s
BM_string_memcmp/1024                         10M        234    4.372 GiB/s
BM_string_memcmp/8Ki                        1000k       1726    4.745 GiB/s
BM_string_memcmp/16Ki                        500k       3711    4.415 GiB/s
BM_string_memcmp/32Ki                        200k       8276    3.959 GiB/s
BM_string_memcmp/64Ki                        100k      16351    4.008 GiB/s
BM_string_memcpy/8                          1000k         13    0.612 GiB/s
BM_string_memcpy/64                         1000k          8    7.187 GiB/s
BM_string_memcpy/512                          50M         38   13.311 GiB/s
BM_string_memcpy/1024                         20M         86   11.858 GiB/s
BM_string_memcpy/8Ki                           5M        620   13.203 GiB/s
BM_string_memcpy/16Ki                       1000k       1265   12.950 GiB/s
BM_string_memcpy/32Ki                        500k       2977   11.004 GiB/s
BM_string_memcpy/64Ki                        500k       8003    8.188 GiB/s
BM_string_memmove/8                         1000k         11    0.684 GiB/s
BM_string_memmove/64                        1000k         16    3.855 GiB/s
BM_string_memmove/512                         50M         57    8.915 GiB/s
BM_string_memmove/1024                        20M        117    8.720 GiB/s
BM_string_memmove/8Ki                          2M        853    9.594 GiB/s
BM_string_memmove/16Ki                      1000k       1731    9.462 GiB/s
BM_string_memmove/32Ki                       500k       3566    9.189 GiB/s
BM_string_memmove/64Ki                       500k       7708    8.501 GiB/s
BM_string_memset/8                          1000k         16    0.487 GiB/s
BM_string_memset/64                         1000k         16    3.995 GiB/s
BM_string_memset/512                          50M         37   13.489 GiB/s
BM_string_memset/1024                         50M         58   17.405 GiB/s
BM_string_memset/8Ki                           5M        451   18.160 GiB/s
BM_string_memset/16Ki                          2M        883   18.554 GiB/s
BM_string_memset/32Ki                       1000k       2181   15.022 GiB/s
BM_string_memset/64Ki                        500k       4563   14.362 GiB/s
BM_string_strlen/8                          1000k          8    0.965 GiB/s
BM_string_strlen/64                         1000k         16    3.855 GiB/s
BM_string_strlen/512                          20M         92    5.540 GiB/s
BM_string_strlen/1024                         10M        167    6.111 GiB/s
BM_string_strlen/8Ki                        1000k       1237    6.620 GiB/s
BM_string_strlen/16Ki                       1000k       2765    5.923 GiB/s
BM_string_strlen/32Ki                        500k       6135    5.341 GiB/s
BM_string_strlen/64Ki                        200k      13168    4.977 GiB/s

After
BM_string_memcmp/8                          1000k         21    0.369 GiB/s
BM_string_memcmp/64                         1000k         28    2.272 GiB/s
BM_string_memcmp/512                          20M        128    3.983 GiB/s
BM_string_memcmp/1024                         10M        234    4.375 GiB/s
BM_string_memcmp/8Ki                        1000k       1732    4.728 GiB/s
BM_string_memcmp/16Ki                        500k       3485    4.701 GiB/s
BM_string_memcmp/32Ki                        500k       7031    4.660 GiB/s
BM_string_memcmp/64Ki                        200k      14296    4.584 GiB/s
BM_string_memcpy/8                          1000k          5    1.458 GiB/s
BM_string_memcpy/64                         1000k          7    8.952 GiB/s
BM_string_memcpy/512                          50M         36   13.907 GiB/s
BM_string_memcpy/1024                         20M         80   12.750 GiB/s
BM_string_memcpy/8Ki                           5M        572   14.307 GiB/s
BM_string_memcpy/16Ki                       1000k       1165   14.053 GiB/s
BM_string_memcpy/32Ki                        500k       3141   10.430 GiB/s
BM_string_memcpy/64Ki                        500k       7008    9.351 GiB/s
BM_string_memmove/8                           50M          7    1.074 GiB/s
BM_string_memmove/64                        1000k          9    6.593 GiB/s
BM_string_memmove/512                         50M         37   13.502 GiB/s
BM_string_memmove/1024                        20M         80   12.656 GiB/s
BM_string_memmove/8Ki                          5M        573   14.281 GiB/s
BM_string_memmove/16Ki                      1000k       1168   14.018 GiB/s
BM_string_memmove/32Ki                      1000k       2825   11.599 GiB/s
BM_string_memmove/64Ki                       500k       6548   10.008 GiB/s
BM_string_memset/8                          1000k          7    1.038 GiB/s
BM_string_memset/64                         1000k          8    7.151 GiB/s
BM_string_memset/512                        1000k         29   17.272 GiB/s
BM_string_memset/1024                         50M         53   18.969 GiB/s
BM_string_memset/8Ki                           5M        424   19.300 GiB/s
BM_string_memset/16Ki                          2M        846   19.350 GiB/s
BM_string_memset/32Ki                       1000k       2028   16.156 GiB/s
BM_string_memset/64Ki                        500k       4514   14.517 GiB/s
BM_string_strlen/8                          1000k          7    1.120 GiB/s
BM_string_strlen/64                         1000k         16    3.918 GiB/s
BM_string_strlen/512                          50M         64    7.894 GiB/s
BM_string_strlen/1024                         20M        104    9.815 GiB/s
BM_string_strlen/8Ki                           5M        664   12.337 GiB/s
BM_string_strlen/16Ki                       1000k       1291   12.682 GiB/s
BM_string_strlen/32Ki                       1000k       2940   11.143 GiB/s
BM_string_strlen/64Ki                        500k       6440   10.175 GiB/s

Change-Id: I635bd2798a755256f748b2af19b1a56fb85a40c6
2016-11-28 19:35:12 +00:00
Wei Wang
f1b71da8cf Merge "bionic: make NONBLOCK call to getrandom"
am: 1eb0ecb596

Change-Id: Ia993ead6dc380e517686feb0587d5595b252f3a1
2016-11-24 04:29:29 +00:00
Treehugger Robot
1eb0ecb596 Merge "bionic: make NONBLOCK call to getrandom" 2016-11-24 04:23:01 +00:00
Wei Wang
ae693ad06c bionic: make NONBLOCK call to getrandom
By default getrandom() blocks if the entropy pool has not yet been initialized.
This will be an issue when init was first executed in some kernels.

This CL makes a check of getrandom readyness, by adding the GRND_NONBLOCK flag.
In such case, getrandom() does not block returns -1 with errno set to EAGAIN.

Test: on M/S devices
Bug: 33059407
Change-Id: I2a2ba8372a5e1c336852ba2ab77cdaac03c90389
2016-11-23 15:10:52 -08:00
Yabin Cui
d6e512ec00 Merge "Remove CLONE_NEWNS for gettid and getpid cache tests."
am: d39380cc4d

Change-Id: I1f6da5f7d6717e80c067828241723ba62465d6a6
2016-11-23 18:21:19 +00:00
Yabin Cui
d39380cc4d Merge "Remove CLONE_NEWNS for gettid and getpid cache tests." 2016-11-23 18:15:31 +00:00
Yabin Cui
fb5b9bb3bb Remove CLONE_NEWNS for gettid and getpid cache tests.
Using CLONE_NEWNS flag is not related to the tests, and it make
the tests unavailable in cts tests. So remove the flag.

Bug: http://b/33089743
Test: run CtsBionicTestCases --gtest_filter=unistd*.
Change-Id: I4bda39c6a0c41c9973d275202a3a7f7a1e9bbba3
2016-11-22 17:21:27 -08:00
Dimitry Ivanov
57642e54be Merge "Log call to elf-constructors"
am: 0dafdd4306

Change-Id: I321192705d99952bc9318e33069ab92742c275e3
2016-11-22 01:41:11 +00:00
Treehugger Robot
0dafdd4306 Merge "Log call to elf-constructors" 2016-11-22 01:27:24 +00:00
Josh Gao
0cd3126647 Merge "versioner: extract strict warnings out of -v into its own flag."
am: 9f9200c2ee

Change-Id: I11126bf948c71cce3c0cd08ddeec1fe1b94570fd
2016-11-22 00:56:22 +00:00
Josh Gao
240aeb0f95 versioner: extract strict warnings out of -v into its own flag.
am: acc3d80edf

Change-Id: I2bfed6bfb316cda894edec3b944c3440c5fb49c3
2016-11-22 00:56:21 +00:00
Josh Gao
29f96ed48d Merge "versioner: use a single work queue."
am: 2796894c98

Change-Id: I32ff5aa349d22586e3938896c962870e06efe2a6
2016-11-22 00:56:08 +00:00
Josh Gao
9f9200c2ee Merge "versioner: extract strict warnings out of -v into its own flag." 2016-11-22 00:51:14 +00:00
Josh Gao
2796894c98 Merge "versioner: use a single work queue." 2016-11-22 00:50:59 +00:00
Dimitry Ivanov
ae4a0c186f Log call to elf-constructors
Log call to constructors when dlopen logging is enabled.

Bug: http://b/29458203
Test: bionic-unit-tests --gtest_filter=dl*:Dl*
Change-Id: I0cd591bf147f8f910ae9def1ac4089ef44099aff
2016-11-21 12:32:08 -08:00
Elliott Hughes
fc8e688c32 Implement <langinfo.h>.
POSIX locale only, as usual.

The GNU YESSTR and NOSTR extensions return the empty string in the C locale,
so I haven't bothered supporting them.

Bug: http://b/1401872
Test: bionic tests
Change-Id: I6846839e4f9f1812344ed5dce0b93f83c0c20eb3
2016-11-19 11:46:54 -08:00
Elliott Hughes
78991b1f68 Merge "Document more dynamic linker changes."
am: 5fabe02757

Change-Id: I706fa3635c31b8520fcb4ba57245de0b4d926d33
2016-11-19 00:55:03 +00:00
Treehugger Robot
5fabe02757 Merge "Document more dynamic linker changes." 2016-11-19 00:49:39 +00:00
Elliott Hughes
1777aafa20 Document more dynamic linker changes.
Based on https://plus.google.com/+ElliottHughes/posts/dtguP8BWkc7?sfc=false.

Bug: http://b/33001640
Change-Id: I9efedaf1c17a38d4426f030dd252446e4dfbc1cb
2016-11-18 14:57:38 -08:00
Christopher Ferris
2b1150ee30 Merge "Enable malloc debug using environment variables"
am: c2395be74a

Change-Id: I9d9cfebc646895aaf49fdcffd20ac3ddb098deba
2016-11-18 21:39:17 +00:00
Christopher Ferris
c2395be74a Merge "Enable malloc debug using environment variables" 2016-11-18 21:33:18 +00:00
Josh Gao
7015e90e35 Merge "Add note about pid_max to host test documentation."
am: a7e74f09b8

Change-Id: I2d000a8bfc7b697a50bd5f268b32d8c2d3380d85
2016-11-18 02:59:28 +00:00
Josh Gao
a7e74f09b8 Merge "Add note about pid_max to host test documentation." 2016-11-18 02:55:32 +00:00
Josh Gao
6cd1c92dc9 Add note about pid_max to host test documentation.
Bug: none
Test: none
Change-Id: I3e446744076131329201543fa29b71fc4f843728
2016-11-17 18:52:09 -08:00
Josh Gao
acc3d80edf versioner: extract strict warnings out of -v into its own flag.
Bug: None
Test: versioner -v; versioner -s
Change-Id: I8f6ac7064c6f05de0811677f7fcfce929a2568c1
2016-11-17 18:12:21 -08:00
Josh Gao
338cf12963 versioner: use a single work queue.
Previously, each thread was assigned a fixed list of work, and the main
thread would block until every thread was finished, leading to most
cores sitting idle for the last few hundred milliseconds while a few
particularly long running threads would keep working. Use a single work
queue to evenly distribute load across the threads.

Bug: http://b/32748936
Test: python run_tests.py
Change-Id: I80e231ece3b95e2721a32f658905841b89a8dc3b
2016-11-17 18:11:57 -08:00
Josh Gao
7214cd61d6 Merge "versioner: ignore non-header files."
am: 348eaa6480

Change-Id: I8654cb3532cb23f5a1280fc84e11f483d23481a8
2016-11-18 02:09:53 +00:00
Treehugger Robot
348eaa6480 Merge "versioner: ignore non-header files." 2016-11-18 02:04:24 +00:00
Dimitry Ivanov
c4786906f8 Merge "Improve dlerror_concurrent test"
am: ada292531e

Change-Id: I7f33d654dafc319305edabf44b6bc43b3aa6eb6b
2016-11-18 00:27:43 +00:00
Treehugger Robot
ada292531e Merge "Improve dlerror_concurrent test" 2016-11-18 00:07:42 +00:00
Dimitry Ivanov
c7365eb2fa Improve dlerror_concurrent test
Add a test to check if result is thread-local, not only buffer.

Test: run bionic-unit-tests
Change-Id: Ia95f88c0d76aa86f7f439836393abd67a57dd396
2016-11-17 14:23:24 -08:00
Tamas Berghammer
ac81fe8657 Enable malloc debug using environment variables
Previously malloc debug can be enabled only using global settings
accessible to the root user only. This CL adds a new option to enable
it using environment variables making it possible to use it with pure
native (shell) applications on production builds (from shell user) and
prepares it for using it from logwrapper on production devices.

Remove the old environment variable and property since they are not
necessary.

Test: Enable malloc debug using environment variable and verify
Test: that it only affects the commands launched from the shell.
Test: Enable malloc debug using the property variable and verify
Test: that it affects all commands.
Test: Run all unit tests in 32 bit and 64 bit.
Change-Id: Iecb75a3471552f619f196ad550c5f41fcd9ce8e5
2016-11-17 13:13:27 -08:00
Christopher Ferris
fffb63fe90 Merge "Fix iswlower/iswupper."
am: a5c16983a6

Change-Id: I9e00bcfdb4365f7a4438570181deead6e371df12
2016-11-17 20:14:21 +00:00
Christopher Ferris
a5c16983a6 Merge "Fix iswlower/iswupper." 2016-11-17 20:06:05 +00:00
Dimitry Ivanov
14420fc56c Merge "Relax ELF header checks - warn for apps targeting pre-O"
am: 3613c20c59

Change-Id: Ib5757e7b2821529f02e1fc972a42cd86f202974d
2016-11-17 05:30:26 +00:00
Dimitry Ivanov
3613c20c59 Merge "Relax ELF header checks - warn for apps targeting pre-O" 2016-11-17 05:21:42 +00:00
Dimitry Ivanov
da826583c8 Merge "Remove unused includes/externals"
am: 585838ba32

Change-Id: I2d7496310bd64822a90f9cb3dca2ba27ce24b00e
2016-11-17 02:58:18 +00:00
Treehugger Robot
585838ba32 Merge "Remove unused includes/externals" 2016-11-17 02:48:41 +00:00
Elliott Hughes
aee547dbef Merge "Add and use constants for the Android API levels."
am: 60ba60dd25

Change-Id: I83b38008d8ba734b303cae6b270534ee11afebe6
2016-11-17 02:43:18 +00:00
Dimitry Ivanov
12b918743d Relax ELF header checks - warn for apps targeting pre-O
Bug: http://b/32581440
Test: bionic-unit-tests --gtest_filter=dl*:Dl*
Change-Id: I2fe356c67eb9665c671758117679a29b207219e4
2016-11-16 18:43:06 -08:00
Treehugger Robot
60ba60dd25 Merge "Add and use constants for the Android API levels." 2016-11-17 02:37:37 +00:00
Dimitry Ivanov
05d1ada098 Merge "Add original prebuilt test libraries"
am: 2880754368

Change-Id: I80a1c62d81baf96256d8901059026f8b18ea13fc
2016-11-17 01:04:40 +00:00
Josh Gao
3091f5a06e versioner: ignore non-header files.
Don't try to compile non-headers (vim swap files, etc.) that happen to
be in the header directory.

Bug: none
Test: manually created a file in libc/include
Change-Id: I2c1647ec7174dc617898dc2f07c9a80a08b69c72
2016-11-16 17:01:57 -08:00
Elliott Hughes
5bc78c8bcd Add and use constants for the Android API levels.
Test: bionic tests still pass
Change-Id: If1b619cfc9db1d3f5d91f14f2ace71058dca0c4a
2016-11-16 16:55:42 -08:00
Dimitry Ivanov
2880754368 Merge "Add original prebuilt test libraries" 2016-11-17 00:52:41 +00:00
Dimitry Ivanov
ffa45a8682 Remove unused includes/externals
Test: mm
Change-Id: I4b88602b7d0a18664cbeddfa9854e589c2886e1a
2016-11-16 15:23:37 -08:00
Elliott Hughes
f76a21a185 Fix iswlower/iswupper.
The previous conditions were just plain wrong.

Test: bionic tests
Change-Id: Ia6d98207b1ff98ea4c6f619912e4bcdb8a7fdd24
2016-11-16 15:19:08 -08:00
Dimitry Ivanov
416158db60 Add original prebuilt test libraries
This is the library used to produce invalid prebuilt libraries
for loader tests.

Bug: http://b/30795430
Test: not necessary - these are added for reference
Change-Id: I06e681bf826e59a76da9b49d84d26dee34920d49
2016-11-16 14:02:49 -08:00