Commit graph

69382 commits

Author SHA1 Message Date
Akilesh Kailash
a728724a34 Merge "libsnapshot: Add Version field which will be used by update-engine manifest" am: 0ec13ceda9
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1676194

Change-Id: Iec662bd6a12d8be199fe15ffb0511309110e0945
2021-04-30 18:26:15 +00:00
Akilesh Kailash
0ec13ceda9 Merge "libsnapshot: Add Version field which will be used by update-engine manifest" 2021-04-30 18:08:54 +00:00
Akilesh Kailash
936e9ce79d libsnapshot:snapuserd:Add unit test for read-ahead code path.
Add overlapping copy ops to test the read-ahead logic.

Bug: 183863613
Test: cow_snapuserd_test
Signed-off-by: Akilesh Kailash <akailash@google.com>
Change-Id: Ie96bc644c5f2eaae45cf048d9ba8a206930c3ce8
2021-04-30 06:49:03 +00:00
Akilesh Kailash
150bcbf7c6 libsnapshot: Flush data to scratch space only for overlapping regions
When read-ahead thread caches the data from base device, flush the data
only if there are overlapping regions. If there is crash, subsequent
reboot will not recover the data from scratch space. Rather, data
will be re-constructed from base device.

Additionally, allow batch merge of blocks by the kernel even for
overlapping region given that we have the read-ahead thread
taking care of the overlapping blocks.

Bug: 183863613
Test: 1: Incremental OTA from build 7284758 to 7288239. Merge time
         reduces from ~6 minutes to ~2.5 minutes
      2: Reboot and crash kernel multiple times when merge was in
         progress
      3: Verify read-ahead thread re-constructs the data for overlapping
         region.
Signed-off-by: Akilesh Kailash <akailash@google.com>
Change-Id: I50e0d828f4fb36a23f0ca13b07a73229ba68874d
2021-04-30 06:46:47 +00:00
Akilesh Kailash
580312bc95 libsnapshot:snapuserd: read-ahead COW copy ops
Introduce read-ahead mechanism for COW copy ops.

1: Read-ahead thread will read from base device
   and store the data in scratch space along with the metadata.
2: Worker threads during merge will retrieve the data
   from read-ahead cache
3: Fixed set of blocks are read during each cycle by the read-ahead
   thread.
4: When the last block in the region is merged, read-ahead thread
   makes forward progress.

Scratch space is set to 2MB and is only used from COW copy operations.
We can extend this to Replace Ops based on performance evaluation.

Performance:

As mentioned in bug 181883791, Incremental OTA of size 55M with
235K copy operations where every block is moved by 4k:

Without read-ahead: 40 Minutes for merge completion
With read-ahead:  21 Minutes for merge completion

Bug: 183863613

Test: 1: Full OTA - no regression observed.
2: Incremental OTA - with older COW format. Daemon will just skip
   the read-ahead feature for older COW format.
3: Incremental OTA - with new COW format.
4: Reboot and crash kernel when multiple times when incremental OTA is in-flight.
   Verify post reboot, read-ahead thread re-constructs the data from scratch
   space.
5: No regression observed in RSS-Anon memory usage when merge in-flight.

Signed-off-by: Akilesh Kailash <akailash@google.com>
Change-Id: Ic565bfbee3e9fcfc94af694596dbf44c0877639f
2021-04-30 06:46:33 +00:00
Akilesh Kailash
d967d01f56 libsnapshot: Retrieve COW version from update engine manifest
update_metadata.proto will have the COW version. Retrieve
that from the manifest and compare it with the COW library.
If the versioning doesn't match, disable VABC.

The primary use case of this is during downgrade tests
in pre-submit. Whenever we have a COW format changes,
we may have to disable VABC for that specific transition
build. At a high level, the flow of version check will be:

1: Create a initial COW version of 1 in manifest (update_metadata.proto)
2: The latest COW version of libsnapshot is 2
3: libsnapshot will return VABC disabled
4: Check-in the CL and changes to manifest
5: Once the CL is baked in and the build is green, bump up the COW version to 2 in the manifest
6: Next set of tests, since both versions match, libsnapshot will enable VABC
7: Downgrade should be done to the build which was checked in at (5)

Bug: 183863613
Test: Apply OTA and verify if VABC is disabled if the versions don't
match
Signed-off-by: Akilesh Kailash <akailash@google.com>
Change-Id: Id55f33a90bb31b417e72f4fbe370daf05a68f05a
2021-04-30 06:46:24 +00:00
Akilesh Kailash
771b17f509 libsnapshot:snapuserd: Add 2MB scratch space in COW file
Add 2MB scratch space in the COW file. This is a preparation
patch for read-ahead patch. This just add the buffer
space right after the header. Bump up the version number
in the header in order to distiguish between older and newer
COW formats.

No operation is done on this buffer with this patch-set.

Scratch space option is disabled by default.

Bug: 183863613
Test: 1: Create Full OTA with the new COW format.
2: Incremental OTA with older COW format.
3: vts_libsnapshot_test

Signed-off-by: Akilesh Kailash <akailash@google.com>
Change-Id: I42a535a48ec22adb893dfe6f86a4f51650e1f88a
2021-04-30 06:45:57 +00:00
Akilesh Kailash
31e0426489 libsnapshot:snapuserd: mmap + msync header after merge
mmap the CowHeader and use msync to flush only the
first 4k page after merge is complete.

This cuts down ~30 seconds of merge completion time
on a 55M incremental OTA with 235k copy operations.

Although, this isn't a significant gain but this patch
creates a scaffolding for the next set of read-ahead patches.

Bug: 183863613
Test: Incremental and Full OTA
Signed-off-by: Akilesh Kailash <akailash@google.com>
Change-Id: I15bfec91ea1d5bdf4390670bcf406e1015b79299
2021-04-30 06:31:12 +00:00
Akilesh Kailash
acc1c5d189 libsnapshot: Add Version field which will be used by update-engine
manifest

Bug: 183863613
Test: Build
Signed-off-by: Akilesh Kailash <akailash@google.com>
Change-Id: If4b6a60669a55eb2ea1167fb2cc49ce04c054748
2021-04-30 06:31:01 +00:00
Daniel Rosenberg
2377825899 Merge "libsnapshot: Allow inspect_cow to show failed blocks" am: 82129fd4ce
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1673894

Change-Id: I13fb8346d1526f274a840a94ccd7af773430577c
2021-04-30 05:47:26 +00:00
Daniel Rosenberg
82129fd4ce Merge "libsnapshot: Allow inspect_cow to show failed blocks" 2021-04-30 05:31:51 +00:00
Inseob Kim
ff9de56e37 Merge "Fix precompiled sepolicy logic" am: 4664bbc6c7
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1690527

Change-Id: I095b5009b7a0ff346c5f28b2e9ad2e37efcae178
2021-04-30 01:50:04 +00:00
Inseob Kim
4664bbc6c7 Merge "Fix precompiled sepolicy logic" 2021-04-30 01:14:15 +00:00
Daniel Rosenberg
05a73c5788 libsnapshot: Allow inspect_cow to show failed blocks
Adds the -b option to show the bad data block that failed to decompress.
If the block is large enough, display the front as though it were a
CowOperation, as this is the most likely culprit.

Change-Id: I287f13e0794a1ca9d647d4b1099ab238a6202b23
Bug: 183985866
Test: inspect_cow -db <COW_FILE>
2021-04-29 21:58:58 +00:00
Roshan Pius
e85201bbeb filesystem_config: Add a aid/uid for UWB subsystem
Bug: 186788640
Test: Compiles
Change-Id: Ib3d1b064e8e68e7b9e59b26f356ac7c4da2eaaf8
2021-04-29 14:57:07 -07:00
Eric Biggers
b8cadd770f Merge "init.rc: fix (re)starting apexd on FDE devices" am: 4bb41c0ee4
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1684057

Change-Id: I71ae39d715aa2b56dd77b03ea19c3aa9584dfdfa
2021-04-29 20:51:54 +00:00
Eric Biggers
4bb41c0ee4 Merge "init.rc: fix (re)starting apexd on FDE devices" 2021-04-29 20:20:42 +00:00
Martin Stjernholm
bcd1d4b670 Require libjdwp from the ART APEX.
There is no direct dependency in platform on this library, but we still
need a link to it from the system namespace, since adbconnection can
load it as a JVMTI agent without a class loader, and that is changing
to use the system namespace in https://r.android.com/1673312.

Test: atest CtsJdwpTestCases
Test: atest CtsJdwpTunnelHostTestCases
Bug: 130340935
Change-Id: Ia06c0f2a80226a056195fcff2f5d4dcab8f38518
2021-04-29 20:40:31 +01:00
Eric Biggers
915b8d7194 init.rc: fix (re)starting apexd on FDE devices
On first boot, FDE devices hang on the command
'wait_for_prop apexd.status activated'.  This is because apexd was
already started with the tmpfs /data, then was stopped by
vold.decrypt=trigger_shutdown_framework.  Then when apexd is started
again with the real /data, it sees that apexd.status="ready" already, so
it doesn't consider itself to be starting from scratch again.  So it
doesn't move apexd.status back to "activated" as expected.

Fix the above by resetting apexd.status to its initial value of the
empty string before trying to start apexd in the post-fs-data trigger.
Note that this also takes care of the userspace reboot case which was
previously handled in the userspace-reboot-requested trigger.

Also, FDE devices hang at the same place on non-first boots with default
encryption (i.e., when no PIN is set) because apexd is still running
after having been started with the tmpfs /data.  This is because
vold.decrypt=trigger_shutdown_framework isn't run in that case, but
rather vold manually kills processes that have open files on /data --
which doesn't include apexd.  But, apexd should be restarted too.

Fix that by using 'restart apexd' rather than 'start apexd'.

Note that these changes are needed even though FDE devices don't support
updatable APEXes, as apexd is needed regardless.

This is one of a set of changes that is needed to get FDE working again
so that devices that launched with FDE can be upgraded to Android 12.

Bug: 186165644
Test: Tested FDE on Cuttlefish.  Also tested userspace reboot (with FBE)
Change-Id: I4fa57cf15d77b64d1167eaf966347d2a9d6a9b72
2021-04-29 17:05:37 +00:00
Mohammad Samiul Islam
60e30a5ada Add execute permission to /data/apex/decompressed directory
Now that we are activating APEX directly from /data/apex/decompressed
directory, without this permission, PackageManager fails to parse
decompressed APEX. This permission setting is same as what we have for
/data/apex/active.

Bug: 185886528
Test: atest ApexCompressionTests
Change-Id: Ief36a6ddc5760faff2c390fa913984385fda99a6
2021-04-29 14:23:27 +00:00
Inseob Kim
28fdb6794c Fix precompiled sepolicy logic
If precompiled vendor policy has system_ext hash, system_ext also has to
have its hash, to use precompiled sepolicy.

Bug: 186727553
Test: remove system_ext's hash and see sepolicy compiled in runtime
Change-Id: I4af3418d614156b5e9cd0b0116c2814ba994ee81
2021-04-29 19:50:38 +09:00
Yo Chiang
16d0600eb5 Merge "Enable disabled CtsFsMgrTestCases test cases" am: e222fa4d74
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1687910

Change-Id: Ibc2ee8f1631c3a735a15ec437ff6d2a695c59956
2021-04-29 06:51:45 +00:00
Yo Chiang
e222fa4d74 Merge "Enable disabled CtsFsMgrTestCases test cases" 2021-04-29 06:37:59 +00:00
Treehugger Robot
0d13e9370c Merge "Allow a kernel bootconfig to set the qemu key" am: 6cbc7e01b2
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1690216

Change-Id: I83f046c6ff77229ba6508496f589b8b914a2767b
2021-04-29 03:35:21 +00:00
Treehugger Robot
6cbc7e01b2 Merge "Allow a kernel bootconfig to set the qemu key" 2021-04-29 02:16:33 +00:00
Roman Kiryanov
6e20ff83ac Allow a kernel bootconfig to set the qemu key
The existing code has a lot of references to the
`ro.boot.qemu` and `ro.boot.qemu.something` properties
which is not supported by the bootconfig if we place
everything under `androidboot.qemu`.

Bug: 182291166
Test: getprop | grep qemu
Signed-off-by: Roman Kiryanov <rkir@google.com>
Change-Id: Icb9d29c8dc39e1fa52a6f2ce43b4f42182b7995d
2021-04-28 15:31:52 -07:00
Akilesh Kailash
e22825a7d2 Merge "libsnapshot: Pass MSG_NOSIGNAL socket flags" am: d79e4f4c19
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1687665

Change-Id: Ic376ab3efc587e65a41ae61bace30c75d9e35042
2021-04-28 21:24:24 +00:00
Steven Moreland
246739cc61 Merge "libutils: sharedbuffer test - expect greatness!" am: 9dd80b6b04
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1688812

Change-Id: Id8d62f4aca69d9519a303e00a89c33a791028d5f
2021-04-28 21:21:12 +00:00
Akilesh Kailash
d79e4f4c19 Merge "libsnapshot: Pass MSG_NOSIGNAL socket flags" 2021-04-28 20:55:34 +00:00
Steven Moreland
9dd80b6b04 Merge "libutils: sharedbuffer test - expect greatness!" 2021-04-28 20:28:09 +00:00
David Anderson
94b0b7ac4b Merge "libsnapshot: Add a merge failure code to SnapshotMergeReport." am: d5349dcf6d
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1676193

Change-Id: Idf9ae2499807ff4ee14947db7c7cdd4bd44fe5ce
2021-04-28 19:55:15 +00:00
David Anderson
d5349dcf6d Merge "libsnapshot: Add a merge failure code to SnapshotMergeReport." 2021-04-28 19:39:34 +00:00
Christian Wailes
dc76ce73cf Merge "Added ARTD user" am: 8ef7d82213
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1664781

Change-Id: I13a65b78f5579a6c576231b728da4898f68d4dfc
2021-04-28 19:22:00 +00:00
Treehugger Robot
d6fbaa0945 Merge changes from topic "debug_ramdisk_path" am: c4a1a32e91
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1687907

Change-Id: Id6beaf51a211f89b6487ef426335f0fd29fe595c
2021-04-28 18:20:17 +00:00
Bowgo Tsai
20a73996fa init: loading debug resources before chroot into first_stage_ramdisk am: 64e92f946f
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1684655

Change-Id: Idedf53ec0e74a1fd12f4b883a7605200561d5ff3
2021-04-28 18:19:47 +00:00
Steven Moreland
128826ca07 libutils: sharedbuffer test - expect greatness!
This test previously expected failure - a machine which does not have
2GiB of memory. However, while today is becoming the past,
2GiB allocations working is no longer a dream of the future!

Fixes: 186569165
Test: libutils_test
Change-Id: I6a9ed608c0989d415b4e7735b8a451b8928b4083
2021-04-28 17:15:58 +00:00
Christian Wailes
8ef7d82213 Merge "Added ARTD user" 2021-04-28 16:41:09 +00:00
Treehugger Robot
c4a1a32e91 Merge changes from topic "debug_ramdisk_path"
* changes:
  init: adding fallback paths for debug ramdisk
  init: loading debug resources before chroot into first_stage_ramdisk
2021-04-28 16:27:34 +00:00
Yi-Yo Chiang
7e122fedd5 Enable disabled CtsFsMgrTestCases test cases
And use the new fs_mgr C++ API.

Bug: 186504948
Test: atest CtsFsMgrTestCases
Test: atest CtsFsMgrTestCases in DSU
Change-Id: I80d68d72fb3aa9f5a0dc7d9400b4d0f80cc7deb3
2021-04-27 18:46:30 +08:00
Treehugger Robot
60750f31d6 Merge "libprocessgroup: Fix warnings when legacy schedtune cgroup is absent" am: 3b0ec907f7
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1685992

Change-Id: I8e69dbc750fea71b29fb267447df4b28e972a3f2
2021-04-27 10:11:58 +00:00
Treehugger Robot
3b0ec907f7 Merge "libprocessgroup: Fix warnings when legacy schedtune cgroup is absent" 2021-04-27 09:00:54 +00:00
Bowgo Tsai
6cb4311f4d init: adding fallback paths for debug ramdisk
Currently the gki_4_19_pixel5 presubmit test uses an old
vendor_boot-debug.img from a release branch. Adding fallback
paths to load debug resources from /first_stage_ramdisk dir to
pass the presubmit.

This CL should be reverted later once the vendor_boot-debug.img
gets updated to store the debug resources on the root dir.

Bug: 186082603
Test: boot a device with boot-debug.img
Test: boot a device with vendor_boot-debug.img
Change-Id: I9fcd77fc5a60a15cff254e432e05f1c9122ad80d
2021-04-27 15:25:31 +08:00
Bowgo Tsai
64e92f946f init: loading debug resources before chroot into first_stage_ramdisk
Currently the debug resources might under /first_stage_ramdisk/*
of the ramdisk, if there is androidboot.force_normal_boot=1 in the
kernel cmdline to request init chroot into /first_stage_ramdisk dir.

To make a generic boot-debug.img works on devices with and without
this chroot, moving the debug resources to the root of the ramdisk.
And copy them for later use before the chroot.

Bug: 186082603
Test: boot a device with boot-debug.img
Test: boot a device with vendor_boot-debug.img
Change-Id: I052a92b2d26c7fdf749991fc55015ff68743efc2
2021-04-27 15:25:18 +08:00
Akilesh Kailash
83658e0d36 libsnapshot: Pass MSG_NOSIGNAL socket flags
If one end of the communication socket is closed for some reason, there
is no need to terminate the daemon or the client. Mask
the SIGPIPE using MSG_NOSIGNAL flag - we will
still get EPIPE error but process will not be terminated.

Bug: 186213024
Test: Full OTA
Signed-off-by: Akilesh Kailash <akailash@google.com>
Change-Id: Iaa53545c0c4059618f6b49afb9ec24ea5372c7e0
2021-04-27 02:36:18 +00:00
Colin Cross
77e5d8b1d4 Merge "Replace llndk_library with llndk clause in cc_library" am: e52de760db
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1684207

Change-Id: I1b30123fffb1caf263ef119ccc92304117f1e9cd
2021-04-27 01:02:39 +00:00
Colin Cross
e52de760db Merge "Replace llndk_library with llndk clause in cc_library" 2021-04-27 00:32:44 +00:00
Suren Baghdasaryan
e3d38969aa libprocessgroup: Fix warnings when legacy schedtune cgroup is absent
Issue a warning about missing cpu/schedtune controller only if both of
them are missing.

Bug: 185437398
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Change-Id: I3a9d3c9a8c91c8d2c5346bcb431bb0407c64a811
2021-04-26 09:28:08 -07:00
Treehugger Robot
fdb4d18043 Merge "Add new dm-verity error handling mode" am: 26e5d8f1e2
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1675559

Change-Id: I8a15b219771989f19488450650c6fec85e26c508
2021-04-23 04:04:11 +00:00
Treehugger Robot
26e5d8f1e2 Merge "Add new dm-verity error handling mode" 2021-04-23 03:35:01 +00:00
Treehugger Robot
bce0c15f3f Merge "[Bugfix]Fix userspace-reboot failure when backing_dev exists but zram not swapped on" am: 23a50b3860
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1674154

Change-Id: I76c0637965f95c9d3027c4bfc89ac0b9cbb3f384
2021-04-23 00:29:52 +00:00