Commit graph

84845 commits

Author SHA1 Message Date
Tomasz Wasilczyk
1578cb3c14 Introduce libutils_binder_sdk
Bug: 285204695
Test: mma in Binder directory
Change-Id: I430b81594167940cb47897e4261ad87c75ac3783
2023-12-07 14:04:16 -08:00
Treehugger Robot
1b44b8c6d6 Merge changes from topic "cgroup.events" into main
* changes:
  libprocessgroup: Use cgroup.kill
  libprocessgroup: Poll on cgroup.events
2023-12-07 19:40:11 +00:00
Treehugger Robot
e5bb7ef272 Merge "trusty: apploader: fail specifically if app package is 0 bytes" into main 2023-12-07 18:53:08 +00:00
Mike McTernan
b22e5bcf60 trusty: apploader: fail specifically if app package is 0 bytes
Replace assert with check and log message.  Also log more about the request if DMA heap allocation fails.

Bug: 315283243
Test: boot to home
Test: touch x && trusty_apploader x
Change-Id: Ic075809fd2a6b09d9c4e8dff986709c4deae8fb7
2023-12-07 12:16:09 +00:00
Massimo Carli
367d732f3c Merge "Revert "Calculate ro.vendor.api_level with the new vendor API format"" into main 2023-12-07 11:22:17 +00:00
Massimo Carli
08534b8d0b Revert "Calculate ro.vendor.api_level with the new vendor API format"
This reverts commit e267e31d73.

Reason for revert: b/315246126

Change-Id: I456858c6f4c528158c0826efcdc1509b701c32f7
2023-12-07 09:19:24 +00:00
Justin Yun
698c6f9035 Merge "Calculate ro.vendor.api_level with the new vendor API format" into main 2023-12-07 03:54:45 +00:00
T.J. Mercier
38b8bb1e4a libprocessgroup: Use cgroup.kill
By using cgroup.kill we don't need to read cgroup.procs at all for
SIGKILLs, which is more efficient and should help reduce CPU contention
and cgroup lock contention. Fallback to cgroup.procs if we encounter an
error trying to use cgroup.kill, but if cgroup.kill fails it's likely
that cgroup.procs will too.

Bug: 239829790
Change-Id: I44706faccfb7c4611b512a3642b913f06d30c1dc
2023-12-07 00:12:07 +00:00
T.J. Mercier
3b5bb3a364 libprocessgroup: Poll on cgroup.events
In killProcessGroup we currently read cgroup.procs to find processes to
kill, send them kill signals until cgroup.procs is empty, then remove
the cgroup directory. The cgroup cannot be removed until all processes
are dead, otherwise we'll get an EBUSY error from the kernel.

There is a race in the kernel where cgroup.procs can read empty even
though the cgroup is pinned by processes which are still exiting, and
can't be removed yet. [1]

Let's use the populated field of cgroup.events instead of an empty
cgroup.procs file to determine when the cgroup is removable. In
addition to functioning like we expect, this is more efficient because
we can poll on cgroup.events instead of retrying kills and rereading
cgroup.procs every 5ms which should help reduce CPU contention and
cgroup lock contention.

It's still possible that it takes longer for a cgroup to become
unpopulated than our timeout allows, in which case we will fail to
remove the cgroup and leak kernel memory. But this change should help
reduce the probability of that happening.

[1] https://lore.kernel.org/all/CABdmKX3SOXpcK85a7cx3iXrwUj=i1yXqEz9i9zNkx8mB=ZXQ8A@mail.gmail.com/

Bug: 301871933
Change-Id: If7dcfb331f47e06994c9ac85ed08bbcce18cdad7
2023-12-07 00:12:00 +00:00
Siim Sammul
73ade16187 Merge "Move tombstone_proto_to_text out of libdebuggerd." into main 2023-12-06 10:13:18 +00:00
Treehugger Robot
442990fc5c Merge "Fix cow v3 size estimation errors" into main 2023-12-06 06:32:13 +00:00
Treehugger Robot
e5524c0669 Merge "Fix -Wunused-variable compiler warning" into main 2023-12-06 06:17:34 +00:00
Kelvin Zhang
d45c50911f Fix cow v3 size estimation errors
Current cow size estimation is computed by taking the offset of next
data write. However, during COW size estimation we repeatdly increment
op_count_max. Since data section is placed right after op section,
incrementing  op_count_max has the effect of moving the beginning of
data section. next_data_pos_ is never updated in this process, causing
the final estiamte to be off.

Test: th
Bug: 313962438
Change-Id: I250dff54c470c9c20d6db33d91bac898358dee31
2023-12-05 21:27:38 -08:00
Yi Kong
90f6cb4b2c Fix -Wunused-variable compiler warning
Test: presubmit
Change-Id: Ia6d0a735c94c7be39994fb9c8ae4d3b65d6f4301
2023-12-06 14:07:36 +09:00
Jaegeuk Kim
2f56ec931a Merge "Use target path when handling dm-bow" into main 2023-12-06 02:34:37 +00:00
Treehugger Robot
1772cd427c Merge "Match upstream API change" into main 2023-12-06 01:28:10 +00:00
Jaegeuk Kim
995dd0385e Use target path when handling dm-bow
Refactor getting sysfs directory.

Bug: 312817490
Change-Id: Icc12002d3f5a2e24f86ce88e5e602cf7a71b0f84
Signed-off-by: Jaegeuk Kim <jaegeuk@google.com>
2023-12-05 17:16:17 -08:00
Florian Mayer
6757ecd2a3 Match upstream API change
Change was done in
e68c265543

Change-Id: Id1a288dfdb5edb7cb7d639ec4548926cc4085d8c
2023-12-06 00:16:43 +00:00
Kelvin Zhang
ad51f09b05 Merge "Fix multiple calls to set_[source/type]" into main 2023-12-05 20:15:41 +00:00
Kelvin Zhang
12e0531224 Fix multiple calls to set_[source/type]
Since currently implementation just does an bitwise or with the
storage unit, multiple calls to set_source would result in overlapping
bits. Fix by first clear the existing storage.

Test: th
Bug: 313962438
Change-Id: Iecfe8dd244c0f65ecd3cacb0404fdc39ef836d97
2023-12-05 10:28:12 -08:00
Yi Kong
96fd39c228 Merge "Fix -Wunused-variable compiler warning" into main 2023-12-05 15:01:46 +00:00
Lucas Henneman
eadaf5faff Merge "TEST_MAPPING: fix syntax of TODO tag" into main 2023-12-05 14:29:55 +00:00
Siim Sammul
c08a34e3dc Move tombstone_proto_to_text out of libdebuggerd.
This is done so that we could depend on it elsewhere without needing all the unrelated methods.
Needed for ag/24553347

Bug: 296207744
Test: refactoring build
Change-Id: I7c6733208f3ae63ba9559753a24cffcb8e1b9d1e
2023-12-05 10:14:27 +00:00
Yi Kong
b8bbc43489 Fix -Wunused-variable compiler warning
Test: presubmit
Change-Id: I63b1625decd3dcdb9f405c8825203e04810c282c
2023-12-05 18:36:00 +09:00
Akilesh Kailash
160e4c3cee Merge changes from topic "ota-tune-1" into main
* changes:
  Allow direct reads on source device
  libsnapshot: Tune readahead during OTA for source and COW block device
2023-12-04 23:53:41 +00:00
Treehugger Robot
f7fffb62d4 Merge "Allow Cow version v3 to be used" into main 2023-12-04 23:02:53 +00:00
Akilesh Kailash
52f1c19a17 Allow direct reads on source device
Allow O_DIRECT reads on source block device.
This will further cut down the Active and Inactive file pages
during partition verification.

On Pixel 6 after incremental OTA - Post OTA reboot:

		Without patch      With patch     Delta
--------------------------------------------------------
Inactive(File):  4992MB             3887MB         ~22%
Active(File):    1465MB             1014MB         ~30%

Boot time however increases from 25 to 30 seconds.

This is not yet enabled. This will be behind a sysprop flag
or for low memory devices and will be enabled later.

Additionally, set the priority of worker threads to normal.
Merge threads priority is reduced. This will help low memory
devices as tested on Pixel watch.

Bug: 311233916
Test: OTA on Pixel 6
Change-Id: Icacdef08d68e28d3062611477703e7cf393a9f10
Signed-off-by: Akilesh Kailash <akailash@google.com>
2023-12-04 14:07:42 -08:00
Akilesh Kailash
a8f6ce3344 libsnapshot: Tune readahead during OTA for source and COW block device
Scanning of partitions post OTA leads to memory pressure. Tune
the read-ahead of source and COW block device. This is currently
set to 32KB.

This reduces Inactive(file) and Active(file) usage during entire
duration of boot post OTA.

On Pixel 6: For incremental OTA ~400M. During boot:

                            Without-patch         With-patch    Delta
			    --------------------------------------------
1: Peak Inactive(file):     4469MB                3118MB        ~30%

2: Peak Active(file):       985MB                 712MB         ~27%

No regression observed on boot time.

Additionally, cut down the number of threads to verify the partitions.

Bug: 311233916
Test: Incremental OTA on Pixel 6
Change-Id: I0b842776c36fa089c39c170fa7bf0f246e16636d
Signed-off-by: Akilesh Kailash <akailash@google.com>
2023-12-04 14:07:26 -08:00
Treehugger Robot
240f7084be Merge "Shove CowOperation type into source_info" into main 2023-12-04 18:50:46 +00:00
Kelvin Zhang
7d526560df Allow Cow version v3 to be used
This does not change the default cow version. Currently v2 is still the
default. This CL only enables OEMs to set virtual_ab_cow_version to 3
for testing purposes.

Test: th
Bug: 313962438
Change-Id: I7a328fa32283560a48604ffe02edd2551ac49a83
2023-12-04 09:29:20 -08:00
Kelvin Zhang
2bf1da5d2c Shove CowOperation type into source_info
We can shove type into source info to save 8 bits in per cow operation.
We only need 4 bits inside of source_info to enumerate all the types of
Cow Operation. Since CowOperationV3 is not used on disk(just yet) , we
can make format changes.

This CL is mechanical:
    1. Remove tye .type field from CowOperation struct
    2. Add a type() getter method to CowOperation struct
    3. Replace all existing usage of `type` member with the new getter

No functional changes, just refactorings.

Test: th
Bug: 304602386
Bug: 313962438

Change-Id: I85d89c71fc6afede12ea299a4a3e3b2184ea2d8b
2023-12-04 09:14:20 -08:00
Treehugger Robot
3ecba6b927 Merge "fs_mgr_overlayfs: MapScratchPartitionIfNeeded always tries to create scratch" into main 2023-12-04 02:53:30 +00:00
Elliott Hughes
1784219094 Merge "fs_mgr: IWYU include <algorithm> for std::sort" into main 2023-12-01 22:22:34 +00:00
Lucas Henneman
3bcfa9c039 TEST_MAPPING: fix syntax of TODO tag
Bug: 279009697
Test: git diff
Change-Id: I7133bc0abe6634193b0fb006f5cd77ed2dc05844
Signed-off-by: Lucas Henneman <henneman@google.com>
2023-12-01 20:17:42 +00:00
Bart Van Assche
1a97c485d0 Merge "task_profiles.json: Set io.prio.class" into main 2023-12-01 18:02:56 +00:00
Bart Van Assche
a34c125cad Merge "service_test: Only run the ServiceStopTest as root" into main 2023-12-01 03:08:02 +00:00
Treehugger Robot
56f7436a3e Merge "Allow to set scudo allocation buffer size" into main 2023-12-01 02:52:38 +00:00
Daniel Rosenberg
4ae617f676 Merge changes I1ecdffcb,Ib0d1ea81 into main
* changes:
  fs_mgr: Support 16k F2FS
  fs_mgr_overlayfs: Support 16k F2FS
2023-12-01 00:52:16 +00:00
Bart Van Assche
9bba87244d task_profiles.json: Set io.prio.class
Provide an additional way to request the block layer to prioritize
foreground I/O over background I/O. This patch prepares for tests with
the mq-deadline I/O scheduler. While CFQ and BFQ support a "weight"
cgroup attribute, the mq-deadline scheduler does not. The mq-deadline
I/O scheduler only supports the I/O priority class for differentiating
I/O priorities.

The io.prio.class attribute is declared optional since this attribute
only exists if CONFIG_BLK_CGROUP_IOPRIO != n in the kernel
configuration.

Bug: 186902601
Change-Id: Iee1004cd0996e32245aff2b51772ef40178e024f
Signed-off-by: Bart Van Assche <bvanassche@google.com>
2023-11-30 10:00:44 -08:00
Bart Van Assche
fb3e64ab42 service_test: Only run the ServiceStopTest as root
Despite 'require_root: true' in Android.bp for CtsInitTestCases, it can
happen that this test is run without root privileges. If that happens,
skip the ServiceStopTest.

Bug: 313551148
Change-Id: I45f29369915a1f61e08ffd9bf5601a83a147597c
Signed-off-by: Bart Van Assche <bvanassche@google.com>
2023-11-30 10:00:43 -08:00
Treehugger Robot
58beb4a624 Merge "Remove marcone@google.com from trusty/OWNERS" into main 2023-11-30 17:08:20 +00:00
Owner Cleanup Bot
3d37da29e7 Remove marcone@google.com from trusty/OWNERS
This suggested change is automatically generated based on group
memberships and affiliations.
If this change is unnecessary or in error, vote CR -1 and the bot
will abandon it. Vote CR +1/2 to approve this change.

See the owner's recent activity for context:
https://android-review.googlesource.com/q/marcone@google.com

To report an issue, file a bug in the Infra>Codereview component.

Change-Id: Ia8f5d261cbfc7328c7dffa0bdf92a5732ba3eee8
2023-11-30 16:37:53 +00:00
Steven Moreland
e9c24760d3 Merge "Looper: Fixed compile error when enabling DEBUG_CALLBACKS" into main 2023-11-30 02:06:43 +00:00
Akilesh Kailash
37e7498fc0 Merge "snapshotctl: fsync after writing every 1MB buffer" into main 2023-11-29 20:37:55 +00:00
Kelvin Zhang
54702a79f9 Merge "Turn CowOperationType into an enum" into main 2023-11-29 20:26:05 +00:00
Akilesh Kailash
b78d0e2856 snapshotctl: fsync after writing every 1MB buffer
Sync writes after every 1MB instead of flushing at the end.

Bug: 299011882
Test: Boot device off snapshots
Change-Id: If91168ec92c2b2995bdf296ea1c7d4c261b12411
Signed-off-by: Akilesh Kailash <akailash@google.com>
2023-11-29 11:26:46 -08:00
Kelvin Zhang
1ccb347e87 Turn CowOperationType into an enum
There's a bug previsouly where we compare return value of
GetCowOpSourceInfoData() with CowOperationType. Such bugs are possible
because cow operation enums are weakly typed integers. Turn
CowOperationType into strongly typed enum to prevent such bugs.

Test: th
Bug: 304602386
Change-Id: If6941a4740c374ed066cf0aee9e52f4df05a9b38
2023-11-29 10:46:10 -08:00
Kai Sky
862f049d17 Looper: Fixed compile error when enabling DEBUG_CALLBACKS
When enabling DEBUG_CALLBACKS , compiler complains
for the undeclared identifier 'fd'.
Fix by removing undeclared objects.

Change-Id: I751a9ef9d8843350105acd6a30645f897050ffa4
2023-11-29 05:41:01 +00:00
Treehugger Robot
0ca4e8f4b4 Merge "service_test: Test stopping services after migration to another cgroup" into main 2023-11-28 00:14:31 +00:00
Treehugger Robot
57359b731e Merge "libprocessgroup: Stop services that have been migrated to another v2 cgroup" into main 2023-11-27 23:23:12 +00:00