Commit graph

68667 commits

Author SHA1 Message Date
Treehugger Robot
f737614ce9 Merge "Add a small testcase for snapshot writer." 2021-05-04 19:37:19 +00:00
Kelvin Zhang
ab42259321 Add a small testcase for snapshot writer.
update_engine heavily relies on snapshot writer, add a testcase

Test: th
Change-Id: I4e3cf47dcff92ec4df0b3b84a0a8c7cb7866e7e7
2021-05-04 13:51:34 -04:00
Tri Vo
e23e85bee5 Merge "trusty: Helper library for metrics" 2021-05-04 14:17:05 +00:00
Akilesh Kailash
362b2b7537 Merge changes from topic "snapuserd-enable-read-ahead"
* changes:
  libsnapshot: snapuserd: Enable read-ahead functionality
  libsnapshot: Bump up the kCowVersionManifest version
2021-05-04 04:28:29 +00:00
Akilesh Kailash
b2e125cb1a libsnapshot: snapuserd: Enable read-ahead functionality
This enables read-ahead functionality by having
scratch space in the COW

Bug: 183863613
Test: OTA tests with new COW format

Signed-off-by: Akilesh Kailash <akailash@google.com>
Change-Id: I7988687c81d0ea239e71695818199db4653ddb80
2021-05-04 02:41:35 +00:00
Akilesh Kailash
c67686ecb9 libsnapshot: Bump up the kCowVersionManifest version
kCowVersionManifest will be 2. This should now
be in sync with kCowVersionMajor.

Bug: 183863613
Test: OTA with new COW format (by enabling scratch space option)
Signed-off-by: Akilesh Kailash <akailash@google.com>
Change-Id: Ia6c31e399de723ee83459b59d6b076b48f5c88d5
2021-05-04 02:41:23 +00:00
Akilesh Kailash
eebf447fef Merge changes from topic "snapuserd-read-ahead"
* changes:
  libsnapshot:snapuserd:Add unit test for read-ahead code path.
  libsnapshot: Flush data to scratch space only for overlapping regions
  libsnapshot:snapuserd: read-ahead COW copy ops
  libsnapshot: Retrieve COW version from update engine manifest
  libsnapshot:snapuserd: Add 2MB scratch space in COW file
  libsnapshot:snapuserd: mmap + msync header after merge
2021-05-04 00:55:28 +00:00
Tri Vo
a8919a2e82 trusty: Helper library for metrics
Bug: 182489121
Test: libtrusty_metrics_test
Change-Id: I7fc45ea3319185a8ac55889e56bd484d4774e928
2021-05-03 17:15:30 -07:00
Treehugger Robot
4f8a56f15d Merge "Make mkbootfs self-contained" 2021-05-03 16:58:55 +00:00
Yi-Yo Chiang
288f9eec0f Make mkbootfs self-contained
Now that mkbootfs is in prebuilt build tools, make it have no dynamic
dependency so that the binary is portable.

Bug: 184490452
Test: Presubmit
Change-Id: Ida4ee9af3c51ba9d163cf9c1e7b7098fd24e0de1
2021-05-02 19:36:23 +08:00
Treehugger Robot
2de90ca526 Merge "filesystem_config: Add a aid/uid for UWB subsystem" 2021-04-30 19:04:57 +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
82129fd4ce Merge "libsnapshot: Allow inspect_cow to show failed blocks" 2021-04-30 05:31:51 +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
4bb41c0ee4 Merge "init.rc: fix (re)starting apexd on FDE devices" 2021-04-29 20:20:42 +00: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
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
e222fa4d74 Merge "Enable disabled CtsFsMgrTestCases test cases" 2021-04-29 06:37:59 +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
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
d5349dcf6d Merge "libsnapshot: Add a merge failure code to SnapshotMergeReport." 2021-04-28 19:39:34 +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
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
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
26e5d8f1e2 Merge "Add new dm-verity error handling mode" 2021-04-23 03:35:01 +00:00
Treehugger Robot
23a50b3860 Merge "[Bugfix]Fix userspace-reboot failure when backing_dev exists but zram not swapped on" 2021-04-23 00:28:49 +00:00
Treehugger Robot
2e5e490d60 Merge "Add function CleanupOldScratchFiles symmetrically" 2021-04-23 00:14:09 +00:00
Treehugger Robot
6e784c5503 Merge "Prevent debugfs unmount on debug builds with a persist property" 2021-04-22 21:43:18 +00:00
Treehugger Robot
9596d062f5 Merge "Use libgtest_prod_headers." 2021-04-22 12:49:36 +00:00
satayev
51dceaa999 Merge "Don't generate /etc/classpath in make." 2021-04-22 12:17:56 +00:00
Artur Satayev
1acd663e96 Don't generate /etc/classpath in make.
Soong generates classpaths.proto config and puts it into
/system/etc/classpaths/ for derive_classpath to read at runtime. There
is no need to plumb these values via make anymore.

Bug: 180105615
Test: m && launch_cvd; presubmit / DeviceBootTest
Change-Id: I514c5036871233ae865b972effea8321dbe4aea9
2021-04-22 12:17:49 +00:00
Colin Cross
176ec1b805 Replace llndk_library with llndk clause in cc_library
Remove the vestigial llndk_library modules and replace them with
properties in the llndk clause of the implementation cc_library.

Bug: 170784825
Test: m checkbuild
Test: compare out/soong/build.ninja
Change-Id: Ie3a1bffcf29bb1b6747f7f708826c61bd43ba5a1
2021-04-21 19:13:41 -07:00