Commit graph

59622 commits

Author SHA1 Message Date
Elliott Hughes
019c7ae0b9 Avoid zero-initializing our most-used buffers. am: 08929cc389 am: 9d63c3f8c5
Change-Id: I624840f90a1241c6baf8f81234edf9401c4b05d6
2020-04-30 15:41:24 +00:00
Tom Cherry
98a2724fbc logd: disable flaky logd.timeout test
This test is repeatedly seen to be flaky.  Disable it until we can run
tests against a dedicated logd instance.

Bug: 155146087
Test: logd-unit-tests
Merged-In: I0cd953955f613e40d17df73f70543d7d2f0925b6
Change-Id: I0cd953955f613e40d17df73f70543d7d2f0925b6
(cherry picked from commit 25a4d708e2)
2020-04-30 08:39:09 -07:00
Elliott Hughes
9d63c3f8c5 Avoid zero-initializing our most-used buffers. am: 08929cc389
Change-Id: I0674d4880ae0596a9ebf4e448d72eaacaf0ca99e
2020-04-30 15:25:56 +00:00
Kyle Lin
106d6fe775 rootdir: init.rc: mount tracefs
Bug: 153849221
Test: build and try to capture the trace by perfetto and systrace
Change-Id: Ie8a13e12038bd66afcd264079a2c5f25daaa20ee
Merged-In: Ie8a13e12038bd66afcd264079a2c5f25daaa20ee
(cherry picked from commit 9d19a05422)
2020-04-30 22:04:37 +08:00
Elliott Hughes
08929cc389 Avoid zero-initializing our most-used buffers.
The StringPrintf one is heavily used and brings the overhead versus
fmtlib down to 1.5x rather than 2x. I don't have a convenient benchmark
for the other two.

Test: libbase tests & benchmarks
Bug: http://b/155324241
Change-Id: I9e704a360846d5520c53f668e7c315b0c0ea55f8
(cherry picked from commit 8c253d4d42)
2020-04-29 16:49:13 -07:00
Jeffrey Huang
df5f2781a6 Merge "Add test for AStatsSocket_close()" into rvc-dev am: 053ade4320 am: c57b3a654c am: 16ffdd9721
Change-Id: I7b96f42ce8fafe63a42e6e49acbb6a26959a1f05
2020-04-29 19:28:38 +00:00
Jeffrey Huang
16ffdd9721 Merge "Add test for AStatsSocket_close()" into rvc-dev am: 053ade4320 am: c57b3a654c
Change-Id: I1580f3d8e44eb65a408ae1a08e0fa71bd7497311
2020-04-29 19:15:03 +00:00
Jeffrey Huang
c57b3a654c Merge "Add test for AStatsSocket_close()" into rvc-dev am: 053ade4320
Change-Id: I562ba4b9bffb459b204839452e4f07eff5031256
2020-04-29 18:58:39 +00:00
Tom Cherry
0ce45f8a98 Merge "liblog: remove Rwlocks for logd_socket and pmsg_fd" into rvc-dev am: 03ead14288 am: 178a714b88 am: a42ea365b1
Change-Id: Id317c7b0ea6d8bd762ac2854f5847b9dc69bcf76
2020-04-29 18:48:52 +00:00
Tom Cherry
0afef6921c init: fix restarting of subcontext am: e70c28bdad am: 18603dab4e am: 497026f429
Change-Id: I344d2c15543d75d00e58e069817a2c0a483df952
2020-04-29 18:47:46 +00:00
Jeffrey Huang
053ade4320 Merge "Add test for AStatsSocket_close()" into rvc-dev 2020-04-29 18:46:26 +00:00
Tom Cherry
a42ea365b1 Merge "liblog: remove Rwlocks for logd_socket and pmsg_fd" into rvc-dev am: 03ead14288 am: 178a714b88
Change-Id: Id520589867b2d74a515fdaadeb9f15da9f3e1b74
2020-04-29 18:35:36 +00:00
Tom Cherry
497026f429 init: fix restarting of subcontext am: e70c28bdad am: 18603dab4e
Change-Id: If6e4797c331d7a5a625a6d13c28c46626f89dd86
2020-04-29 18:34:28 +00:00
Tom Cherry
178a714b88 Merge "liblog: remove Rwlocks for logd_socket and pmsg_fd" into rvc-dev am: 03ead14288
Change-Id: I77df9c4c1f4d5bbf34f4e96d42ebb9343ef446c5
2020-04-29 17:48:38 +00:00
Tom Cherry
18603dab4e init: fix restarting of subcontext am: e70c28bdad
Change-Id: I50ca8c3852473b666909603e9b3471fd237f00b5
2020-04-29 17:48:23 +00:00
Tom Cherry
03ead14288 Merge "liblog: remove Rwlocks for logd_socket and pmsg_fd" into rvc-dev 2020-04-29 17:46:59 +00:00
Tom Cherry
561c8a9aa6 Merge "base: reimagine line splitting in logger.cpp" into rvc-dev am: 806c0206b8 am: 711bf7d7d4 am: 9bc3bb9667
Change-Id: Ib1698eed00d958142461bc8702be7dc086c18ad7
2020-04-29 15:58:27 +00:00
Tom Cherry
e70c28bdad init: fix restarting of subcontext
When the subcontext code was redone to allow only one subcontext
(vendor_init), the code for restarting it and for terminating it
during shutdown was not updated, resulting in it not working.

Bug: 155203339
Test: kill subcontext init and notice it restart
Test: subcontext init stops during shutdown
Merged-In: Ib77f59d1e7be0ffcfd3f31c8450dc022c20bb322
Change-Id: Ib77f59d1e7be0ffcfd3f31c8450dc022c20bb322
(cherry picked from commit e3e77d382f)
2020-04-29 08:41:21 -07:00
Tom Cherry
9bc3bb9667 Merge "base: reimagine line splitting in logger.cpp" into rvc-dev am: 806c0206b8 am: 711bf7d7d4
Change-Id: Icb82afa84aae92519d3dc658f53fe1797924d7b3
2020-04-29 15:40:49 +00:00
Tom Cherry
61910f123f liblog: remove Rwlocks for logd_socket and pmsg_fd
These historically used atomics to manage their lifetime.  They were
unfortunately unsafe and later replace with a RwLock.  A lock is
also problematic as it is too heavy weight for the typical use case
and implies that logging is neither async nor fork safe.

This change returns us to using atomics with two key changes:
1) compare_exchange_strong() is used instead of atomic_exchange().
   The latter has a race condition where a separate thread could have
   read the atomic value into a register, while the thread performing
   the atomic_exchange closes that FD.  The new code only changes the
   FD in the atomic if it is uninitialized.
2) Using the fact that DGRAM sockets can have connect() called on them
   multiple times, it uses a single logd_socket for the duration of
   the program.

These sockets are thread/async/fork safely created and accessed.

The one caveat is __android_log_close(), which is intended only to be
used by zygote when it is single threaded and is therefore not thread
safe.  It will close this socket and reset the underlying variable,
such that the next log message will go through the above
initialization.

Bug: 65062446
Test: logging works, logging unit tests
Test: new unit test
Merged-In: Ia4dbf7479dbe50683d124558ab2f83bff53b8f5f
Change-Id: Ia4dbf7479dbe50683d124558ab2f83bff53b8f5f
(cherry picked from commit 7acfba274c)
2020-04-29 08:39:26 -07:00
Tom Cherry
711bf7d7d4 Merge "base: reimagine line splitting in logger.cpp" into rvc-dev am: 806c0206b8
Change-Id: I145322010f5de413eba5aa9086cffae0a5f0e96a
2020-04-29 15:24:52 +00:00
Tom Cherry
806c0206b8 Merge "base: reimagine line splitting in logger.cpp" into rvc-dev 2020-04-29 15:05:36 +00:00
Jiyong Park
a2606921b2 Set apex_available property
The marked library(ies) were available to the APEXes via the
hand-written whitelist in build/soong/apex/apex.go. Trying to remove the
whitelist by adding apex_available property to the Android.bp of the
libraries.

Bug: 150999716
Test: m
Change-Id: I54db09314c7236a227f04281a439c1d5dc56ef2c
2020-04-29 17:01:15 +09:00
android-build-team Robot
7bdcb68d81 Snap for 6441286 from 58f584cb6d to mainline-release
Change-Id: Ic5f3169676ca666aba341c16e3be85bc068d8f2e
2020-04-29 07:12:54 +00:00
TreeHugger Robot
7be560ad61 Merge "libbase/liblog: set min_sdk_version" into rvc-dev am: 8d24215d33 am: 00ff629944 am: 777fba3823
Change-Id: I6d693748004545f65c68ae472cf24c2e0b564cf8
2020-04-29 06:20:19 +00:00
TreeHugger Robot
777fba3823 Merge "libbase/liblog: set min_sdk_version" into rvc-dev am: 8d24215d33 am: 00ff629944
Change-Id: Ib289c89f541ba04dfdeb3e9c5ab35f2a8874dc0b
2020-04-29 06:07:00 +00:00
TreeHugger Robot
00ff629944 Merge "libbase/liblog: set min_sdk_version" into rvc-dev am: 8d24215d33
Change-Id: Ibb1a65c661643887b7fd6a971a63f0ee33c0d10b
2020-04-29 05:54:41 +00:00
TreeHugger Robot
8d24215d33 Merge "libbase/liblog: set min_sdk_version" into rvc-dev 2020-04-29 05:45:30 +00:00
TreeHugger Robot
58f584cb6d Merge "Moves some shared_libs to static_libs for vts_libsnapshot_test." into rvc-dev am: 1e8f30f919 am: 30dbf609ab am: e1f9a877fa
Change-Id: Ia9ab71a182920b41da3fafcc28e691dd23343e69
2020-04-28 23:54:15 +00:00
TreeHugger Robot
e1f9a877fa Merge "Moves some shared_libs to static_libs for vts_libsnapshot_test." into rvc-dev am: 1e8f30f919 am: 30dbf609ab
Change-Id: Ie5d84957ff2bacfdbd8bbdd27b7621569c25bea7
2020-04-28 23:41:22 +00:00
TreeHugger Robot
30dbf609ab Merge "Moves some shared_libs to static_libs for vts_libsnapshot_test." into rvc-dev am: 1e8f30f919
Change-Id: I72bf111417defab141970cb158024da0425dae8e
2020-04-28 23:24:24 +00:00
TreeHugger Robot
1e8f30f919 Merge "Moves some shared_libs to static_libs for vts_libsnapshot_test." into rvc-dev 2020-04-28 23:14:33 +00:00
David Anderson
6e8ae6d2b2 libfiemap: Ignore userdata requirements in fiemap_writer_test when running a DSU.
The test is guaranteed to fail because userdata is itself a fiemap-backed device.

Bug: 154447105
Test: fiemap_writer_test on DSU
Change-Id: Ied35da0eb7aba3daca7ed430f006bf1e90e21dca
Merged-In: Ied35da0eb7aba3daca7ed430f006bf1e90e21dca
2020-04-28 15:28:39 -07:00
Jeffrey Huang
6cc1d41527 Add test for AStatsSocket_close()
Bug: 154871176
Test: atest libstatssocket_test
Change-Id: If8aa26a9a9a75382b6f8779c23974a7008bd387a
2020-04-28 15:22:28 -07:00
Dan Shi
6dfc126805 Merge "Add vts_processgroup_validate_test to vts suite" into rvc-dev am: 3174b3ae99 am: 3fa82b49e3 am: 43de13223d
Change-Id: Ib62c3eace25832eaf64d97db12d7148d0374d17c
2020-04-28 17:51:39 +00:00
Dan Shi
43de13223d Merge "Add vts_processgroup_validate_test to vts suite" into rvc-dev am: 3174b3ae99 am: 3fa82b49e3
Change-Id: Id25fede54cde1fa6ea0cf6831dffa8ac41b3b598
2020-04-28 17:30:12 +00:00
Dan Shi
3fa82b49e3 Merge "Add vts_processgroup_validate_test to vts suite" into rvc-dev am: 3174b3ae99
Change-Id: I8005d3825726160b880a74c2ed8f189a2d07570a
2020-04-28 17:16:57 +00:00
Dan Shi
3174b3ae99 Merge "Add vts_processgroup_validate_test to vts suite" into rvc-dev 2020-04-28 16:56:06 +00:00
TreeHugger Robot
e020339176 Merge "llkd: Print thread group before panic the kernel" into rvc-dev am: 00e15d9e45 am: f2d94267e9 am: 37a309ec29
Change-Id: I88fda079afbe4a2ec088fe3a5490a550733809a0
2020-04-28 15:57:37 +00:00
TreeHugger Robot
37a309ec29 Merge "llkd: Print thread group before panic the kernel" into rvc-dev am: 00e15d9e45 am: f2d94267e9
Change-Id: Idb09815a866d179bfe31183e888c9014ff6e4531
2020-04-28 15:46:26 +00:00
TreeHugger Robot
f2d94267e9 Merge "llkd: Print thread group before panic the kernel" into rvc-dev am: 00e15d9e45
Change-Id: I98cea1047cdc140490835bcdd68f6551cd1893e1
2020-04-28 15:30:21 +00:00
TreeHugger Robot
00e15d9e45 Merge "llkd: Print thread group before panic the kernel" into rvc-dev 2020-04-28 15:21:10 +00:00
android-build-team Robot
2b995cef9d Snap for 6437181 from bed9ac393e to mainline-release
Change-Id: I549816ccb30e31f115edcd3073e2410fea3f3260
2020-04-28 07:13:04 +00:00
Jooyung Han
0ed04aef4c libbase/liblog: set min_sdk_version
Modules contributing mainline modules (APK/APEX) should set
min_sdk_version as well as apex_available.

For now setting min_sdk_version doesn't change build outputs.
But build-time checks will be added soon.

Bug: 152655956
Test: m
Merged-In: If4ff1fbc31e5be3f5611a4713ae4032aba4ee5f2
Change-Id: If4ff1fbc31e5be3f5611a4713ae4032aba4ee5f2
(cherry picked from commit 3851f7e836)
2020-04-28 10:56:08 +09:00
Tom Cherry
953c0deadb base: reimagine line splitting in logger.cpp
Previously, we would split messages by line and call the logger
function for each line.  We would hold a lock during this, to ensure
that multiple threads would not interleave their messages.

There are a few problems with this approach:
1) Using a lock is not efficient and is not fork safe
2) With APEX, there is one lock per instance of libbase, so we must
   move the lock to a location where all instances can access it, or
   perform the line splitting in a way that does not require the lock.

To solve these issues, we reimagine line splitting.
1) We move the lock out of the LogMessage::~LogMessage() and make it
   the logger's responsibility to split lines, giving the logger the
   option to lock or not.
2) We do not need any locks at all for StderrLogger.
   Instead, we generate a single string that contains all of the lines
   with their appropriate log header.  A single write() call is used
   to output this at once.
3) Logd handles log messages with newlines correctly, however it only
   accepts up to a maximum size of log message.  Therefore we
   separate the incoming log message into chunks, delimited by new
   lines, up to that maximum size, and send each of those to logd.
   Note that this is the strategy used in
   android.util.Log.printlns().
   This should solve a majority of use cases, since the maximum size
   that logd accepts is nearly 4K, while remaining lock free.
   If interleaving messages absolutely must be avoided, a lock can
   still be used given 1) above.

Bug: 65062446
Bug: 153824050
Test: logging, particularly multi-line stack traces, show correctly
Test: existing and new unit tests
Change-Id: Id0cb5669bee7f912da1e17f7010f0ee4c93be1e3
(cherry picked from commit 36d31c530d)
2020-04-27 16:25:27 -07:00
Daniel Norman
f1d37369ed Moves some shared_libs to static_libs for vts_libsnapshot_test.
These shared_libs are missing from /system/lib/ on 64-bit devices.

Test: Build, install, and run 32bit vts_libsnapshot_test.
Bug: 154115505
Change-Id: Iaf2014748546a055d35e4fe0e24969eef13db7fa
2020-04-27 15:40:38 -07:00
Dan Shi
20ba98c1a7 Add vts_processgroup_validate_test to vts suite
Bug: 154727600
Test: atest vts_processgroup_validate_test
Change-Id: I53bd4f9fd097878deaa77159feb2d48f66c464d1
2020-04-27 13:34:20 -07:00
TreeHugger Robot
bed9ac393e Merge "Convert vts configs to Android.bp" into rvc-dev am: 19685064b9 am: 66623c0132 am: eb047fdc33
Change-Id: I5f399c30cdc83174cedc2df76522938f96b343bf
2020-04-27 17:39:00 +00:00
TreeHugger Robot
eb047fdc33 Merge "Convert vts configs to Android.bp" into rvc-dev am: 19685064b9 am: 66623c0132
Change-Id: I992ff8c609b4072d38d850d4ef47b15b42b7a017
2020-04-27 17:29:35 +00:00
TreeHugger Robot
66623c0132 Merge "Convert vts configs to Android.bp" into rvc-dev am: 19685064b9
Change-Id: I5269acb6dd9c1be1183de67f28b3ef524377cb22
2020-04-27 17:14:01 +00:00