Commit Graph

58307 Commits

Author SHA1 Message Date
Rick Yiu 30ec7c391c Merge "Fine tune blkio setting to improve boot time" am: cb63bed8b5
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1322741

Change-Id: I8579ae84c15695e8a2302cf79303bf050ad4a06c
2020-06-06 00:29:55 +00:00
Rick Yiu cb63bed8b5 Merge "Fine tune blkio setting to improve boot time" 2020-06-06 00:17:09 +00:00
Tom Cherry bf6fcb6051 Merge changes I957c519b,Iaf4e389e,I92f8056b am: a1f1775172
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1323609

Change-Id: I59e16606760feeb8ab9b90ea1ef05e722d20fdc1
2020-06-05 15:32:40 +00:00
Tom Cherry a1f1775172 Merge changes I957c519b,Iaf4e389e,I92f8056b
* changes:
  logd: remove faulty optimization
  logd: don't store the map key in its value
  logd: use libbase logging
2020-06-05 15:21:13 +00:00
Tom Cherry b0263af5a8 logd: remove faulty optimization
TagNameKey contains a pointer to a std::string and a std::string_view,
such it can both own a string or reference a different string.  This
is meant to be a memory optimization.

This, however, is actually a net pessimization.  Due to these three
below cases and typical usage pattern.

Cases:
1) In the case where TagNameKey owns the string, 3 words are wasted,
one for the pointer and two for the std::string_view.

2) In the case where TagNameKey references a short string, the same 3
words are wasted.  This is because std::string has a feature called
"Short String Optimization" that means std::string does not allocate
for strings of sizes <= 10 on 32bit devices and <= 22 on 64bit
devices.

3) In the case where TagNameKey references a longer string than the
"Short String Optimization" limits, then this saves the string's
length in bytes.

Usage pattern:
After boot on 32 bit cuttlefish, there were 679 entries for the first
case, and only 69 in the third case.  The 679 entries have an overhead
of 679 * 3 * sizeof(void*) = 679 * 12 = 8148 bytes.  The 69 strings in
the third case have a total length and therefore savings of 1352
bytes.  This is a net pessimization of 6796 bytes.

I expect this same ratio to be similar throughout the device's uptime.

This situation is worse on 64 bit devices.  If cuttlefish were 64 bit,
then there would have been only 18 items in the third case due to the
larger "Short String Optimization" capacity, and the cost for the
first case would have doubled.

Given the above and the cost of maintaining extra code, this
optimization is removed and a std::string is used as the hash table
key instead.

Test: logging unit tests
Change-Id: I957c519b19edca4f7fc531d96b7144cf68bf4e16
2020-06-04 10:33:07 -07:00
Rick Yiu ad74d8dee0 Fine tune blkio setting to improve boot time
Bug: 133200996
Test: boot time test
Change-Id: I5262c28596adb7e849b202b8a163c190818f271a
2020-06-04 14:28:19 +08:00
Treehugger Robot b2a05176fa Merge "libsparse: Limit block size to 64 MB" am: e10fb5f5c5
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1310496

Change-Id: I01ffbd72a778721a73f7815934d56ab9ff4821c1
2020-06-04 03:46:25 +00:00
Treehugger Robot e10fb5f5c5 Merge "libsparse: Limit block size to 64 MB" 2020-06-04 03:32:55 +00:00
Tom Cherry 4596b78d12 logd: don't store the map key in its value
The keys are already available when iterating through the maps, so
this only serves to waste memory.

Test: unit tests
Change-Id: Iaf4e389eb0f0990e7113cd78be1773e767a356d4
2020-06-03 16:30:58 -07:00
Tom Cherry f93b4006e0 logd: use libbase logging
We can use libbase logging to output to the kernel log instead of the
'prdebug' function, so use that instead.

Bonus #1: we can now use CHECK().
Bonus #2: logging unit tests automatically output to stderr.
Bonus #3: We see dependent library's logs instead of losing them to
the void.

Test: logging unit tests
Test: logs show appropriately in dmesg / stderr
Test: CHECK() works
Change-Id: I92f8056b4820dc4998996cf46460568085299700
2020-06-03 16:29:48 -07:00
Treehugger Robot f24a7e1f62 Merge "adb: treat non-successful inc-server runs as failures" am: ff502379b7
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1322109

Change-Id: I3b07d7f84a4c31ca559abbea12f7e497bf64a282
2020-06-03 21:40:22 +00:00
Treehugger Robot ff502379b7 Merge "adb: treat non-successful inc-server runs as failures" 2020-06-03 21:28:53 +00:00
Treehugger Robot f517b00dce Merge "first_stage_init: support kernel module directories" am: dc9acdd221
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1319048

Change-Id: Ifd078ee7b78fdbcfcd94573a658afa44edd05cb8
2020-06-03 19:21:17 +00:00
Treehugger Robot 1b3d01fb6d Merge "add libmodprobe api to query the number of modules loaded" am: a990f0760d
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1319047

Change-Id: I0c0922efe3604f9f0bb2c2b144f66ca4199fa873
2020-06-03 19:21:04 +00:00
Treehugger Robot dc9acdd221 Merge "first_stage_init: support kernel module directories" 2020-06-03 19:08:11 +00:00
Treehugger Robot a990f0760d Merge "add libmodprobe api to query the number of modules loaded" 2020-06-03 19:06:13 +00:00
Steve Muckle d6d38c326e first_stage_init: support kernel module directories
Kernel modules may be located within directories in /lib/modules.
Attempt to load kernel modules from each directory that has a name starting with
the major and minor version of the currently running kernel. If a single
kernel module is successfully loaded from a directory, that directory is
treated as the correct kernel module directory for the system. No other
kernel module directories are searched and any kernel module load errors
in that directory are fatal. If the attempt to load the first kernel
module from a directory fails, or if there are no kernel modules in a
directory, then the search proceeds to the next directory.

If no kernel module is successfully loaded from any directory as above,
an attempt is made to load kernel modules from the top level at
/lib/modules/.

Bug: 157645635
Change-Id: I92eadd8617f03a645da460ccb776bc04fa541f00
2020-06-03 10:51:51 -07:00
Steve Muckle b0c4881ea9 add libmodprobe api to query the number of modules loaded
In the short term this will be used to help implement support for
multiple kernel module directories but it may be useful in other
contexts as well.

Bug: 157645635
Change-Id: I15a252b6e9394292c8f3557ed65112c935830441
2020-06-03 10:51:45 -07:00
Tom Cherry 430dbf32f8 Merge "logd: Drop the LogStatistics dependency on LogBufferElement" am: 671f39fdf2
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1322276

Change-Id: Icdf95edb626f7e2d0425e77894c2a1295cb46476
2020-06-03 15:28:25 +00:00
Tom Cherry 671f39fdf2 Merge "logd: Drop the LogStatistics dependency on LogBufferElement" 2020-06-03 15:15:00 +00:00
Yurii Zubrytskyi 924915bacd adb: treat non-successful inc-server runs as failures
This way if an unknown device returns anything but a clear
success report from an incremental installation adb would retry
non-incrementally

Bug: 158006039
Test: manual install on R and Q
Change-Id: I9950273bd60ba75fe12a3706d2ccbee136987d13
2020-06-02 23:38:51 -07:00
Woody Lin a386482f1d libsparse: Limit block size to 64 MB
Limit the block size to 64 MB before fastboot executable binary for
windows 64-bit is released.

Bug: 156057250
Change-Id: Ic4edb963a3d99f718d7630aba3f351729a84e994
2020-06-03 11:45:17 +08:00
Josh Gao 0b3202f826 Merge "adb: implement zstd compression for file sync." am: 450e83eb8f
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1319091

Change-Id: Ia34e6e6222efb0c7319e1f6e227c4aa45d92c1a3
2020-06-03 02:07:10 +00:00
Josh Gao 450e83eb8f Merge "adb: implement zstd compression for file sync." 2020-06-03 01:56:31 +00:00
Treehugger Robot f476677b4e Merge "check_ms_os_desc: fix buffer overflow." am: f7fed04ace
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1322275

Change-Id: I5bb717db05585f9c119b1b60f4a4f013da9e87a6
2020-06-03 01:32:40 +00:00
Treehugger Robot f7fed04ace Merge "check_ms_os_desc: fix buffer overflow." 2020-06-03 01:09:48 +00:00
Alex Buynytskyy 3fc21d4802 Merge "Signature checks." am: 0aa0581404
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1321890

Change-Id: Ia2249d3db0e7b7dd048b6ef09780bc156d1bcc6b
2020-06-03 00:44:25 +00:00
Alex Buynytskyy 0aa0581404 Merge "Signature checks." 2020-06-03 00:30:34 +00:00
Alex Buynytskyy 7405a92e35 Signature checks.
- signature size validation,
- no-signature files support (e.g. .dm).

Bug: 157077910 150803885
Fixes: 157077910
Test: atest adb_test adbd_test

Change-Id: I03a4f32a87568bd6f447f66c8aab666fb0b27199
2020-06-02 23:12:58 +00:00
Tom Cherry 3dd3ec3514 logd: Drop the LogStatistics dependency on LogBufferElement
Other log buffers may not use LogBufferElement, so we should decouple
the two classes.  This uses an intermediate LogStatisticsElement
structs instead of passing a large number of parameters to each
function.

This additionally moves IsBinary() and the GetTag() functions out into
LogUtils.h since they can be used generically by other users.

Test: logging unit tests
Change-Id: I71f53257342c067bcccd5aa00bae47f714cd7c66
2020-06-02 16:02:56 -07:00
Josh Gao a2929d5751 check_ms_os_desc: fix buffer overflow.
Bug: http://b/155505587
Test: check_ms_os_desc
Change-Id: Ie99715ab62571d24460c3a1fb859d22951f30cb8
2020-06-02 15:24:47 -07:00
Tom Cherry a9b4222196 Merge "logd: move leading_dropped logic into FlushTo()" am: a8b8d108e5
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1320576

Change-Id: I8129ea7791ef4291e2a7d8ca8b14698a933fc8c7
2020-06-02 21:56:12 +00:00
Tom Cherry a8b8d108e5 Merge "logd: move leading_dropped logic into FlushTo()" 2020-06-02 21:51:17 +00:00
Treehugger Robot 1d73552164 Merge "adb: don't use parameterized in test_adb.py." am: 648266ab1c
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1322179

Change-Id: Icca5eb952bc158013efdb6851d8d6f7a1c794cba
2020-06-02 21:49:15 +00:00
Treehugger Robot 648266ab1c Merge "adb: don't use parameterized in test_adb.py." 2020-06-02 21:31:21 +00:00
Tom Cherry b3e163399a logd: move leading_dropped logic into FlushTo()
This logic isn't generic, so it should not be in the generic
LogReaderThread.

Moreover, it's currently broken in essentially every case except when
filtering by UID, because it runs as in the filter functions before
the actual filtering by pid/etc takes place.  For example, when
filtering by pid, it's possible to get leading chatty messages.  The
newly added test was failing previously but is fixed by this change.

It's fundamentally broken in the tail case.  Take this example:
1: Normal message
2: Chatty message
3: Normal message
4: Normal message

If you read that log buffer with a tail value of 3, there are three
possible outcomes:
1) Messages #2-4, however this would include a leading chatty message,
   which is not allowed.
2) Messages #3-4, however this is only 2, not 3 messages.
3) Messages #1-4, however this is 4, more than the 3 requested
   messages.

This code chooses 2) as the correct solution, in this case, we don't
need to account for leading chatty messages when counting the total
logs in the buffer.  A test is added for this case as well.

Test: new unit test
Change-Id: Id02eb81a8e77390aba4f85aac659c6cab498dbcd
2020-06-02 13:26:48 -07:00
Tom Cherry 6e63019c63 Merge "logd: format LogBufferElement and LogStatistics correctly" am: 4ab0bc414d
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1322875

Change-Id: I871b7dcbc38e911665a5df2565b2a2cb07c2a0e2
2020-06-02 20:23:30 +00:00
Josh Gao 3f2f3bacf9 adb: don't use parameterized in test_adb.py.
The test bots don't have this module installed.

Test: treehugger
Change-Id: I849a075b784eac296608e45bec7b2fce38f56ac4
2020-06-02 13:14:45 -07:00
Tom Cherry 4ab0bc414d Merge "logd: format LogBufferElement and LogStatistics correctly" 2020-06-02 20:07:52 +00:00
Tom Cherry 9787f9a054 logd: format LogBufferElement and LogStatistics correctly
Test: logging unit tests
Change-Id: If63be065e38f2a1c4cf2807ceaa9eea180b16c51
2020-06-02 11:38:44 -07:00
Tom Cherry 76dac24797 Merge changes Id47b288d,I969565eb,Iba2e654e am: 365fdb7acb
Original change: undetermined

Change-Id: I5478564414c48ce0ab0c84ecd4a1e31eb3ec2eec
2020-06-02 15:51:51 +00:00
Tom Cherry 365fdb7acb Merge changes Id47b288d,I969565eb,Iba2e654e
* changes:
  logd: drop can_read_security_logs
  logd: create FlushToState class
  logd: fix bug in FlushTo when requesting exact sequence number
2020-06-02 15:41:03 +00:00
Tom Cherry eb49b04e21 logd: drop can_read_security_logs
This has become useless after refactoring; we instead ensure that the
LOG_ID_SECURITY bit isn't set in log_mask, instead of having this
additional check.

Test: logging unit tests
Change-Id: Id47b288d056ebf2b5bd26be94006f17c24fafd31
2020-06-01 14:45:02 -07:00
Tom Cherry 855c7c87a3 logd: create FlushToState class
ChattyLogBuffer::FlushTo() needs an array of pid_t's to differentiate
between deduplication and spam removal chatty messages, but that won't
be useful to other log buffers, so it doesn't deserve its own entry in
the abstruct LogBuffer::FlushTo() function.

Other log buffers may need their own data stored for each reader, so
we create an interface that the reader itself owns and passes to the
log buffer.  It uses a unique_ptr, such that the when the reader is
destroyed, so will this state.

FlushToState will additionally contain the start point, that it will
increment itself and the log mask, which LogBuffers can use to
efficiently keep track of the next elements that will be read during a
call to FlushTo().

Side benefit: this allows ChattyLogBufferTests to correctly report
'identical' instead of 'expired' lines the deduplication tests.

Side benefit #2: This updates LogReaderThread::start() more
aggressively, which should result in readers being disconnected less
often, particularly readers who read only a certain UID.

Test: logging unit tests
Change-Id: I969565eb2996afb1431f20e7ccaaa906fcb8f6d1
2020-06-01 14:45:02 -07:00
Tom Cherry 90e9ce0c28 logd: fix bug in FlushTo when requesting exact sequence number
SimpleLogBuffer::FlushTo() attempts to find the iterator matching a
given sequence number, but the logic is wrong and will always skip one
element forward.  This change fixes this and adds a test for the
situation.

This likely contributed to some test instability in the past, but was
identified because subsequent changes that track the start value
closer exacerbated this issue.

Test: existing and new unit tests
Change-Id: Iba2e654e94234693dba20d4747a60bc79d195673
2020-06-01 14:44:56 -07:00
Yifan Hong 7a5b39709a Merge changes I845d2250,I4faa0785 am: 51b127c71e
Change-Id: Id4e378b449cd7939ff156199e189490b1de3ff56
2020-05-30 01:22:12 +00:00
Alessio Balsini c757b578f7 libsnapshot: Export COW image size am: 02e639d1f5
Change-Id: Icb741f3a9454a4e54cbb31e444272b6042a1340c
2020-05-30 01:22:10 +00:00
Yifan Hong 51b127c71e Merge changes I845d2250,I4faa0785
* changes:
  libsnapshot: proto use correct index
  libsnapshot: Export COW image size
2020-05-30 01:06:56 +00:00
Yifan Hong a30076404e libsnapshot: proto use correct index
Test: pass
Bug: 154016862
Change-Id: I845d2250ddb27bdbaee0d54663a2fdb45dbfbd11
2020-05-29 16:21:40 -07:00
Alessio Balsini 02e639d1f5 libsnapshot: Export COW image size
Enable libsnapshot to export the size of the COW image, representing the
fraction of the COW device that is temporarily created in the /data
partition, computed just before initializing a merge operation.
Thise additional information can be used by other components (i.e.,
update engine) to enrich Virtual A/B metrics.

Bug: 154016862
Test: manual OTA
Signed-off-by: Alessio Balsini <balsini@google.com>
Change-Id: I4faa0785f23884e26161e0d51268dd7a305d86bf
Merged-In: I4faa0785f23884e26161e0d51268dd7a305d86bf
2020-05-29 23:19:39 +00:00