Maciej Żenczykowski
b8e9af4b10
remove unused macros SKIP_IF_BPF{,_NOT}_SUPPORTED
...
Test: builds, atest, TreeHugger
Bug: 167500195
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ic740b1102fcf735516123eee2c6a3d5caa0892f9
2021-01-20 01:15:04 +00:00
Maciej Żenczykowski
f7a0a39d05
bpf is required for all devices running Android S
...
Test: builds, atest, TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ie3f1146f71f75b982ffc4cd4176c5624efb6a63e
2021-01-20 01:14:31 +00:00
Maciej Żenczykowski
b8163155e3
slightly more type safety for bpf_map_{lookup,update,delete}_elem_unsafe
...
Test: builds
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I808400e624fa96ed72d9a3b1b153b0ce5a84d6f8
2021-01-20 00:06:55 +00:00
Maciej Żenczykowski
d56ec05712
libbpf_android/Loader.cpp - fix a clang warning (clang-analyzer-deadcode.DeadStores)
...
//system/bpf/libbpf_android:libbpf_android clang-tidy Loader.cpp
system/bpf/libbpf_android/Loader.cpp:133:5: warning: Value stored to 'entries' is never read [clang-analyzer-deadcode.DeadStores]
entries = shTable.size();
^
system/bpf/libbpf_android/Loader.cpp:133:5: note: Value stored to 'entries' is never read
Test: builds without warnings
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I548976b59d44a51e992c9520e730fc9dae82fce2
2021-01-19 21:18:20 +00:00
Maciej Żenczykowski
1fddcce3c9
Merge "4.9 kernels must support eBPF (as of Android S)"
2021-01-14 07:36:56 +00:00
Maciej Żenczykowski
6fadbcf91a
Merge "Use the module bpf_syscall_wrappers for BPF system calls"
2021-01-14 07:36:50 +00:00
Maciej Żenczykowski
ef6689652c
4.9 kernels must support eBPF (as of Android S)
...
so there is no longer a need to look at any properties
or api levels.
Test: builds, atest, TreeHugger
Bug: 167500195
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ia5479db807f5444e48251dff45fd42fff610d5ca
2021-01-14 03:27:47 +00:00
Hungming Chen
a46f217d73
Use the module bpf_syscall_wrappers for BPF system calls
...
Use the versioned header library of BPF system calls and remove the
stubs.
Test: atest BpfMapTest
Change-Id: Ib178b02b7cfebaae7681609ae7c40a49cda47eeb
2021-01-13 14:34:41 +08:00
Rafal Slawik
ccde8285ee
Merge "Measure total time in state"
2021-01-12 09:27:33 +00:00
Maciej Żenczykowski
5756f0c937
SKIP_IF_BPF_NOT_SUPPORTED is a no-op
...
Android S requires devices to support eBPF.
Test: builds, atest, TreeHugger
Bug: 167500195
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I62fb97f79103515f5a2fd531cfa36356d21a4a6f
2021-01-12 02:08:55 +00:00
Treehugger Robot
8e614c2ca2
Merge "Add an sdk_version annotation to libbpf_android_headers."
2021-01-08 05:29:47 +00:00
Lorenzo Colitti
8cc4f91fca
Add an sdk_version annotation to libbpf_android_headers.
...
This will be used by the tethering module when running on S, so
it needs to have an sdk_version. Because this target does not
depend on anything, there is no need to change any other code.
Because this is only needed by the tethering module, which
shipped in R, pick the R SDK version, 30. That ensures we do not
need to support it on releases older than when it is needed.
Test: m
Bug: 173167302
Change-Id: I15c1e943d0c30aceebcb8288e78a5a8135ee7fd1
2021-01-08 13:18:10 +09:00
Maciej Żenczykowski
aa46222706
add support for xdp bpf program type
...
Tested via:
packages/modules/Connectivity/Tethering/Tethering/bpf_progs/offload.c:
+DEFINE_BPF_PROG_KVER("xdp/test", AID_ROOT, AID_ROOT,
+ xdp_test, KVER(5, 10, 0))
+(struct xdp_md *ctx) {
+ return XDP_PASS;
+}
vsoc_x86:/ # ip link show dev lo
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
vsoc_x86:/ # ip link set dev lo xdp pinned /sys/fs/bpf/prog_offload_xdp_test
vsoc_x86:/ # ip link show dev lo
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 xdpgeneric qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
prog/xdp id 3 tag 3b185187f1855c4c jited
vsoc_x86:/ # ip link set dev lo xdp off
vsoc_x86:/ # ip link show dev lo
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
Test: atest, TreeHugger
Bug: 167540099
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I7472d6d8120344abde9ea0f44c59a46f30da77f1
2021-01-07 14:51:20 -08:00
Rafal Slawik
2e2e54f8fe
Measure total time in state
...
This measure is not affected by uid removals and is monotonic. That
makes it a good fit for CPU telemetry in statsd.
Bug: 174245730
Test: manually compare total with uid breakdown
Change-Id: I0f04f2ff09d77a4c7d9fe1e2b492f983b61987f6
2021-01-05 18:51:36 +00:00
Suren Baghdasaryan
6597d87a67
libbpf_android: Add native_bridge_supported to allow usage in libmeminfo
...
libmeminfo needs to use BPF to read GPU usage reported by kernel
drivers, therefore a new dependency between libmeminfo and
libbpf_android is added. After this addition, native_bridge_supported
is required to successfully build cuttlefish targets.
Bug: 171261987
Test: build libmeminfo accessing BPF map
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Change-Id: I12e0613b13fb1206e204b5e85b4ea9a4d33e0cc9
2020-12-10 10:47:03 -08:00
Dmitri Plotnikov
80e1a15676
Merge "Allow multiple processes' threads tracked at the same time" am: 20bfae742b
...
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/1508927
Change-Id: I9b587eb69b3b0069adeb5dba71ffa0cc2e816285
2020-12-04 19:20:05 +00:00
Dmitri Plotnikov
20bfae742b
Merge "Allow multiple processes' threads tracked at the same time"
2020-12-04 18:05:11 +00:00
Maciej Żenczykowski
f0010f5901
rename BPF_FD_TO_INT() macro to BPF_FD_TO_U32() am: 38fb4300fb
...
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/1514873
Change-Id: I3c4f2d978724eda11659b7d71238dfaa6c0d5350
2020-12-01 02:41:26 +00:00
Maciej Żenczykowski
38fb4300fb
rename BPF_FD_TO_INT() macro to BPF_FD_TO_U32()
...
Cause that's what it actually does...
Bug: 173167302
Test: atest BpfMapTest
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I8445cc4fe68f24bb3b26a678b7731b0c518e80f9
2020-11-30 17:06:58 -08:00
markchien
52a2743458
Fix BPF_FD_JUST_USE_INT macro am: 26ca77305d
...
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/1512866
Change-Id: I0d6517ac29c60c91de8f05c5c26904915165a971
2020-12-01 01:05:27 +00:00
markchien
26ca77305d
Fix BPF_FD_JUST_USE_INT macro
...
Bug: 173167302
Test: atest BpfMapTest
Change-Id: I70b58e23cc5b04a187de8d55ddc3f2b367718b88
2020-12-01 01:28:20 +08:00
Dmitri Plotnikov
4f50ca45bc
Allow multiple processes' threads tracked at the same time
...
Bug: 169279846
Test: atest bpf-time-in-state-tests
Change-Id: Ia2aa4dc3d87610651195c5f50d58fc37a9a84a2a
2020-11-23 15:57:02 -08:00
Xin Li
f2446e20ec
Mark ab/6881855 as merged
...
Bug: 172690556
Change-Id: Icb681a6c80b8955d3bc53044177efeb108542e14
2020-11-23 11:32:52 -08:00
Dmitri Plotnikov
2baa8e3962
Use eBPF-based time-in-state monitoring for groups of threads am: 7c31522a0c
...
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/1505394
Change-Id: I3cd13d4f029f13f17b1cf4f351f7ee4c38059bd8
2020-11-20 18:28:10 +00:00
Dmitri Plotnikov
7c31522a0c
Use eBPF-based time-in-state monitoring for groups of threads
...
Bug: 169279846
Test: N/A - this is just a header file
Change-Id: I4beeb127fbd654e3c0a8f70f4f5088c5d7388ece
2020-11-19 10:46:28 -08:00
markchien
7e40c25066
Allow to just use integer for bpf fd am: 90b02a072e
...
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/1498296
Change-Id: I0189d1d6afc3ee9ebb9bce4bbc29b8b729bfd743
2020-11-13 09:46:32 +00:00
markchien
90b02a072e
Allow to just use integer for bpf fd
...
Bug: 173167302
Test: bpf_module_test
clatd_test
libnetdbpf_test
netd_integration_test
netd_unit_test
netdutils_test
Change-Id: I2643222e1eb2c5686d7f64eac8d9c4666a235c69
2020-11-13 04:21:13 +00:00
Xin Li
1c03504660
Skip ab/6749736 in stage.
...
Merged-In: I90fe97de22008bfd80d121fe2d9c46e8591b4fa2
Change-Id: Ib1dc57e74cbb0869764c790acb068545cb013f94
2020-10-08 17:23:55 -07:00
Hungming Chen
916a1a7dbc
Load BPF programs from system and mainline folder am: 4b8e982fae
am: ea0fe1584f
am: 5cc8270e23
am: 20cc4c86ed
...
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/1424248
Change-Id: I15af9e61dfd098fbac449b2c758559065f7805a1
2020-09-18 06:12:51 +00:00
Hungming Chen
20cc4c86ed
Load BPF programs from system and mainline folder am: 4b8e982fae
am: ea0fe1584f
am: 5cc8270e23
...
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/1424248
Change-Id: Idd27dbb323488257126b5ae7f3b929a939f5e3d9
2020-09-18 05:36:25 +00:00
Hungming Chen
5cc8270e23
Load BPF programs from system and mainline folder am: 4b8e982fae
am: ea0fe1584f
...
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/1424248
Change-Id: I87fe09b0dfdac5e6bff2d53a22b9dc4477d40b58
2020-09-18 04:56:57 +00:00
Hungming Chen
ea0fe1584f
Load BPF programs from system and mainline folder am: 4b8e982fae
...
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/1424248
Change-Id: I358583155b75dedda0d94b76da49145665590178
2020-09-18 04:27:28 +00:00
Hungming Chen
4b8e982fae
Load BPF programs from system and mainline folder
...
Test: flash and boot successfully
Change-Id: Ia1a713024686c36e34f7cf525a284abc00fe56e2
2020-09-17 11:38:53 +08:00
Xin Li
9db2ddb684
[automerger skipped] Mark Android R (rvc-dev-plus-aosp-without-vendor@6692709) as merged am: 0afd92cb3a
-s ours am: 3c36540323
-s ours am: 7edad4a869
-s ours
...
am skip reason: Change-Id I722aedc00409b8931c6d05efea4342279d32a7cf with SHA-1 0c7e97eb67
is in history
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/bpf/+/12470023
Change-Id: I662ff9e242c1108e62058ff0c3070d5b367fbd3a
2020-08-27 19:25:39 +00:00
Xin Li
7edad4a869
[automerger skipped] Mark Android R (rvc-dev-plus-aosp-without-vendor@6692709) as merged am: 0afd92cb3a
-s ours am: 3c36540323
-s ours
...
am skip reason: Change-Id I722aedc00409b8931c6d05efea4342279d32a7cf with SHA-1 0c7e97eb67
is in history
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/bpf/+/12470023
Change-Id: I20180e1e01e8ef1e27330d70b3c4fa55926f1437
2020-08-27 19:02:56 +00:00
Xin Li
3c36540323
[automerger skipped] Mark Android R (rvc-dev-plus-aosp-without-vendor@6692709) as merged am: 0afd92cb3a
-s ours
...
am skip reason: Change-Id I722aedc00409b8931c6d05efea4342279d32a7cf with SHA-1 0c7e97eb67
is in history
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/bpf/+/12470023
Change-Id: I4da34894dba42e4361157637c9f701545220eae5
2020-08-27 18:34:12 +00:00
Xin Li
0afd92cb3a
Mark Android R (rvc-dev-plus-aosp-without-vendor@6692709) as merged
...
Bug: 166295507
Merged-In: I722aedc00409b8931c6d05efea4342279d32a7cf
Change-Id: Ib95718b5c7d73700055185598bd7a38e65ec7162
2020-08-27 09:44:20 -07:00
Maciej Żenczykowski
8e2769dfb2
reduce error to warning - happens for valid progs-section-less programs am: 21f34cb32c
am: c2fe18428e
am: c44910988a
am: b07faf770e
...
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/1387317
Change-Id: I5bb1798a427cff5808694b1bff59bd6f305f46d3
2020-08-05 05:42:48 +00:00
Maciej Żenczykowski
b07faf770e
reduce error to warning - happens for valid progs-section-less programs am: 21f34cb32c
am: c2fe18428e
am: c44910988a
...
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/1387317
Change-Id: I90fe97de22008bfd80d121fe2d9c46e8591b4fa2
2020-08-05 05:27:03 +00:00
Maciej Żenczykowski
c44910988a
reduce error to warning - happens for valid progs-section-less programs am: 21f34cb32c
am: c2fe18428e
...
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/1387317
Change-Id: I7fe99e96e540fad1a2a84927079c7fdcf8651b2c
2020-08-05 05:03:37 +00:00
Maciej Żenczykowski
c2fe18428e
reduce error to warning - happens for valid progs-section-less programs am: 21f34cb32c
...
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/1387317
Change-Id: I9eeda4fd182fe18b3dd7191092b5a7406eafa594
2020-08-05 04:46:57 +00:00
Maciej Żenczykowski
21f34cb32c
reduce error to warning - happens for valid progs-section-less programs
...
07-21 01:39:43.946 26835 26835 E LibBpfLoader: No progs section could be found in elf object
07-21 01:39:43.951 26835 26835 I bpfloader: Loaded object: /system/etc/bpf/clatd.o
07-21 01:39:43.955 26835 26835 I bpfloader: Loaded object: /system/etc/bpf/offload.o
07-21 01:39:43.958 26835 26835 I bpfloader: Loaded object: /system/etc/bpf/time_in_state.o
07-21 01:39:43.967 26835 26835 I bpfloader: Loaded object: /system/etc/bpf/netd.o
Test: build, atest
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ie8413509f76741a66a4b00f0131a58e7ebdbae3f
2020-08-05 03:39:17 +00:00
Maciej Żenczykowski
e226d0794a
bpfloader: sleep 20 seconds on failure am: 07b874481f
am: 6841c2b102
am: 2c450121a5
am: acb5ea3607
...
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/1363957
Change-Id: Ia617f650ee3380676318186dafc47138f7e22406
2020-08-04 08:36:42 +00:00
Maciej Żenczykowski
acb5ea3607
bpfloader: sleep 20 seconds on failure am: 07b874481f
am: 6841c2b102
am: 2c450121a5
...
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/1363957
Change-Id: I5d128373f2a9ed38ee0404781c17918a771fcbb3
2020-08-04 08:09:50 +00:00
Maciej Żenczykowski
2c450121a5
bpfloader: sleep 20 seconds on failure am: 07b874481f
am: 6841c2b102
...
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/1363957
Change-Id: I97add5d5d0935dcf43ddd5c77f6c52e802fd8b18
2020-08-04 07:45:28 +00:00
Maciej Żenczykowski
6841c2b102
bpfloader: sleep 20 seconds on failure am: 07b874481f
...
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/1363957
Change-Id: I99f4bd43bb9f8f8310c00e5c30b1344170525ade
2020-08-04 07:23:33 +00:00
Maciej Żenczykowski
07b874481f
bpfloader: sleep 20 seconds on failure
...
(should make it easier to observe logs via adb)
Test: atest, TreeHugger
Bug: 150040815
Bug: 160546011
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I20d6ede4ddf516a91c707aa08cf3a92aed39b03b
2020-07-15 01:44:12 -07:00
Automerger Merge Worker
240808d444
Merge "Merge "[automerger skipped] start bpfloader asynchronously am: 5a0fdfa8e8
-s ours am: 0c7e97eb67
-s ours" into rvc-d1-dev-plus-aosp am: 6315593649
-s ours" into rvc-qpr-dev-plus-aosp
2020-06-24 09:48:57 +00:00
Automerger Merge Worker
58511ca53d
Merge "[automerger skipped] start bpfloader asynchronously am: 5a0fdfa8e8
am: 372cc578d3
am: 81b26a8a96
-s ours" into rvc-qpr-dev-plus-aosp
2020-06-24 09:48:54 +00:00
Automerger Merge Worker
1d43aedb99
Merge "[automerger skipped] start bpfloader asynchronously am: 5a0fdfa8e8
-s ours am: 0c7e97eb67
-s ours" into rvc-d1-dev-plus-aosp am: 6315593649
-s ours
...
am skip reason: Change-Id Id62009a9f888ce2092b8a1e7aef24ae4224109d5 with SHA-1 5a0fdfa8e8
is in history
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/bpf/+/11983040
Change-Id: Ied718868012e448c351e2a0d5cfa1130bc91830e
2020-06-24 09:48:53 +00:00