Commit graph

90463 commits

Author SHA1 Message Date
Dennis Shen
f1eaa75168 move aconfigd platform init service from init.rc into aconfigd.rc
Bug: 378079539
Test: m
Change-Id: I10c306468bf3efe3b5186851cb09b576b143512a
2024-11-11 17:44:14 +00:00
Dennis Shen
b842f642d9 Merge "Start aconfigd_system processes in init.rc" into main 2024-11-11 14:33:09 +00:00
Treehugger Robot
fa528cccf6 Merge "init: Avoid extra string copies when finding devices by using const refs" into main 2024-11-11 02:05:44 +00:00
Douglas Anderson
46afe22f9d init: Avoid extra string copies when finding devices by using const refs
Now that FindPlatformDevice() isn't modifying the path argument, and
is just passing it on to FindSubsystemDevice(), take this argument by
const reference. That should avoid an unnecessary string copy.

Bug: 316324155
Test: Compile
Change-Id: I1d92a322d0c311ee46a117dd9d650896ec02520f
2024-11-08 15:48:35 -08:00
Priyanka Advani (xWF)
244a63066b Merge "Revert "Deprecating libvendorsupport_llndk_headers"" into main 2024-11-08 19:05:16 +00:00
Ted Bauer
3c700588c7 Start aconfigd_system processes in init.rc
aconfigd_system is replacing aconfigd. Which one executes is toggled
by RO flag enable_system_aconfigd_rust, introduced in https://android-review.googlesource.com/q/topic:%22switch-to-aconfigd-system%22.

Bug: 378079539
Test: m
Change-Id: I6a04c38e9ef22da2b230046ddace73d6f7e39652
2024-11-08 17:45:16 +00:00
Priyanka Advani (xWF)
ab8f9717f1 Revert "Deprecating libvendorsupport_llndk_headers"
Revert submission 3334193-no-llndk-versioning

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

Reverted changes: /q/submissionid:3334193-no-llndk-versioning

Change-Id: Id8d85be1930bef68f94cee66a0fe29278de48d64
2024-11-08 17:37:26 +00:00
Treehugger Robot
2a5bef2e98 Merge "Deprecating libvendorsupport_llndk_headers" into main 2024-11-08 06:29:05 +00:00
Hung Nguyen
fb954abea6 Merge "Increase zram size percentage limit" into main 2024-11-08 05:09:37 +00:00
Hung Nguyen
ce6f7330ad Increase zram size percentage limit
To allow experimenting with zram size larger than device memory size.

Bug: 368286978
Test: atest CtsFsMgrTestCases

Change-Id: I47a4a4e6af39571d13e4622d110c92936008127e
2024-11-07 15:16:17 -08:00
Treehugger Robot
308bcbea8e Merge "Increase the test timeout" into main 2024-11-07 23:07:11 +00:00
Akilesh Kailash
e5a2af34b3 Increase the test timeout
Bug: 338329603
Test: Build success
Change-Id: I97008dbe112d87ef2f4bff5605beb41cc4b1fac7
Signed-off-by: Akilesh Kailash <akailash@google.com>
2024-11-07 13:43:13 -08:00
Treehugger Robot
c43fd51571 Merge "init: Look for partition only on a boot device if using boot_part_uuid" into main 2024-11-07 16:59:48 +00:00
Doug Anderson
f3e994b439 Merge changes If824cb70,I025d9d68,Ic5a57a89,If5d63f39,I1adb1906 into main
* changes:
  init: Add the ability to find the boot device by partition UUID
  init: Move the stripping of "/devices" and "/devices/platform/" to a helper
  init: Break FindPlatformDevice() into a helper function
  init: Factor GetBlockDeviceInfo() out of GetBlockDeviceSymlinks()
  init: Use ConsumePrefix() instead of open coding in GetBlockDeviceSymlinks()
2024-11-07 15:28:10 +00:00
T.J. Mercier
574da62341 Merge "Revert "Set input thread priority to RT - try 3"" into main 2024-11-06 21:50:40 +00:00
Liana Kazanova
52da71d47b Revert "Set input thread priority to RT - try 3"
This reverts commit a2bd0e6b5d.

Reason for revert:DroidMonitor: Potential culprit for http://b/377739155 - verifying through ABTD before revert submission. This is part of the standard investigation process, and does not mean your CL will be reverted.

Change-Id: I4c2b686aaf291db819d37711d4427d0094ca2295
2024-11-06 21:42:29 +00:00
Douglas Anderson
eb3d280f1e init: Look for partition only on a boot device if using boot_part_uuid
The current code waits for boot partitions to show up by waiting to
see a uevent with the right partition name. However, nothing in the
waiting code validates that the partition that showed up is actually
on the boot device. That means that the current code can be confused
if there is another block device in the system (possibly connected via
USB) that has a partition name matching one of the system ones.

It can be noted that the problem is specifically just that the
"waiting" part returns too early. Later parts of the system,
specifically the parts of the system that create the
"/dev/block/by-name" symlinks, do properly look at the list of "boot
devices". This means that the problem we're fixing is that later code,
which assumes that the boot partitions have already initialized, can
fail to find an initialized partition.

To make it concrete, imagine that you have two block devices in your
system: the builtin emmc and an external USB disk. Let's say you're
booting over USB and "boot_devices" properly lists only USB. Both the
"emmc" and "USB" block devices are properly formatted Android disks
and have the full slew of partitions. At boot time, you can see:
1. We get to the point where we need to wait for the "boot" source
   (USB) to show up.
2. We see the eMMC show up.
3. The eMMC has all the needed partitions, so we consider our wait
   done. ...but eMMC isn't in the list of "boot devices" so we don't
   create the "/dev/block/by-name" symlinks.
4. Later code assumes that the "/dev/block/by-name" symlinks are
   already setup and fails.
5. The device fails to boot.

Fix it so that the wait makes sure that the partitions are on the boot
device.

Unfortunately, it appears that in some cases products (especially
emulators) aren't setting the "boot devices" and/or are not making
sure all boot partitions are on the same device. Limit the fix to only
devices using the new "boot_part_uuid" to make sure we don't break old
code.

NOTE: this is effectively the same change as a previous one ("init:
Look for super partition only on a boot device") but with the added
fix to only enable the check when using "boot_part_uuid".

Bug: 309244873
Bug: 349144493
Bug: 316324155
Test: Boot isn't confused when two boot devices are present
Change-Id: Iaae453ed661307f485cdf4dde86294105cae9b2d
2024-11-06 13:03:15 -08:00
Douglas Anderson
e9de310061 init: Add the ability to find the boot device by partition UUID
The current mechanism for specifying boot devices on Android systems
involves passing a set of "boot_devices" though command line,
bootconfig, or device tree.

The bootdevices are specified as strings and, in general, need to
match a sysfs path but without the "/sys/devices" or
"/sys/devices/platform" prefix. The sysfs path is generally the path
to the closest parent of the block device that is a "platform" device.

As an example, if the sysfs path of the expected boot device is:
  /sys/devices/platform/soc@0/7c4000.mmc/mmc_host/mmc1/mmc1:0001/block/mmcblk1

The bootloader would specify it as "soc@0/7c4000.mmc" since:
* We strip off "/sys/devices/platform/"
* As we move up directories, we don't find one whose subsystem is
  "platform" until we get up to
  "/sys/devices/platform/soc@0/7c4000.mmc".

The current mechanism is a bit brittle. Specifically:
* The sysfs path isn't _really_ stable and can change across kernel
  upgrades. For instance, during one kernel upgrade the device tree
  for a product changed so that the root node changed from "soc" to
  "soc@0" and this changed all sysfs paths. In the past device tree
  folks have asserted that we shouldn't rely on dts node names to stay
  consistent, yet those node names are used to construct sysfs paths.
* For some devices, like USB, the path of the closest "platform"
  device tends to be the path of the USB controller. This means that
  if two USB disks are plugged in we can't guarantee which one will be
  identified as the boot device.

Add a new method of finding the boot device by passing the partition
UUID that we loaded the kernel from. Using the partition UUID to
identify the boot device is standard on Linux. You can see this
because when you're not using an initramfs you can use the syntax
"root=PARTUUID=<valid-uuid-id>[/PARTNROFF=n]" to specify the root.
Using the same idea for Android's boot code makes sense.

With this new method for finding the boot device, we can make the code
much more specific about matching sysfs paths. Once we find the sysfs
path for the kernel we can make sure that all of the other boot
partition share the same "scsi" or "mmc" parent instead of going all
the way to the closest platform device. In the above example, this
means that we'd make sure that all boot devices are found under this
sysfs node:
  /sys/devices/platform/soc@0/7c4000.mmc/mmc_host/mmc1/mmc1:0001/block/mmcblk1
...instead of just making sure they are under:
  /sys/devices/platform/soc@0/7c4000.mmc

There is the question of what we should do if the bootloader passes
_both_ an old style "boot_devices" and also a partition UUID. In this
case, we'll issue a warning and then ignore the old "boot_devices".
Considering it a warning rather than an error could allow switching to
the "boot_part_uuid" method even if an old bootloader is still
hardcoding some old "boot_devices".

NOTE: Using partition UUID won't cause any security problems even
though someone _could_ plug in an external device crafted to have the
same UUID as the normal boot device's kernel partition. We already
have "verity" in the system making sure our filesystems are not
tampered with and this would also protect us from booting a tampered
disk. That means that the worst someone could do in this case would be
to confuse the system and make the device non-bootable. Chromebooks
have been using the partition UUID to find the root filesystems for
years and this has never been a problem.

NOTE: this new method relies on the commit ("init: Add partition_uuid
to Uevent") which in turn relies upstream kernel commit 74f4a8dc0dd8
("block: add partition uuid into uevent as "PARTUUID"").

Bug: 316324155
Test: Use partition UUID to boot

Change-Id: If824cb700ca3696a442a28e6ad02d7c522c3b495
2024-11-06 13:03:15 -08:00
Douglas Anderson
3de05fcff6 init: Move the stripping of "/devices" and "/devices/platform/" to a helper
A future change will want the same stripping when looking for USB boot
devices. Move the stripping down to the helper.

This change is intended to be a no-op and just a reorganization.

Bug: 316324155
Test: See boot devices still found
Change-Id: I025d9d68fedf652055454cbd93e15f480b6056dd
2024-11-06 13:03:15 -08:00
Douglas Anderson
6519e6d67f init: Break FindPlatformDevice() into a helper function
We want to use the logic for FindPlatformDevice() in a future change
to look for devices that have USB parents. Break out a helper
function.

This change is intended to be a no-op and just a reorganization.

Bug: 316324155
Test: See boot devices still found
Change-Id: Ic5a57a89339c43dea1334644be9386637169c61c
2024-11-06 13:03:15 -08:00
Douglas Anderson
9481f97603 init: Factor GetBlockDeviceInfo() out of GetBlockDeviceSymlinks()
Later code will want to use GetBlockDeviceInfo(), so factor it out to
a helper function. This change is intended to be a no-op.

Bug: 316324155
Test: Build & boot
Change-Id: If5d63f39efcd84a07eb8c6fa4f28bda45c4cbe5c
2024-11-06 13:03:14 -08:00
Douglas Anderson
743e8f16a7 init: Use ConsumePrefix() instead of open coding in GetBlockDeviceSymlinks()
In GetBlockDeviceSymlinks() we may need to strip the
"/devices/platform/" or "/devices/" from a string. Use the helper
ConsumePrefix() to do this, which is more convenient and readable.

This change is intended to be a no-op and just a cleanup.

Bug: 316324155
Test: Build and boot
Change-Id: I1adb1906ec37ff8f6f505abc5f26e1e3b157e608
2024-11-06 12:22:48 -08:00
Treehugger Robot
04130ee930 Merge "Set input thread priority to RT - try 3" into main 2024-11-06 18:53:25 +00:00
Siarhei Vishniakou
a2bd0e6b5d Set input thread priority to RT - try 3
This partially reverts commit de6707df0c.

Reason for revert: code change landed, now modifying JSON file only

Original description:

To improve input latency, set the critical input threads to RT priority.
This will use RT priority on AOSP devices by default. OEMs can still
choose to customize what "input policy" means for their device, which
may not necessarily mean RT.

For example, on device with multiple small / big cores, input task
affinity could be changed to prioritize big cores + higher CPU frequency
/ voltage, but still keep the standard / default input thread priority.

With this patch, I'm finding that sometimes, one of the critical input
threads has priority 100 instead of the expected 98. Still looking into
that specific issue, but the issue is already present with the existing
"input policy" code.

Bug: 330719044
Flag: com.android.input.flags.enable_input_policy_profile
Test: took perfetto trace and checked the priority on InputDispatcher
and InputReader threads.

Change-Id: I7d8a941f36ad9e4b75a7a0f4c5d81895256d6919
2024-11-06 16:57:37 +00:00
Doug Anderson
5d5906fb02 Merge changes I819eb60a,I48a52aa0,Iab04742c into main
* changes:
  init: Reorder GetBlockDeviceSymlinks() so FindDmDevice() is first
  init: Add partition_uuid to Uevent
  fs_mgr: Add getter for androidboot.boot_part_uuid
2024-11-06 16:40:33 +00:00
Treehugger Robot
41e9d7d3a2 Merge "snapuserd: typecast cow_op->new_block to uint64_t" into main 2024-11-06 10:15:46 +00:00
Akilesh Kailash
01af5431f7 snapuserd: typecast cow_op->new_block to uint64_t
On 32-bit devices, cow_op->new_block * BLOCK_SZ can overflow.

Bug: 376978542
Test: snapuserd_test on 32-bit device
1: Initiate merge on partition > 4GB.
2: Verify no overflow.

Change-Id: I4efc24891e0b330505ddf59b7db7716f054cf9c4
Signed-off-by: Akilesh Kailash <akailash@google.com>
2024-11-05 22:22:12 -08:00
Jooyung Han
06c4e96fd8 Deprecating libvendorsupport_llndk_headers
Versioned LLNDK symbols are guarded with __builtin_available.

Bug: 362658565
Test: m --no-skip-soong-tests
Change-Id: I0fb3bc87b74da62b8a8fba0c5bb6a3373e6a55dc
2024-11-06 13:54:01 +09:00
Douglas Anderson
9f760f8d41 init: Reorder GetBlockDeviceSymlinks() so FindDmDevice() is first
By moving FindDmDevice() it's easier to unify the code with the
IsBootDevice() function. In this case the order doesn't matter since
anything with the uevent path "/devices/virtual/block/dm-" (the only
devices FindDmDevice() looks at) won't match any of the other sections
of the if/then/else test.

Bug: 316324155
Test: Build & boot

Change-Id: I819eb60aa5077f0eb2c2f2783b152e43a52ba8b7
2024-11-05 15:55:26 -08:00
Douglas Anderson
e53e50e3fa init: Add partition_uuid to Uevent
As of commit upstream Linux kernel commit 74f4a8dc0dd8 ("block: add
partition uuid into uevent as "PARTUUID""), it's easy to include the
partition UUID in the Uevent structure. Add it in so that other parts
of the init code can make decisions based on the partition UUID.

If this code is run on older kernels we'll never see the partition
UUID and it will be left blank.

Bug: 316324155
Test: Run w/ a newer kernel and see partition_uuid populated.
Change-Id: I48a52aa006c05023f7f1cc5cc0ab5c1f1ec37455
2024-11-05 15:55:26 -08:00
Douglas Anderson
519d3f8b36 fs_mgr: Add getter for androidboot.boot_part_uuid
In order to make booting from some media types (like USB) more robust,
the bootloader will be extended to support passing the partition UUID
that it loaded the kernel from. It can pass this via kernel
commandline or via bootconfig. Add a way to get this.

Bug: 316324155
Test: Use the getter in a future change

Change-Id: Iab04742c0f2666db18dc48bcaaa2869eba405748
2024-11-05 15:55:25 -08:00
Treehugger Robot
71707037b1 Merge "libsnapuserd: Handle empty response from server" into main 2024-11-04 17:26:04 +00:00
Alice Wang
abe7640a21 Merge "Rename KM VM related system properties" into main 2024-11-04 10:39:37 +00:00
Akilesh Kailash
454167f5bd libsnapuserd: Handle empty response from server
If server disconnects, then handle the empty response.

Bug: 377068272
Test: Full OTA
Change-Id: Ic48204c457ef924ba9a3c1ae84a3317fb1ccda04
Signed-off-by: Akilesh Kailash <akailash@google.com>
2024-11-02 23:43:22 -07:00
Treehugger Robot
0aaec875e8 Merge "libsnapshot: Update libprocessgroup dependencies" into main 2024-11-01 22:38:52 +00:00
Treehugger Robot
6c13c6ce5b Merge "libcutils: Update libprocessgroup dependencies" into main 2024-11-01 22:34:53 +00:00
Treehugger Robot
816d42ce9b Merge "libprocessgroup: Update libprocessgroup dependencies" into main 2024-11-01 22:31:35 +00:00
T.J. Mercier
0b678adb6a libcutils: Update libprocessgroup dependencies
Bug: 349105928
Change-Id: I9d9230e415724657f9d49a09861f1046fbe4dc55
2024-11-01 21:17:33 +00:00
T.J. Mercier
8a45aaaf12 libprocessgroup: Update libprocessgroup dependencies
Bug: 349105928
Change-Id: Iee047ccafe4c71eaf9c614fbe9a68585645a16f8
2024-11-01 21:16:29 +00:00
T.J. Mercier
b1f0c1bfda libsnapshot: Update libprocessgroup dependencies
Bug: 349105928
Change-Id: I0a795c185ae453b86e0373e6786bd77a0d265b01
2024-11-01 21:16:08 +00:00
Treehugger Robot
65ebd83d9c Merge "Revert^4 "Set block device as RO/RW before mount"" into main 2024-11-01 20:38:40 +00:00
Yihan Dong
972eae34d8 Merge "Add proposed trendy teams for VTS modules" into main 2024-11-01 00:24:59 +00:00
Treehugger Robot
7ba45dca19 Merge "Set input thread priority to RT - try 2" into main 2024-10-31 23:51:47 +00:00
Treehugger Robot
9be749fe98 Merge changes Ibd1a942d,Ie07cee76 into main
* changes:
  libmodprobe: add support for dynamic module options
  firmware_handler: extract part responsible for running ext program to lib
2024-10-31 23:09:40 +00:00
Siarhei Vishniakou
a3cf826de6 Set input thread priority to RT - try 2
This reverts commit de6707df0c.

Reason for revert: changing code without modifying JSON file now

Original description:

To improve input latency, set the critical input threads to RT priority.
This will use RT priority on AOSP devices by default. OEMs can still
choose to customize what "input policy" means for their device, which
may not necessarily mean RT.

For example, on device with multiple small / big cores, input task
affinity could be changed to prioritize big cores + higher CPU frequency
/ voltage, but still keep the standard / default input thread priority.

With this patch, I'm finding that sometimes, one of the critical input
threads has priority 100 instead of the expected 98. Still looking into
that specific issue, but the issue is already present with the existing
"input policy" code.

Bug: 330719044
Flag: com.android.input.flags.enable_input_policy_profile
Test: took perfetto trace and checked the priority on InputDispatcher
and InputReader threads.

Change-Id: I3dabf4da0398324cf542e701c103551343b883cf
2024-10-31 22:39:25 +00:00
Maciej Żenczykowski
503ac71b43 Merge "Revert "Set input thread priority to RT"" into main 2024-10-31 21:31:23 +00:00
Peter Collingbourne
f59ca8c294 Merge "Add support for tombstone symbolization to pbtombstone." into main 2024-10-31 21:16:01 +00:00
Bo Hu
c33584e2b2 Merge "Revert^3 "init: Look for super partition only on a boot device"" into main 2024-10-31 19:44:13 +00:00
Treehugger Robot
539f39e619 Merge "Make pbtombstone a host tool." into main 2024-10-31 19:35:37 +00:00
Liana Kazanova
de6707df0c Revert "Set input thread priority to RT"
This reverts commit 930f77b02c.

Reason for revert: DroidMonitor: Potential culprit for http://b/376665573 - verifying through ABTD before revert submission. This is part of the standard investigation process, and does not mean your CL will be reverted.

Change-Id: I9b9914703946f1eb4e40e779aa9cb5154ea108d3
2024-10-31 18:43:18 +00:00