Commit graph

25353 commits

Author SHA1 Message Date
Adhemerval Zanella
7871ca1075 Add sinf/cosf/sincosf benchmark
Similar to expf/exp2f, this patch add two benchmarks for sinf, cosf, and
sincosf: one which measures thoughput as default and one which measures
latency.

The input in 512 random value divided in 8 ranges:

  1. 0.0 <= x < 0.1
  2. 0.1 <= x < 0.7
  3. 0.7 <= x < 3.1
  4. -3.1 <= x < 3.1
  5. 3.3 <= x < 33.3
  6. 100.0 <= x < 1000.0
  7. 1e6 <= x < 1e32
  8. 1e32 < x < FLT_MAX

Test: ran 32-bit and 64-bit x86 tests on host
Change-Id: I92bc2f1fac911c573c5122911d08ca590311578a
2018-06-19 11:34:54 -03:00
Adhemerval Zanella
ff5a353112 Add logf and log2f benchmark
Similar to expf/exp2f, this patch add two benchmarks for logf and log2f:
one which measures thoughput and one which measures latency.

The input data is based on a reduced trace based on 2.8 billion samples
extracted from specpu2017 521.wrf_r benchmark.

Test: ran 32-bit and 64-bit x86 tests on host
Change-Id: If4fbd7eb3d40f8e155935149a82f162b222d5506
2018-06-19 11:34:54 -03:00
Adhemerval Zanella
872c8b5133 Add powf benchmark
As for expf/exp2f benchmark, this patch add two benchmark for powf:
one which measures thoughput and one which measures latency.

The input data is based on a reduced trace from 2.3 billion samples
extracted from specpu2017 521.wrf_r benchmark.

Test: ran 32-bit and 64-bit x86 tests on host
Change-Id: Id8943d90dd5452146e55fb75708daaf7bf0e25fa
2018-06-19 11:34:54 -03:00
Adhemerval Zanella
357f6c1b47 Add expf and exp2f benchmark
This patch add two benchmarks for both expf and exp2f, one which
measures thoughput, as default, and one which measures latency. The
latency benchmark works by creating a dependency on the previous
iteration and with a zero multiply to avoid changing the input value.

The input is based on a reduced trace based on 2.4 billion samples
extracted from specpu2017 521.wrf_r benchmark.

Test: ran 32-bit and 64-bit x86 tests on host
Change-Id: Ic0d40cc4977dd6875fb7431146fc38ea0e6e0bc2
2018-06-19 11:34:54 -03:00
Christopher Ferris
520ad0cae8 Merge "Change heap dump format slightly." 2018-06-15 21:36:42 +00:00
Christopher Ferris
2e1a40a203 Change heap dump format slightly.
Bump the version from v1.1 to v1.2 and add a build fingerprint line.

Update the heap dump documentation to match the new format and reflect
what made it in P and what made it in Q.

Update the unit tests for this change.

Add -O0 to unit test code to make it easier to debug.

Add an external function that can be used by the framework code
so that there is only one way to dump the heap.

Bug: 110095681

Test: Ran unit tests.
Test: Did a dump of a real process and verified fingerprint.
Test: Did a dump of a process without malloc debug enabled.
Change-Id: I769a476cbeaf4c85c5d75bd6d6385f0e3add948c
Merged-In: I769a476cbeaf4c85c5d75bd6d6385f0e3add948c
(cherry picked from commit c84a2a2601)
2018-06-15 12:29:13 -07:00
Treehugger Robot
2583b0adb2 Merge changes from topic "sharedlib_in_recovery"
* changes:
  dynamic linker is running for init
  Build recovery variant of the dynamic linker
2018-06-13 23:14:29 +00:00
Treehugger Robot
79d8ecb9fb Merge "Remove valgrind workarounds." 2018-06-13 00:30:28 +00:00
Elliott Hughes
95bca3f7d4 Remove valgrind workarounds.
Bug: http://b/77856586
Test: ran 32-bit x86 tests on host
Change-Id: I98f6262bb1363ed5c8dd533b1f89b59b2b188525
2018-06-12 15:29:36 -07:00
Haibo Huang
2bf96b73bb Merge "Make memcpy memmove" 2018-06-12 18:09:36 +00:00
Haibo Huang
8a0f0ed5e7 Make memcpy memmove
Bug: http://b/63992911
Test: Change BoardConfig.mk and compile for each variant
Change-Id: Ia0cc68d8e90e3316ddb2e9ff1555a009b6a0c5be
2018-06-11 18:12:45 +00:00
Jiyong Park
31cd08f9eb dynamic linker is running for init
init is now built as a dynamic executable, so the dynamic linker has to
be able to run in the init process. However, since init is launched so
early, even /dev/* and /proc/* file systems are not mounted and thus
some APIs that rely on the paths do not work. The dynamic linker now
goes alternative path when it is running in the init process.

For example, /proc/self/exe is not read for the init since we always now
the path of the init (/init). Also, arc4random* APIs are not used since
the APIs rely on /dev/urandom. Linker now does not randomize library
loading order and addresses when running in the init process.

Bug: 80454183
Test: `adb reboot recovery; adb devices` shows the device ID
Change-Id: I29b6d70e4df5f7f690876126d5fe81258c1d3115
2018-06-08 14:50:14 +09:00
Jiyong Park
8d7866c58f Build recovery variant of the dynamic linker
In order to support shared libraries in the recovery mode, the dynamic
linker is now built with recovery_available: true option.

In addition, a few more modules (such as libasync, etc.) are also marked
as recovery_available: true as they are transitive dependencies of the
dynamic linker.

Bug: 63673171
Test: `adb reboot recovery; adb devices` shows the device ID
Test: `adb root && adb shell` and then
$ lsof -p `pidof adbd` shows that libm.so, libc.so, etc. are loaded from
the /lib directory.

Change-Id: Idd981d8cf25568a85b24032cf78e50adfd5f4a7f
2018-06-08 14:49:56 +09:00
Treehugger Robot
42596b7bf0 Merge "Add missing __INTRODUCED_IN to pthread_attr_setinheritsched/pthread_attr_getinheritsched." 2018-06-07 18:15:41 +00:00
Elliott Hughes
7c5bbf627c Add missing __INTRODUCED_IN to pthread_attr_setinheritsched/pthread_attr_getinheritsched.
Bug: https://github.com/android-ndk/ndk/issues/716
Test: N/A
Change-Id: Ie49f96976f93b0f0d59796169e98918a9f69c0df
2018-06-07 09:11:47 -07:00
Dimitry Ivanov
3bc5e74c54 Merge "Relax check on number of segments in a .so file" 2018-06-06 16:07:53 +00:00
dimitry
3b0a5b7347 Relax check on number of segments in a .so file
This check was not necessary since it is perfectly fine for a dso to
have any number of PT_LOAD segments, given that the number is > 0.

Bug: http://b/109747297
Test: make
Change-Id: I0e3b400fddf05ed7b9342bacbfffd3b578f26cf3
2018-06-06 11:22:20 +02:00
Christopher Ferris
910c11767f Merge "Add an example of how to use multiple options." 2018-06-05 19:22:47 +00:00
Christopher Ferris
1d52a7b1be Add an example of how to use multiple options.
Test: NA
Change-Id: I67b6c2f8eb8ad8ead98969e69990f540ecd9a770
2018-06-01 13:42:25 -07:00
Treehugger Robot
5b867699fd Merge "Avoid post-reloc GOT usage in __linker_init" 2018-06-01 03:50:36 +00:00
Ryan Prichard
742982d3a0 Avoid post-reloc GOT usage in __linker_init
A GOT lookup happening prior to soinfo::link_image causes a segfault. With
-O0, the compiler moves GOT lookups from after __linker_init's link_image
call to the start of __linker_init.

Rename the existing __linker_init_post_relocation to linker_main, then
extract the existing post-link_image code to a new
__linker_init_post_relocation function.

Bug: http://b/80503879
Test: /data/nativetest64/bionic-unit-tests/bionic-unit-tests
Test: manual
Change-Id: If8a470f8360acbe35e2a308b0fbff570de6131cf
2018-05-31 17:04:52 -07:00
Treehugger Robot
fe55c272ad Merge "Initialize __libc_sysinfo early on." 2018-05-31 22:32:32 +00:00
Treehugger Robot
30144561a4 Merge "Fix name of env variable in malloc_hooks README." 2018-05-31 18:17:40 +00:00
Florian Mayer
14e54c0d30 Fix name of env variable in malloc_hooks README.
Change-Id: I172ef71c9d74ec6e4bc51fe2bd8e4587b801b71c
2018-05-31 17:36:24 +01:00
Treehugger Robot
6ef8415d09 Merge "Inline __libc_init_global_stack_chk_guard." 2018-05-31 02:22:06 +00:00
Treehugger Robot
8b14ed45ec Merge "Clean up TLS_SLOT_BIONIC_PREINIT usage a bit" 2018-05-31 01:45:41 +00:00
Ryan Prichard
27475b5105 Initialize __libc_sysinfo early on.
__libc_sysinfo is hidden, so accessing it doesn't require a relocated GOT.
It is important not to have a relocatable initializer on __libc_sysinfo,
because if it did have one, and if we initialized it before relocating the
linker, then on 32-bit x86 (which uses REL rather than RELA), the
relocation step would calculate the wrong addend and overwrite
__libc_sysinfo with garbage.

Asides:

 * It'd be simpler to keep the __libc_sysinfo initializer for static
   executables, but the loader pulls in libc_init_static (even though it
   uses almost none of the code in that file, like __libc_init).

 * The loader has called __libc_init_sysinfo three times by the time it
   has relocated itself. A static executable calls it twice, while libc.so
   calls it only once.

Bug: none
Test: lunch aosp_x86-userdebug ; emulator
Test: adb shell /data/nativetest/bionic-unit-tests/bionic-unit-tests
Test: adb shell /data/nativetest/bionic-unit-tests-static/bionic-unit-tests-static
Change-Id: I5944f57847db7191608f4f83dde22b49e279e6cb
2018-05-30 16:44:23 -07:00
Ryan Prichard
cb5f410006 Inline __libc_init_global_stack_chk_guard.
Prior to b6453c52ac, this function
was called from two C++ files.

Test: boot hikey
Change-Id: Ieeae6ea617c5b19e2cd76c1b37c9511a72d01597
2018-05-30 16:10:35 -07:00
Ryan Prichard
6631f9b03d Clean up TLS_SLOT_BIONIC_PREINIT usage a bit
- It is only needed for dynamic executables, so move the initialization
   out of __libc_init_main_thread and just before the solib constructor
   calls. For static executables, the slot was initialized, then never
   used or cleared. Instead, leave it clear.

 - For static executables, __libc_init_main_thread already initialized the
   stack guard, so remove the redundant __init_thread_stack_guard call.

 - Simplify the slot access/clearing a bit in __libc_preinit.

 - Remove the "__libc_init_common() will change the TLS area so the old one
   won't be accessible anyway." comment. AFAICT, it's incorrect -- the
   main thread's TLS area in a dynamic executable is initialized to a
   static pthread_internal_t object in the linker, then reused by libc.so.

Test: adb shell /data/nativetest/bionic-unit-tests/bionic-unit-tests
Test: adb shell /data/nativetest/bionic-unit-tests-static/bionic-unit-tests-static
Change-Id: Ie2da6f5be3ad563fa65b38eaadf8ba6ecc6a64b6
2018-05-30 15:43:43 -07:00
Haibo Huang
d0c330b5d8 Merge "Use cortex-a53/bionic/memmove.S by default for arm64" 2018-05-30 22:26:57 +00:00
Haibo Huang
ece43e14c9 Use cortex-a53/bionic/memmove.S by default for arm64
cortex-a53/bionic/memmove.S looks like a more optimized version. It
should be used in most cases. It delegates small (<= 96 bytes) moves
to memcpy.

The only exception is denver64. It is using its own memcpy, which
doesn't allow overlap for < 96 bytes copies. Only for this variant we
need generic/bionic/memmove.S.

Benchmark result looks pretty close through (on marlin)

Before: using generic/bionic/memmove.S

-------------------------------------------------------------------
Benchmark                            Time           CPU Iterations
-------------------------------------------------------------------
BM_string_memcpy/8/0/0               6 ns          6 ns  108872005   1.15787GB/s
BM_string_memcpy/64/0/0              7 ns          7 ns  107387438   9.14365GB/s
BM_string_memcpy/512/0/0            21 ns         20 ns   34165353   23.2734GB/s
BM_string_memcpy/1024/0/0           40 ns         39 ns   17766657   24.2346GB/s
BM_string_memcpy/8192/0/0          311 ns        310 ns    2259904   24.6339GB/s
BM_string_memcpy/16384/0/0         616 ns        613 ns    1143027   24.8852GB/s
BM_string_memcpy/32768/0/0        1322 ns       1316 ns     530799   23.1835GB/s
BM_string_memcpy/65536/0/0        2672 ns       2661 ns     229638    22.937GB/s
BM_string_memcpy/131072/0/0       5379 ns       5357 ns     128316    22.788GB/s

After: using cortex-a53/bionic/memmove.S

-------------------------------------------------------------------
Benchmark                            Time           CPU Iterations
-------------------------------------------------------------------
BM_string_memcpy/8/0/0               6 ns          6 ns  116610749   1.24646GB/s
BM_string_memcpy/64/0/0              6 ns          6 ns  115634093   9.84708GB/s
BM_string_memcpy/512/0/0            21 ns         21 ns   34167322   22.8938GB/s
BM_string_memcpy/1024/0/0           39 ns         39 ns   17859445   24.3312GB/s
BM_string_memcpy/8192/0/0          311 ns        310 ns    2260192   24.6325GB/s
BM_string_memcpy/16384/0/0         610 ns        608 ns    1151889   25.0987GB/s
BM_string_memcpy/32768/0/0        1488 ns       1482 ns     532508   20.5988GB/s
BM_string_memcpy/65536/0/0        2421 ns       2411 ns     290502   25.3146GB/s
BM_string_memcpy/131072/0/0       5278 ns       5256 ns     132710   23.2234GB/s

Test: Build and benchmark on marlin
Bug: http://b/63992911
Change-Id: Id85961aca18ba841bcbcfe0d8b162843eab30584
2018-05-30 11:09:19 -07:00
Dimitry Ivanov
aa922bbaf3 Merge "Add secondary counter in place of tls_nodelete flag" 2018-05-30 15:32:40 +00:00
dimitry
55547db434 Add secondary counter in place of tls_nodelete flag
The tls_nodelete state should apply to load_group not
isolated soinfo. This actually also means that multiple
soinfos may have tls_counter on their dso_handles.

This change replaces TLS_NODELETE flag with secondary counter.
Note that access to the secondary counter (located inside soinfo)
is pretty expensive because it requires soinfo lookup by dso_handle
whereas dso_handle counter is much faster. This is why it is updated
only when dso_handle counter starts or hits 0.

Bug: http://b/80278285
Test: bionic-unit-tests --gtest_filter=dl*
Change-Id: I535583f6714e45fa2a7eaf7bb3126da20ee7cba9
2018-05-30 10:56:59 +02:00
Dimitry Ivanov
d980cc0c51 Merge "Remove libskia.so from the greylist" 2018-05-30 08:28:15 +00:00
Elliott Hughes
d7cabc96ae Merge "Fix the map for pthread_cond_timedwait_monotonic_np." 2018-05-30 00:24:46 +00:00
Elliott Hughes
12306f0aa0 Fix the map for pthread_cond_timedwait_monotonic_np.
Bug: https://github.com/android-ndk/ndk/issues/708
Test: builds
Change-Id: Icaa1f8cb796a0a117cbe2e10391c965c857d6d37
2018-05-29 13:12:21 -07:00
Christopher Ferris
d566b93091 Merge "Point to online documentation." 2018-05-29 17:57:10 +00:00
Tom Cherry
28567aeb26 Merge "Test that vendor AID names begin with vendor_" 2018-05-29 17:56:26 +00:00
Christopher Ferris
770cbb35cf Point to online documentation.
Test: Unit tests pass.
Change-Id: Ibbdc260bfdf6a6daf091c4a49cdf03e51f6ca6cf
2018-05-25 13:28:05 -07:00
dimitry
6e6772dcb2 Remove libskia.so from the greylist
The library is no longer available on the devices.

Bug: http://b/31971097
Test: make
Change-Id: Ie87bb8a8c200d086d272ca923242bfbab6397126
2018-05-25 10:37:49 +02:00
Treehugger Robot
8aa6d67f2d Merge "Link to native_heapdump_viewer.py." 2018-05-25 06:04:06 +00:00
Treehugger Robot
a3c7fe5417 Merge "Reenable __work_around_b_24465209__ for x86 linker" 2018-05-25 05:06:18 +00:00
Ryan Prichard
7046f391d1 Reenable __work_around_b_24465209__ for x86 linker
Bug: b/80258696
Test: build aosp_x86-userdebug ; run emulator
Change-Id: If7de24c3fc91a143c0bd17c6364c56ec04dfb08e
(cherry picked from commit dac8340c43)
2018-05-24 20:14:56 -07:00
Elliott Hughes
149671875d Link to native_heapdump_viewer.py.
Bug: N/A
Test: N/A
Change-Id: I1e448f30922d948513ebb65abc25c474ffbd5a24
2018-05-24 18:44:31 -07:00
Elliott Hughes
ebf58a6cef Merge "Add generic arm non-neon memmove." 2018-05-24 23:53:36 +00:00
Christopher Ferris
7caf313168 Merge "Modify the script to use the linux source tree." 2018-05-24 23:50:07 +00:00
Treehugger Robot
b2341cdfe3 Merge "Adapt to versioned_ndk_headers renaming." 2018-05-24 23:47:56 +00:00
Christopher Ferris
764049dce4 Modify the script to use the linux source tree.
The current code checks out the android kernel tree. Long ago, we moved
to using the linux kernel source code. Modify the script to actually
do this.

Bug: 6653610

Test: Ran the script using the --download_kernel option and without.
Change-Id: I769e769edea272f4f8c9c8d2e76bd336059c66e3
2018-05-24 15:10:33 -07:00
Elliott Hughes
da46caee09 Add generic arm non-neon memmove.
From OpenBSD.

Bug: http://b/63992911
Test: ran tests
Change-Id: If7d9166922776cdc9333ff04205f9c6312a812b3
2018-05-24 14:57:15 -07:00
Dan Albert
26e1c41f5c Adapt to versioned_ndk_headers renaming.
Test: make checkbuild
Bug: None
Change-Id: I89b931c8519eb4f336fb1a338d6b6518c50bcee1
2018-05-24 14:56:46 -07:00