Commit graph

4032 commits

Author SHA1 Message Date
Newton Lam
44884d5c31 Use uint64_t instead of size_t when calculating extent size to avoid overflow
Change-Id: I22a77162d08fd7e82ffaa3e0c6c8adb6e956f7d1
2024-10-14 20:52:32 +00:00
Akilesh Kailash
e69b2d4277 snapshotctl: Initialize snapshot pointer when reverting snapshots
Test: snapshotctl revert-snapshots
Bug: 368487904
Change-Id: I9743bf412d4bfcf508aeb046ec329568da4e2be1
Signed-off-by: Akilesh Kailash <akailash@google.com>
2024-10-09 04:37:47 +00:00
Priyanka Advani (xWF)
eb34156abe Merge changes from topic "revert-3212512-XCWURMYNFC" into main
* changes:
  Revert "libprocessgroup: Remove cgroup.rc file"
  Revert "libprocessgroup: Remove dependency on libcgrouprc"
  Revert "libprocessgroup: Remove ACgroupController_getMaxActivati..."
  Revert "libprocessgroup: Combine all 3 ActivateControllers imple..."
2024-10-08 20:35:53 +00:00
Priyanka Advani (xWF)
972a2d30f8 Revert "libprocessgroup: Remove cgroup.rc file"
Revert submission 3212512

Reason for revert: Droidmonitor created revert due to b/372273614. Will be verifying through ABTD before submission.

Reverted changes: /q/submissionid:3212512

Change-Id: I37568516e973cb940f1229d52f94b8dc801da2ab
2024-10-08 18:54:37 +00:00
T.J. Mercier
90dc57cea8 Merge changes from topic "No cgroup.rc" into main
* changes:
  libprocessgroup: Combine all 3 ActivateControllers implementations into one
  libprocessgroup: Remove ACgroupController_getMaxActivationDepth
  libprocessgroup: Remove dependency on libcgrouprc
  libprocessgroup: Remove cgroup.rc file
2024-10-08 17:36:42 +00:00
Jaegeuk Kim
7179bd1a02 Merge "fiemap_writer_test: add block truncation and sync for safety" into main 2024-10-07 17:04:08 +00:00
Jaegeuk Kim
623682af2f fiemap_writer_test: add block truncation and sync for safety
There is a delay to get inode evicted whic requires to deallocate blocks used
by the previous test. Let's secure the pinned space as much as possible.

Bug: 371822983
Change-Id: I4cc69fc61e348511bb027ca0a9dd277fffb20f7f
Signed-off-by: Jaegeuk Kim <jaegeuk@google.com>
2024-10-06 20:19:37 +00:00
T.J. Mercier
ae4ce8ccc5 libprocessgroup: Remove cgroup.rc file
The cgroup.rc file was introduced in 192aee782 ("libprocessgroup: Add
support for task profiles") back with the initial support for task
profiles. It was intended to optimize performance associated with cgroup
operations. However over time, supporting this file led to making
libprocessgroup code more complicated (such as the cgrouprc LLNDK
interface), and the file ended up getting mmaped into nearly every
process on Android even though only a handful of them actually use it.
Replacing this file with reading and parsing of cgroup information on
demand allows us to simplify and shrink libprocessgroup, and eliminates
thousands of unused mappings without negatively affecting boot time or
other performance metrics.

Bug: 349105928
Test: Verified with memcg v2 and MaxActivationDepth 1 on Cuttlefish, Raven, and Mokey
Change-Id: Ic3f01fdf7fda89a56ab80657e1cf4573156273e6
2024-10-03 17:01:34 +00:00
Daniel Zheng
4174d07b7f Merge "libsnapshot: configure num worker threads" into main 2024-10-02 19:59:02 +00:00
Daniel Zheng
a23013dd4b libsnapshot: configure num worker threads
Forward number of worker threads build configuration to snapuserd. these
are the threads that will be used to serve i/o requests to dm-user.

Bug: 361438985
Test: OTA with print logs post OTA reboot
Change-Id: Ib70a3cb8766b96232ea6f97effece041534dc922
2024-10-02 09:56:06 -07:00
Sandeep Dhavale
dcb13446f2 Merge "libsnapshot: Use words for xor ops" into main 2024-09-30 16:26:50 +00:00
Sandeep Dhavale
0d84909d66 libsnapshot: Use words for xor ops
Use words instead of doing xor byte-by-byte for the entire buffer.
Profiling this with unittest, I can see the xor ops is much faster.

Also handle the word size appropriately for 32bit and 64bit platforms.

simpleperf shows that ProcessXorOp() is atleast 30% faster.
Similar improvement is seen for ProcessXorData().

Test: snapuserd_test
Bug: 369905394
Change-Id: I0bd8586f7fc1bf184f19320667b8195b07f9cdf2
Signed-off-by: Sandeep Dhavale <dhavale@google.com>
2024-09-27 14:55:06 -07:00
Shengsong Tan
ad5948a810 Replace base::RandInt with std::uniform_int_distribution
As part of the effort to uprev libchrome in Android, we are
removing Android dependencies to libchrome utility functions
that are not strictly required.
This CL remove the usage of base::RandInt and replace by std cpp

Bug: 360917504
Change-Id: I83ea0f00ca07074f8c6c9a69db343a65cc8deb27
Test: atest libfs_avb_internal_test
2024-09-20 04:49:35 +00:00
Shengsong Tan
b5d9d909c5 Remove usage of base/string/* in libfs_avb
As part of the effort to uprev libchrome in Android, we are
removing Android dependencies to libchrome utility functions
that are not strictly required.

This CL remove the usage of base/string/* and replace by
android-base/string*

Bug: 360917504
Change-Id: I89e7bdd66bdf8f565f6b2084a70335616a644069
Test: atest libfs_avb_internal_test
2024-09-18 02:11:43 +00:00
Shengsong Tan
e322d54337 Merge "Remove usage of base/logging.h in libfs_avb" into main 2024-09-17 11:14:50 +00:00
Treehugger Robot
007f95d721 Merge "libsnapshot: CHECK -> CHECK_EQ" into main 2024-09-16 21:04:49 +00:00
Steven Moreland
7b577cf43c libsnapshot: CHECK -> CHECK_EQ
This will print the values of the strings which are not equal
so that we can debug.

Bug: 366531882
Test: build, TH
Change-Id: I36a2b8d3fbda145e07cd8ccb01152a3a3adf21b0
2024-09-16 17:24:25 +00:00
Shengsong Tan
26d10f1584 Remove usage of base/logging.h in libfs_avb
As part of the effort to uprev libchrome in Android, we are
removing Android dependencies to libchrome utility functions
that are not strictly required.

This CL remove the usage of base/logging.h and replace by
android-base/logging.h

Bug: 360917504
Test: atest libfs_avb_internal_test

Change-Id: Ibcc476aebcff2fe5cfc2e3a3cd04168c02bc05f5
2024-09-12 06:44:20 +00:00
Christopher Ferris
133fc74fa4 Remove unused variable.
Test: Builds with -Wunused-variable
Change-Id: Ibe6c28c8dd510303450f8400ba7d721fd5c44fc3
2024-09-09 19:59:06 +00:00
Xin Li
ef85e60f5a Merge "Merge 24Q3 to AOSP main" into main 2024-09-07 01:11:50 +00:00
Treehugger Robot
06e832372a Merge "Reland Skip F2FS formatting for dev option enabled devices" into main 2024-09-06 06:01:03 +00:00
Kelvin Zhang
dfca1f129e Reland Skip F2FS formatting for dev option enabled devices
F2FS does not support page_size!=block_size configuration, and
dev option devices need to toggle between 4K/16K mode, hence F2FS
requires a data wipe every time page size changes. This is inconveinent,
skip F2FS formatting instead.

The original CL had a bug where `iter->blk_device` is accessed before
checking if `iter` is out of bounds. Fixed by flipping order of two
conditions in an && operator.

Test: th
Bug: 353436188

This reverts commit 642a98e2a7.

Change-Id: I89551f219efc44bad29a190edff5412a5cc67840
2024-09-05 15:57:03 -07:00
Akilesh Kailash
81c5e02b50 snapshotctl: Check device for -img path
If the device exists only on /data, then the image path should
be checked with -img.

Bug: 330744468
Test: snapshotctl apply-update
Change-Id: I64ff7d803fdaaa02d2d6929994ad1124bfffab8b
Signed-off-by: Akilesh Kailash <akailash@google.com>
2024-09-05 13:54:12 -07:00
Treehugger Robot
473aa1de75 Merge "fs_mgr: Add support for MS_LAZYTIME." into main am: 33a742028e
Original change: https://android-review.googlesource.com/c/platform/system/core/+/3253877

Change-Id: I806ec7dd0d5454b050f730c61d66fdce21bf47d2
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-09-05 19:46:50 +00:00
Treehugger Robot
33a742028e Merge "fs_mgr: Add support for MS_LAZYTIME." into main 2024-09-05 19:32:47 +00:00
David Anderson
3217fa2158 fs_mgr: Add support for MS_LAZYTIME.
"lazytime" as a mount option was removed recently in favor of
MS_LAZYTIME.  This is causing mount failures when calling
IVold::commitChanges.

Bug: 329657783
Test: cuttlefish on android-mainline
Change-Id: Id01c1e5bbd0c82e07126be65f638e16600c058e3
2024-09-04 16:05:25 -07:00
Dan Shi
6767e393f0 Merge "Revert "Skip F2FS formatting for dev option enabled devices"" into main am: 5e359c04ac
Original change: https://android-review.googlesource.com/c/platform/system/core/+/3251222

Change-Id: Ie9e72fa2b184a5cb6e6f0b87a679fdd90a563cdd
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-08-31 03:18:55 +00:00
Dan Shi
5e359c04ac Merge "Revert "Skip F2FS formatting for dev option enabled devices"" into main 2024-08-31 03:10:10 +00:00
Dan Shi
642a98e2a7 Revert "Skip F2FS formatting for dev option enabled devices"
This reverts commit c2f2263bbf.

Reason for revert: possble cause of b/363089777

Change-Id: Ie7979e49bcbab6c99c0c7cba71e0b3858bfe0fbf
2024-08-30 23:14:15 +00:00
Akilesh Kailash
76a1e0ecdf Merge "libsnapshot: static link libselinux" into main am: 0049369534
Original change: https://android-review.googlesource.com/c/platform/system/core/+/3251031

Change-Id: I9d49c7a7eb22345c2c7ba8188bc41327b2c9dc8e
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-08-30 21:45:16 +00:00
Akilesh Kailash
0049369534 Merge "libsnapshot: static link libselinux" into main 2024-08-30 21:39:49 +00:00
Akilesh Kailash
a78a77bff4 Merge "libsnapshot: compile tests for both 32 and 64 bit" into main am: 172f412b25
Original change: https://android-review.googlesource.com/c/platform/system/core/+/3236906

Change-Id: Ie92e6cc1ad5f0a05b5760f9ffbf4c0c5c6c14e61
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-08-30 17:58:57 +00:00
Akilesh Kailash
109eae5cd7 libsnapshot: compile tests for both 32 and 64 bit
Bug: 360254891
Test: vts_libsnapshot_test
Change-Id: I7c49bf5e40c58022e1930e054ebc0bd9319b4da2
2024-08-30 09:10:40 -07:00
Akilesh Kailash
093fd351fa libsnapshot: static link libselinux
libsnapshot_init is linked by microdroid. Adding libselinux as whole_static_libs in `libsnapshot_defaults` will bloat the super image of microdroid.

Instead, statically link libselinux for libsnapshot_init.

On Pixel 7 Pro:

Microdroid super image: 47173836
Baseline (Without this change): 47161548

Bug: 362839899
Test: Build, verify microdroid super image size.
Change-Id: I3c589097173b305c1d39af9edbfb8c5e29f21410
Signed-off-by: Akilesh Kailash <akailash@google.com>
2024-08-30 05:29:50 +00:00
Kelvin Zhang
aeeadf43ad Merge "Make some fstab functions available outside of fs_mgr" into main am: 6e1b4c5a1e
Original change: https://android-review.googlesource.com/c/platform/system/core/+/3200691

Change-Id: I37940d837a59a413930fbd5a7924dd84518b76f2
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-08-29 17:24:56 +00:00
Kelvin Zhang
6e1b4c5a1e Merge "Make some fstab functions available outside of fs_mgr" into main 2024-08-29 17:15:05 +00:00
Treehugger Robot
2f70233fd8 Merge "Skip F2FS formatting for dev option enabled devices" into main am: b346ff1e23
Original change: https://android-review.googlesource.com/c/platform/system/core/+/3192001

Change-Id: Ife820d68ec082b8140184ec805c53ca07f61cfb7
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-08-29 14:58:09 +00:00
Treehugger Robot
b346ff1e23 Merge "Skip F2FS formatting for dev option enabled devices" into main 2024-08-29 14:54:42 +00:00
Jacky Jian
4dcb108e2f Merge "isBlockAligned to use uint64_t" into main am: be85b80f23
Original change: https://android-review.googlesource.com/c/platform/system/core/+/3248296

Change-Id: Ie1769a02d5fb520f51d18ba20581ef06668c2747
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-08-29 06:41:02 +00:00
Jacky Jian
be85b80f23 Merge "isBlockAligned to use uint64_t" into main 2024-08-29 06:37:41 +00:00
Daniel Zheng
15e9846473 isBlockAligned to use uint64_t
We want to avoid the usage of size_t for any integer value that could
exceed 2^32 (for 32 bit platforms). Let's update the usage here for
future compatibilty and avoid silent truncation failures.

Bug: 361048795
Test: th
Change-Id: I9ce2ca21706270a218f06f7d2b7dc9fade185a68
2024-08-28 19:27:09 +00:00
Treehugger Robot
fb0a0cc63e Merge "libsnapshot: Move snapshot metadata to super partition." into main am: 40f2bfd604
Original change: https://android-review.googlesource.com/c/platform/system/core/+/3183126

Change-Id: Ib527bdd0b45aa86fa3d4efb1a5debc6be7c54ca6
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-08-28 17:44:36 +00:00
Kelvin Zhang
c2f2263bbf Skip F2FS formatting for dev option enabled devices
F2FS does not support page_size!=block_size configuration, and
dev option devices need to toggle between 4K/16K mode, hence F2FS
requires a data wipe every time page size changes. This is inconveinent,
skip F2FS formatting instead.

Test: th
Bug: 353436188
Change-Id: Ic33dbc39c16db3aee4c47349a9693aacec240de8
2024-08-28 10:28:48 -07:00
Kelvin Zhang
f61be9ea39 Make some fstab functions available outside of fs_mgr
Test: th
Bug: 353436188
Change-Id: I5d1d80935d345245dece579ea2d2cbdb61ebaf11
2024-08-28 10:28:48 -07:00
Akilesh Kailash
398203d1da libsnapshot: Move snapshot metadata to super partition.
snapshot metadata files are stored in /metadata. This means, we cannot
wipe after installing any update.

This patch does the following:

1: Create a scratch space in super partition. The scratch space for ota
   metadata is just about 1MB.

2: Create ext4 filesystem on top of scratch block device.

3: Mount the scratch on /mnt/scratch_super

4: When snapshot-manager instance is created, point the /mnt/scratch/ota
to metadata_dir_ so that all the snapshot files are stored in the new
path.

All the logic of OTA remains the same. This flow is enabled only on userdebug builds for now and the only consumer would be snapshotctl

$snapshotctl apply-update /data/nbd/ -w

During init, we would have to mount the scratch partition to detect
if there is any pending updates.

With this, we would now be able to wipe the device along with the update flow. This will help incremental flashing wherein we would end up saving ~35-40 seconds on Pixel devices.

With this flow, the end-to-end update for incremental builds takes
~20-30 seconds.

Bug: 330744468
Test: Pixel 6 incremental flashing with wipe, Full OTA, vts_libsnapshot
Change-Id: Iac6ce2cf37b70ea221cd18175c8962988d03d95b
Signed-off-by: Akilesh Kailash <akailash@google.com>
2024-08-27 23:48:03 -07:00
Terry Guan
6c2ae18845 Merge "Add resume from hibernation in first stage init" into main am: adcba86848
Original change: https://android-review.googlesource.com/c/platform/system/core/+/3225543

Change-Id: Ie0d25b69ac9b94e7927cb323ee0f0b93571048f6
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-08-27 21:31:26 +00:00
Terry Guan
adcba86848 Merge "Add resume from hibernation in first stage init" into main 2024-08-27 21:22:51 +00:00
terryguan
d96c6b8e88 Add resume from hibernation in first stage init
If bootconfig hibernation_resume_device is present in boot config, then
we write that value to /sys/power/resume

Bug: 339688542
Test: Check resume from hibernation/boots with/without config present
Change-Id: I1a9bf63af4dab07e494740722898c1aba33c00b5
2024-08-27 09:37:25 -07:00
Julien Desprez
702754a23e Merge "Move snapuserd_test to general-tests" into main am: a989252bdd
Original change: https://android-review.googlesource.com/c/platform/system/core/+/3238978

Change-Id: If905f8ce359bfb1f300a2bb684823786dde48ac1
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-08-23 16:09:58 +00:00
Julien Desprez
3f11b6ac64 Move snapuserd_test to general-tests
The test should be able to build and run from generic-build.

Change-Id: I380565bbcae53c454fa1cbff655c8c6fe1000097
Test: presubmit
Bug: 358400696
2024-08-23 04:02:09 +00:00