Commit graph

88798 commits

Author SHA1 Message Date
Neill Kapron
79fffdb0c5 Merge "healthd: BatteryMonitor: doLogValues: reduce log level to debug" into main am: 2b2fcaea46
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2953924

Change-Id: I74fc84205ec64a9e037397ee0f3093b3d48b5142
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-02-08 03:43:53 +00:00
Treehugger Robot
bb2fc5a0b5 Merge "fastboot: Remove '\n' from interface name on linux" into main am: 241046adaa
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2955272

Change-Id: I772dfb2fbfadfe48b76f05951e03e648ab2a71fb
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-02-08 03:43:30 +00:00
Neill Kapron
2b2fcaea46 Merge "healthd: BatteryMonitor: doLogValues: reduce log level to debug" into main 2024-02-08 03:24:16 +00:00
Treehugger Robot
241046adaa Merge "fastboot: Remove '\n' from interface name on linux" into main 2024-02-08 03:11:53 +00:00
Peter Collingbourne
cc1bf34ba6 fastboot: Use clock_gettime(CLOCK_MONOTONIC) in now()
If the system time changes during the execution of fastboot we might
see some strange output such as:

Sending sparse 'super' 4/20 (254972 KB)            OKAY [-516.263s]

Fix it by changing now() to use clock_gettime(CLOCK_MONOTONIC).
I confirmed that all callers of now() are using it for relative time
and not time since the epoch.

Change-Id: Ic3e9442c2ab21dfb076bfed88915085a183754b0
2024-02-07 16:55:49 -08:00
Matt Schulte
28f4807dd3 fastboot: Remove '\n' from interface name on linux
If the device provides an interface string, we should remove the newline
from the read file that is added from by the linux kernel.

Bug: 324320178
Test: Ran the same command with my local changes vs not

```
bash$ ./fastboot devices -l
5f42ad5ad259c90cf14ea222791b6aaa fastboot usb:7-3

bash$ fastboot devices -l
5f42ad5ad259c90cf14ea222791b6aaa fastboot
 usb:7-3
```

Change-Id: Ida3316fdba8e35f0c66784f83455a4d82e90ba1c
2024-02-07 16:24:26 -08:00
Neill Kapron
aeccbb8f3a healthd: BatteryMonitor: doLogValues: reduce log level to debug
This is log spam and fills the kernel log. Reduce log level from warning
to debug.

Test: manual
Bug: 36785118
Change-Id: I70fc3a0d796cb1a984705236fe7527e266a69a03
Signed-off-by: Neill Kapron <nkapron@google.com>
2024-02-07 23:37:50 +00:00
Elliott Hughes
68fc74372b Merge "We don't need __STDC_FORMAT_MACROS any more." into main am: c72c9a6d3c
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2953915

Change-Id: Iefd849d7c4d1b8ccd9661bee12bab06feed4be54
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-02-07 22:25:50 +00:00
Elliott Hughes
1c5911fade Remove unused addKernelPanicSubReason() return value.
The only caller that was looking at the return value just stopped.

Test: treehugger
Change-Id: Icf2508e8e1ee4969918eadeb580f70236ba53496
2024-02-07 22:22:13 +00:00
Elliott Hughes
c72c9a6d3c Merge "We don't need __STDC_FORMAT_MACROS any more." into main 2024-02-07 21:56:38 +00:00
Treehugger Robot
24f4df0bb2 Merge "bootstat: Remove long key press check" into main am: 0c78cf96a1
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2938819

Change-Id: Iad1cf5e839fc9c7009676aa516c0550bd3c788d9
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-02-07 18:54:50 +00:00
Elliott Hughes
6225d6f3eb We don't need __STDC_FORMAT_MACROS any more.
Test: treehugger
Change-Id: Iada8b959f61bfa55b61d2ed4b345801ed9cea0c6
2024-02-07 18:27:47 +00:00
Treehugger Robot
0c78cf96a1 Merge "bootstat: Remove long key press check" into main 2024-02-07 18:23:30 +00:00
Treehugger Robot
c0e2cc30d2 Merge "fastboot: Use asynchronous operations to send data" into main am: 277533b7a3
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2953831

Change-Id: Ic9a6d6dbd92ba9ff827cdf63283c7d6ef25f8d56
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-02-07 04:13:08 +00:00
Treehugger Robot
277533b7a3 Merge "fastboot: Use asynchronous operations to send data" into main 2024-02-07 03:42:00 +00:00
Zheng Pan
fa544b551b bootstat: Remove long key press check
Current check is kind of device specfic and causes false positive.

Bug: 320829712
Test: Trigger long key press and check boot reason
Change-Id: I5b2b8307f16eecd05513bfa51494da174fc839bd
2024-02-06 17:39:27 -08:00
Peter Collingbourne
8635c016db fastboot: Use asynchronous operations to send data
The fastboot command currently uses USBDEVFS_BULK to transfer data
(including image data) to the target. On the kernel side it looks
like this:

1. Allocate a contiguous memory region and copy the user data into
   the memory region (which may involve accessing storage).
2. Instruct the driver to start a DMA operation.
3. Wait for the DMA to finish.

This is suboptimal because it misses out on a pipelining
opportunity. We could be doing 3 for the current operation in parallel
with 1 for the next operation, so that the next DMA is ready to go
as soon as the current DMA finishes.

The kernel supports asynchronous operations on usbdevfs file
descriptors (USBDEVFS_SUBMITURB and USBDEVFS_REAPURB), so we can
implement this like so:

1. Submit URB 0
2. Submit URB 1
3. Wait for URB 0
4. Submit URB 2
5. Wait for URB 1
and so on.

That is what this CL implements. On my machine it increases transfer
speed from 125 MB/s to 160 MB/s using a USB 3.0 connection to the
target (Pixel 8).

Bug: 324107907
Change-Id: I20db7ea14af85db48f6494091c8279ef7a21033d
2024-02-06 13:10:27 -08:00
Jeffrey Vander Stoep
7f66218e1d Merge "Replace use of deprecated logging functions" into main am: 40b6a8f0c6
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2952670

Change-Id: I215c94fd01b4d814598f9f4f75851e32c9188a6f
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-02-06 16:39:21 +00:00
Jeffrey Vander Stoep
40b6a8f0c6 Merge "Replace use of deprecated logging functions" into main 2024-02-06 16:09:30 +00:00
Mitch Phillips
bf2d6dd7d4 Update debuggerd for stack MTE.
Two things need changing for debuggerd_test to pass.

 1. The seccomp policy needs to allow for PROT_MTE (0x20) in both
    mprotect() and mmap(). Stack MTE processes do a mprotect()/mmap() of
    the stack when launching a process.
 2. The fault address and stack pointer need to be untagged when trying
    to figure out the stack overflow cause.

Bug: 320448268
Bug: 292478827
Test: atest debuggerd_test --iterations=10
Change-Id: I56471c32ca40edffbb61b7547bdf2b85a6eb1ff7
2024-02-06 15:18:04 +01:00
Jeff Vander Stoep
56aedd5551 Replace use of deprecated logging functions
This is needed to upgrade the android_logger crate from 0.12.0
to 0.13.3.

with_max_level provides the same functionality as with_min_level.
The renaming is admittedly confusing, but the new name is accurate
and it makes sense that they deprecated and then removed the
previously poorly named with_min_level.

See crate documentation [1] and code [2].

[1]: https://docs.rs/android_logger/0.12.0/android_logger/struct.Config.html#method.with_min_level
[2]: https://docs.rs/android_logger/0.12.0/src/android_logger/lib.rs.html#227

Bug: 322718401
Test: build and run CF with the change.
Test: m aosp_cf_x86_64_phone
Change-Id: Ib4fbd486267d30e74e886139846950b066848d43
2024-02-06 12:32:36 +01:00
David Dai
f3337f69df Merge "Add AID for Virtual Machines" into main am: 161b80bd02
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2945529

Change-Id: I92a8f7a1c8d8fc5e0fe2c0ae39ac0b018e4cb462
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-02-06 01:59:21 +00:00
David Dai
161b80bd02 Merge "Add AID for Virtual Machines" into main 2024-02-06 01:21:39 +00:00
Treehugger Robot
6901675313 Merge "remount: Auto remount option (-R) also tries to gain root" into main am: eadf6b4bda
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2926792

Change-Id: I346ffe88bc6dfc299140a545164c551410e3082b
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-02-06 00:34:00 +00:00
Treehugger Robot
eadf6b4bda Merge "remount: Auto remount option (-R) also tries to gain root" into main 2024-02-05 23:47:54 +00:00
David Dai
851c9c825f Add AID for Virtual Machines
Add a new AID for Virtual Machines so we can grant
capabilities such as CAP_SYS_NICE.

Bug: 322197421
Test: Build and boots, and verified capabilities

Change-Id: Ie893ba8ed6956a554bccfbd00e4e6fe9212ea77d
Signed-off-by: David Dai <davidai@google.com>
2024-02-05 23:38:44 +00:00
Kenn Frankel
548fffe3bd Merge "Update libstatssocket_lazy to support StringArray" into main am: 7833f27c25
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2945025

Change-Id: I4f80a927a3b500fb22c119f6b6a79c1bb61f2e55
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-02-05 19:59:44 +00:00
Kenn Frankel
7833f27c25 Merge "Update libstatssocket_lazy to support StringArray" into main 2024-02-05 19:16:33 +00:00
Treehugger Robot
1015d263e9 Merge "Restore I/O priority support" into main am: 749e2e8e2d
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2944826

Change-Id: I0ae7e0f1ef9a6ccf484e33ed82f7c1fa8b522c06
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-02-02 01:57:41 +00:00
Treehugger Robot
749e2e8e2d Merge "Restore I/O priority support" into main 2024-02-02 01:13:16 +00:00
Kenn Frankel
374c43e9b7 Update libstatssocket_lazy to support StringArray
Bug: 281162849
Test: LibstatssocketLazyTest

Change-Id: I917589e92db045f96daa9b191fadac50b01704c8
2024-02-01 11:49:51 -08:00
Bart Van Assche
0cf102b703 Restore I/O priority support
CL aosp/2929791 removed I/O priority support to prepare for a clean
revert of the CL that migrates the blkio controller from the v1 to the
v2 cgroup hierarchy. Since there was no other reason to revert the I/O
priority CL, restore I/O priority support.

Bug: 186902601
Change-Id: I1a4053140ab55973878bfeacfb546da3c601a895
Signed-off-by: Bart Van Assche <bvanassche@google.com>
2024-02-01 10:52:13 -08:00
Akilesh Kailash
ae4b84db9a Merge changes from topic "ota-block-size-compression" into main am: 942b213628
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2901263

Change-Id: I003f2970db9ec087df6ab8c8744da6c3429f0952
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-02-01 18:50:34 +00:00
Akilesh Kailash
942b213628 Merge changes from topic "ota-block-size-compression" into main
* changes:
  snapuserd: Add I/O path support for variable block size
  libsnapshot_cow: Support multi-block compression
2024-02-01 18:13:02 +00:00
Devin Moore
b56e4743f6 Change debuggerd client param from pid to tid
Change the header param to be `tid` and remove a local `pid` variable
to use `tid` instead.

Test: m
Bug: 316970771
Change-Id: I53c13081d72f46446ac6e85df77a160ef4f50c05
2024-01-31 23:44:01 +00:00
Akilesh Kailash
60a9e75880 Merge "libsnapshot: set header max_compression" into main am: 13cb6f7b4b
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2938301

Change-Id: I46f55b6a939e88de863f89707dc0a378f23b585a
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-01-31 21:41:18 +00:00
Akilesh Kailash
3ea911bc06 snapuserd: Add I/O path support for variable block size
The flow of I/O path is as follows:

1: When there is a I/O request for a given sector, we first
check the in-memory COW operation mapping for that sector.

2: If the mapping of sector to COW operation is found, then the
existing I/O path will work seamlessly. Even if the COW operation
encodes multiple blocks, we will discard the remaining data.

3: If the mapping of sector to COW operation is not found:
    a: Find the previous COW operation as the vector has sorted sectors.

    b: If the previous COW operation is a REPLACE op:
        i: Check if the current sector is encoded in the previous COW
	operations compressed block.

	ii: If the sector falls within the range of compressed blocks,
	retrieve the block offset.

	iii: De-compress the COW operation based on the compression
	factor.

	iv: memcpy the data based on the block offset.

	v: cache the COW operation pointer as subsequent I/O requests
	are sequential and can just be a memcpy at the correct offset.
    c: If the previous COW operation is not a REPLACE op or if the
       requested sector does not fall within the compression factor
       of the previous COW operation, then fallback and read the data
       from base device.

Snapshot-merge:

During merge of REPLACE ops, read the entire op in one shot, de-compress
multiple blocks and write all the blocks in one shot.

Performance:

go/variable-block-vabc-perf covers detail performance runs
on Pixel 6 for full and incremental OTA.

Bug: 319309466

Test: snapuserd_test covers all the I/O path with various block sizes.
About 252 cases with all combinations and tunables.

[==========] 252 tests from 4 test suites ran. (702565 ms total)
[  PASSED  ] 252 tests.

On Pixel 6:

=======================================
COW Writer V3:

for i in full, incremental OTA
   for j in 4k, 16k, 32k, 64k, 128, 256k
      for k in lz4, zstd, gz
	 install OTA, reboot, verify merge
=======================================
COW Writer V2:

for i in full, incremental OTA
  for j in 4k
    for k in lz4, zstd, gz
      install OTA, reboot, verity merge

=====================================

Change-Id: I4c3b5c3efa0d09677568b4396cc53db0e74e7c99
Signed-off-by: Akilesh Kailash <akailash@google.com>
2024-01-31 13:28:45 -08:00
Akilesh Kailash
59fa486703 libsnapshot_cow: Support multi-block compression
This patch supports compression for bigger block size.

3 bits [57-59] in the COW Operation "source_info_" field is used to store
the compression factor. Supported compression factors are power of 2
viz: 4k, 8k, 16k, 32k, 64k, 128k, 256k.

Only REPLACE operations will have the bigger block size support for now.
This can be extended to other operations later.

The write path in EmitBlocks() has the core logic wherein consecutive
sequence of REPLACE ops are compressed based on the compression factor
settings. Thus, for a 64k compression factor, there will be just one
COW operation which encodes all the 16 operation and the entire 64k
block is compressed in one shot.

NOTE: There is no read I/O path support in this patch. Subsequent patch
will have the read support.

Performance data (with read I/O path support in subsequent patch):

go/variable-block-vabc-perf covers detail performance runs
on Pixel 6 for full and incremental OTA.

TL;DR:

Performance of a full OTA (All numbers are compared against 4k block
size)
=======================================
Snapshot-size:

~10-11% decrease in snapshot-size (disk-space) for zstd with 256k block
size.

~8% decrease in snapshot-size (disk-space) for lz4

Install time:

~13% decrease in OTA install time for zstd with 256k block size.

Snapshot-merge:

~50% decrease in snapshot-merge time with 256k block size for zstd

Post OTA boot-time:

~10.5 decrease in boot time for 64k block size for zstd

In-memory footprint for COW operations:

~80% decrease in memory footprint for 256k block size. (58MB -> 9.2MB)

============================================

For more improvements, further tuning of zstd/lz4 is
required primariy the compression levels, zstd compression window,
performance of gz with compression levels.

Bug: 319309466

Test: cow_api test covering all the supported block sizes for v3 writer.

On Pixel 6:

=======================================
COW Writer V3:

for OTA in full, incremental OTA
   for block_size in 4k, 16k, 32k, 64k, 128k, 256k
       for compression_algo in lz4, zstd, gz, none
          install OTA, reboot, verify merge
=======================================
COW Writer V2:

for OTA in full, incremental OTA
   for block_size in 4k
      for compression_algo in lz4, zstd, gz, none
          install OTA, reboot, verity merge

=====================================
Change-Id: I96201f1609582aa9d44d8085852e284b0c4a426d
Signed-off-by: Akilesh Kailash <akailash@google.com>
2024-01-31 12:52:31 -08:00
Akilesh Kailash
13cb6f7b4b Merge "libsnapshot: set header max_compression" into main 2024-01-31 20:42:58 +00:00
Daniel Zheng
bcce91603b libsnapshot: set header max_compression
Intermediate CL needed before variable block size can land. Since v3 is
enabled on cuttlefish, the base build needs to write the
compression_factor in order for reader to properly parse. Otherwise
we'll fail OTA test

Test: th
Change-Id: Ia353aae8e668858851073f09308909ae70d7854e
2024-01-31 17:35:00 +00:00
David Drysdale
6c2cb28318 Merge "Secretkeeper: require SECRETKEEPER_ENABLED=true" into main am: 700ff706f1
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2937199

Change-Id: I45d94c65b841765ad81ad34c1ac687441c2c25e6
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-01-31 08:00:03 +00:00
David Drysdale
700ff706f1 Merge "Secretkeeper: require SECRETKEEPER_ENABLED=true" into main 2024-01-31 07:13:24 +00:00
Jiyong Park
ac6907b466 Merge "Drop CtsInitTestCases from cts" into main am: 0edd5b860a
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2935210

Change-Id: I3c5f869e67c32498c57e99ccdb1784b8036ccde9
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-01-31 01:31:31 +00:00
Jiyong Park
0edd5b860a Merge "Drop CtsInitTestCases from cts" into main 2024-01-31 00:58:50 +00:00
Xin Li
4090c94e73 Merge "Merge Android 24Q1 Release (ab/11220357)" into aosp-main-future 2024-01-30 22:43:43 +00:00
Akilesh Kailash
c9d7942e5d Merge "libsnapshot: update type" into main am: 14258369ef
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2903390

Change-Id: Ibd57839d562924067c254e160825dcb664f022e5
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-01-30 19:34:28 +00:00
Daniel Zheng
874d5006a2 Merge "libsnapshot: op_count_max default to max blocks" into main am: 5e4b3263ab
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2898987

Change-Id: I9811519fa263dd64efb9a548446a107db46e00af
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-01-30 19:33:53 +00:00
Daniel Zheng
2aad9fcba2 Merge "libsnapshot: use compression_factor in ota" into main am: 560c753ee8
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2901503

Change-Id: I6f2f7b9efe981dcdd9c1caa371859ba547b46fcc
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-01-30 19:33:34 +00:00
Akilesh Kailash
14258369ef Merge "libsnapshot: update type" into main 2024-01-30 19:23:49 +00:00
Daniel Zheng
5e4b3263ab Merge "libsnapshot: op_count_max default to max blocks" into main 2024-01-30 18:49:14 +00:00