Commit graph

2284 commits

Author SHA1 Message Date
Maciej Żenczykowski
0eb98a22c3 BpfLoader: drastically reduce logging
Should speed up boot time - especially if serial console is enabled.

There's probably still enough information available to debug issues,
as any errors (which basically shouldn't happen) are still all
extensively logged.

Either way, as this now only loads platform bpf .o files, anyone seeing
boot time problems can simply flash a custom build with changes to the
platform BpfLoader to enable any extra logging as needed.

(Note that AFAICT normally ALOGV() is basically ignored)

Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I5e404ae14c33ee319c07be42defdc270b15a54fe
2024-04-30 22:37:04 -07:00
Neill Kapron
bc4ae410ff BpfLoadTest: Set rlimit memlock for old kernels
BpfLoadTest was failing on android13-5.10 kernels due to the rlimit
memlock not being configured large enough for the test process. Add the
necessary call to set rlimit memlock for pre-5.11 kernels.

5.11 kernels introduced cgroup-based memory accounting for bpf as
discussed at https://lore.kernel.org/bpf/20201201215900.3569844-1-guro@fb.com/

Flag: n/a
Test: atest libbpf_load_test
Bug: 326156952

Change-Id: I8eda9fe6cee099b1fd979720a4e94d685a571943
Signed-off-by: Neill Kapron <nkapron@google.com>
2024-04-09 17:22:02 +00:00
Treehugger Robot
febb949db4 Merge "Platform BpfLoader: remove dumpIns() and dumpAllCs()" into main 2024-03-11 08:25:02 +00:00
Maciej Żenczykowski
091206500d Platform BpfLoader: remove dumpIns() and dumpAllCs()
I've *never* ended up using this information...

Test: builds
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I621d32fb235e9cd88989e99536485674c74fa884
2024-03-11 04:01:21 +00:00
Maciej Żenczykowski
50c60e52f7 Platform BpfLoader: remove dead code exists() function
Test: builds
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I13d33559b024c22b033a5b04b1be3f78a5a5913a
2024-03-11 04:01:13 +00:00
Maciej Żenczykowski
c1647d764f Platform BpfLoader: remove support for per-map/prog dir & selinux context
For platform bpf .o files per-map/prog selinux context can simply
be added by genfscon selinux policy modifications.

(while per-map/prog pin dir really only exists to support the selinux context)

Test: TreeHugger
  Both before and after this patch 'adb shell find /sys/fs/bpf | wc -l' returns 103
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ic700db2870c16a04c9498e529519051a672a28c8
2024-03-11 04:01:07 +00:00
Maciej Żenczykowski
b9712d1c85 bpfmt loader/Android.bp
Generated via:
  ../../prebuilts/build-tools/linux-x86/bin/bpfmt -w loader/Android.bp

Test: N/A
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I08e3a2e1d95c6d2875de6195750638b9d143abf4
2024-03-11 04:00:30 +00:00
Maciej Żenczykowski
cc922aa442 Platform BpfLoader: statically link libbpf_android support lib
Besides tests, we're the only user (unsurprising considering
selinux limitations on who can actually load bpf programs...)

This slightly reduces disk space consumption...

Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Icadfb45d556ebf9d19b9b2ea2173c014a39b1278
2024-03-11 04:00:21 +00:00
Maciej Żenczykowski
5c412c6c0e move libbpf_android into loader subdirectory
The only (real) user is the platform bpfloader binary.
This is a library purely to facilitate testing.

It's easier to develop / code-search if everything is in the same directory.

Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Iebe8a5c4f8bb9ada220acec6ed8c1be0fc9d438c
2024-03-11 04:00:13 +00:00
Maciej Żenczykowski
8c0a922d0e rename 'bpfloader' directory to just 'loader'
//system/bpf/bpfloader/BpfLoader.cpp is just pointlessly wordy.

Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I52a9dd11d2cc844a385e7971e38c7188118aaed0
2024-03-11 04:00:05 +00:00
Maciej Żenczykowski
c82f56679a Platform BpfLoader: do not support mismatching bpf map/prog struct sizes
This is not needed, as all platform bpf .o's are built at the same time
(and thus from the same bpf map/prog structure definitions) as
the loader itself.

This effectively undoes much of aosp/1754794
'bpf loader improvements for better long term compatibility with mainline'

Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I8cd6865cfb49bb282b2dcff1957dd9826e501da1
2024-03-11 03:59:37 +00:00
Maciej Żenczykowski
97e633a6ea sort OWNERS_bpf and add trailing newline
Test: N/A
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I173ae31ac371dd33f3715a7720509cfab00b3b58
2024-03-10 14:35:44 -07:00
Maciej Żenczykowski
e0a5665570 Platform BpfLoader: remove spurious comment about versions
(leftover)

Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I82b589ed3aa0218c22e0a312928f2a36487ce7bd
2024-03-09 06:35:45 +00:00
Maciej Żenczykowski
9e8e2ebd4c Platform BpfLoader: remove IGNORE_ON_{ARCH} support
We've never used it (even in mainline) and it's probably even
less useful in platform, as it can simply be handled at build
time by appropriate Android.bp stanzas...

Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I788dae8d0378556e5e4580e1ca4f2f0cd6b393dc
2024-03-09 06:33:12 +00:00
Maciej Żenczykowski
420e8a15c5 Platform BpfLoader: remove IGNORE_ON_{USER,USERDEBUG,ENG} support
Unlike in mainline, this isn't actually particularly useful for
platform, as you can simply not include such programs
via Android.bp/mk stanzas at build time.

Even in mainline we've had only one user (and we've graduated
that use as well...)

Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com
Change-Id: I66a83e79a866c306de4c409e8b5822eac99454ec
2024-03-09 06:30:08 +00:00
Maciej Żenczykowski
df94ef3949 BpfLoader: remove platform bpfloader version.
it's now meaningless, as it only loads programs
that are part of platform and thus compiled at
the same time (there can thus be no version skew).

Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I5552f551bae432814b606c3618eb95833e2edb0d
2024-03-08 19:37:09 +00:00
Maciej Żenczykowski
4bc57c23b8 Merge "BpfLoader: progs section must be present" into main 2024-03-08 18:53:42 +00:00
Treehugger Robot
96f60b6db3 Merge "BpfLoader: remove version check logic" into main 2024-03-08 10:58:10 +00:00
Maciej Żenczykowski
554d0a2c5e BpfLoader: progs section must be present
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I8e51ab4738c6fe009a2abe0d14ad8c7da3981389
2024-03-08 08:21:20 +00:00
Maciej Żenczykowski
a5646cb031 BpfLoader: remove version check logic
Platform bpfloader version cannot skew vs platform shipped
bpf.o files, as they are built at the same time...

This is because the platform bpfloader no longer loads mainline
(and thus potentially newer) shipped bpf.o files.

Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I41a287cb726148269159cc7b08397a748eb70b75
2024-03-08 08:09:34 +00:00
Maciej Żenczykowski
278a712e69 BpfLoader: remove dead code
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Iae17d41884c17cd061dbf487a48b523028cd67a7
2024-03-08 07:55:53 +00:00
Maciej Żenczykowski
6456428d38 bpfloader: remove duplicate code am: 301a12f54d
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/2983911

Change-Id: I32941c7b03e107b3f06fb1274129a195b8affb0e
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-02-29 11:12:05 +00:00
Maciej Żenczykowski
301a12f54d bpfloader: remove duplicate code
(setting the sysctls is already done by NetBpfLoad.cpp before this,
while creating the loader subdir will happen after aosp/2983013,
but that is currently unused functionality anyway)

Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ie465e4be459d5b77924799c486b5fe03bef6f521
2024-02-29 02:05:21 +00:00
Aditya Choudhary
ba3b6c9781 Migrate Test Targets to New Android Ownership Model am: 57c8f90936
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/2946401

Change-Id: I3e98f4c28418587d49d596ca39abc4be5f744ead
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-02-13 04:57:26 +00:00
Aditya Choudhary
57c8f90936 Migrate Test Targets to New Android Ownership Model
This CL is created as a best effort to migrate test targets to the new Android ownership model.
It is based on historical data from repository history and insights from git blame.
Given the nature of this effort, there may be instances of incorrect attribution. If you find incorrect or unnecessary
attribution in this CL, please create a new CL to fix that.

For detailed guidelines and further information on the migration please refer to the link below,
go/new-android-ownership-model

Bug: 304529413
Test: N/A
Change-Id: Ifb44dde6bd09eada179228a6cbaa67e0c4d1b863
2024-02-02 14:02:31 +00:00
Yu-Ting Tseng
56858e9fee Add uprobestats path to BpfLoader. am: 9c56a5a699 am: b8fe151a9b am: f233c8b3ac
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/2907041

Change-Id: Ia262d395ec95da65d78553187624c917f91ddccb
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-01-13 00:05:14 +00:00
Yu-Ting Tseng
f233c8b3ac Add uprobestats path to BpfLoader. am: 9c56a5a699 am: b8fe151a9b
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/2907041

Change-Id: Ib9fcb8fa4fde4c9ad13d7dc6e5c184701733e4e5
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-01-12 23:30:50 +00:00
Yu-Ting Tseng
b8fe151a9b Add uprobestats path to BpfLoader. am: 9c56a5a699
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/2907041

Change-Id: I9609e9c47ed4325cdc940c74c687b735316ea2ca
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-01-12 23:01:19 +00:00
Yu-Ting Tseng
9c56a5a699 Add uprobestats path to BpfLoader.
Test: m
Bug: 296108553
Change-Id: If033a459ade1ae9e9a1f2b7eb7eec23bf8418bdf
2024-01-12 09:41:18 -08:00
Maciej Żenczykowski
ce109aa1f1 move bpfloader.rc into p/m/C am: ddea8ce1af am: c555d8fb01 am: 03911d686f
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/2800818

Change-Id: Id8af2ab67be2a686146d175cdfcaccbcb272f13f
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-25 01:13:14 +00:00
Maciej Żenczykowski
ad161ab5a9 move bpfloader.rc into p/m/C am: ddea8ce1af am: 7037728ece am: 1c64ea1742
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/2800818

Change-Id: Iecaecb7a0d3defcdad605a9ea0252999047b1ecc
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-25 00:48:01 +00:00
Maciej Żenczykowski
03911d686f move bpfloader.rc into p/m/C am: ddea8ce1af am: c555d8fb01
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/2800818

Change-Id: I39c81934470535dfe7ec4096e7a3eb02660497a9
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-25 00:43:53 +00:00
Maciej Żenczykowski
1c64ea1742 move bpfloader.rc into p/m/C am: ddea8ce1af am: 7037728ece
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/2800818

Change-Id: Id22048708f061b115dee03fb6939aad09738d5ab
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-25 00:42:34 +00:00
Maciej Żenczykowski
c555d8fb01 move bpfloader.rc into p/m/C am: ddea8ce1af
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/2800818

Change-Id: I8e43e0d56adc1b7599301664432420be7161a1d9
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-25 00:22:38 +00:00
Maciej Żenczykowski
7037728ece move bpfloader.rc into p/m/C am: ddea8ce1af
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/2800818

Change-Id: Icc29fa45c0004b3ce4ac1d9f2130493dea9fc7fe
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-25 00:20:44 +00:00
Maciej Żenczykowski
cc423cb8e6 [automerger skipped] bpfRingbufProg: use named values not raw true/false values. am: a8e1252c3f -s ours
am skip reason: Merged-In Idd8055d823d98d8d0e2b3fe26246edc0c457e16b with SHA-1 4038b8f63e is already in history

Original change: https://googleplex-android-review.googlesource.com/c/platform/system/bpf/+/25167020

Change-Id: I1b3a324914f51c19b6fb84b159e6fd0fd331852e
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-24 20:33:53 +00:00
Maciej Żenczykowski
a8e1252c3f bpfRingbufProg: use named values not raw true/false values.
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
(cherry picked from https://android-review.googlesource.com/q/commit:4038b8f63ecd1025cf823ace6c69e23f52f9c2d5)
Merged-In: Idd8055d823d98d8d0e2b3fe26246edc0c457e16b
Change-Id: Idd8055d823d98d8d0e2b3fe26246edc0c457e16b
2023-10-24 18:22:15 +00:00
Maciej Żenczykowski
ddea8ce1af move bpfloader.rc into p/m/C
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ic472e69758a1190cbfb8b04b89a3a477241a717a
2023-10-24 02:15:24 -07:00
Maciej Żenczykowski
ed0480cf94 Merge "execute bpfloader via netbpfload" into main am: 6b21c10161 am: 30b5e41a34 am: 3ae3036e51
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/2798732

Change-Id: I5948d9d8b270e896699d21268961eb873d376434
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-21 17:11:07 +00:00
Maciej Żenczykowski
0eae932096 Merge "execute bpfloader via netbpfload" into main am: 6b21c10161 am: b1ec007a13 am: 30308790fc
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/2798732

Change-Id: Ic03d14532938f15bc98fb4f0047a8f4b2600681c
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-21 16:50:18 +00:00
Maciej Żenczykowski
3ae3036e51 Merge "execute bpfloader via netbpfload" into main am: 6b21c10161 am: 30b5e41a34
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/2798732

Change-Id: Idb0b122160533b4077a8d7da8a99da69095352f3
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-21 16:46:34 +00:00
Maciej Żenczykowski
30308790fc Merge "execute bpfloader via netbpfload" into main am: 6b21c10161 am: b1ec007a13
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/2798732

Change-Id: Ibf006fc3987c015d08095803f59a05d792423e4f
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-21 16:45:32 +00:00
Maciej Żenczykowski
30b5e41a34 Merge "execute bpfloader via netbpfload" into main am: 6b21c10161
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/2798732

Change-Id: I060b14914b0ca43dce21fd1324783a84edce62eb
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-21 16:29:31 +00:00
Maciej Żenczykowski
b1ec007a13 Merge "execute bpfloader via netbpfload" into main am: 6b21c10161
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/2798732

Change-Id: I5031605d6e6d6fb70b0897e4e2492f557f0fe8ff
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-21 16:27:57 +00:00
Maciej Żenczykowski
6b21c10161 Merge "execute bpfloader via netbpfload" into main 2023-10-21 16:06:44 +00:00
Maciej Żenczykowski
42da46ab87 Merge "reverse bpfloader vs netbpfload order" into main am: 04229c8453 am: 36ec4b0dd9 am: 664a880c04
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/2794731

Change-Id: I8ae16a59b5370d627d52b65519a1fb15eb4535ba
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-21 03:22:24 +00:00
Maciej Żenczykowski
664a880c04 Merge "reverse bpfloader vs netbpfload order" into main am: 04229c8453 am: 36ec4b0dd9
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/2794731

Change-Id: I5759b78eb53fe447c565c664d18054d7182c9a71
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-21 02:58:31 +00:00
Maciej Żenczykowski
820a6c618a Merge "reverse bpfloader vs netbpfload order" into main am: 04229c8453 am: 026704ae9c am: a7de4e1f05
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/2794731

Change-Id: If23544950c00dcd446aef54293163801131b9b19
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-21 02:41:30 +00:00
Maciej Żenczykowski
36ec4b0dd9 Merge "reverse bpfloader vs netbpfload order" into main am: 04229c8453
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/2794731

Change-Id: Ibec1c5e3dd12a82c457cca8fcef6103bb66662af
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-21 02:41:05 +00:00
Maciej Żenczykowski
a7de4e1f05 Merge "reverse bpfloader vs netbpfload order" into main am: 04229c8453 am: 026704ae9c
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/2794731

Change-Id: I2370a5f33c4d28d005826da8c0aeb73b787c3a48
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-21 02:36:20 +00:00