Snap for 8426163 from bc268c6e8da52b924c289b859751463542fbc9ab to mainline-tzdata2-release
Change-Id: Ia9d132c1696fed67ed95ec74f3888058538fdcf7
diff --git a/Android.bp b/Android.bp
index 25cd3b2..3286594 100644
--- a/Android.bp
+++ b/Android.bp
@@ -14,34 +14,6 @@
// limitations under the License.
//
-package {
- default_applicable_licenses: ["system_bpfprogs_license"],
-}
-
-// Added automatically by a large-scale-change that took the approach of
-// 'apply every license found to every target'. While this makes sure we respect
-// every license restriction, it may not be entirely correct.
-//
-// e.g. GPL in an MIT project might only apply to the contrib/ directory.
-//
-// Please consider splitting the single license below into multiple licenses,
-// taking care not to lose any license_kind information, and overriding the
-// default license using the 'licenses: [...]' property on targets as needed.
-//
-// For unused files, consider creating a 'fileGroup' with "//visibility:private"
-// to attach the license to, and including a comment whether the files may be
-// used in the current project.
-// See: http://go/android-license-faq
-license {
- name: "system_bpfprogs_license",
- visibility: [":__subpackages__"],
- license_kinds: [
- "SPDX-license-identifier-Apache-2.0",
- "SPDX-license-identifier-GPL-2.0",
- ],
- // large-scale-change unable to identify any license_text files
-}
-
bpf {
name: "time_in_state.o",
srcs: ["time_in_state.c"],
diff --git a/METADATA b/METADATA
deleted file mode 100644
index e2447fe..0000000
--- a/METADATA
+++ /dev/null
@@ -1,4 +0,0 @@
-third_party {
- # would be NOTICE save for GPL 2.0 in time_in_state.c
- license_type: RESTRICTED
-}
diff --git a/OWNERS b/OWNERS
deleted file mode 100644
index 1fdf1a9..0000000
--- a/OWNERS
+++ /dev/null
@@ -1 +0,0 @@
-connoro@google.com
diff --git a/test/Android.bp b/test/Android.bp
index d667886..6d5fe12 100644
--- a/test/Android.bp
+++ b/test/Android.bp
@@ -14,10 +14,6 @@
// limitations under the License.
//
-package {
- default_applicable_licenses: ["Android-Apache-2.0"],
-}
-
bpf {
name: "bpf_load_tp_prog.o",
srcs: ["bpf_load_tp_prog.c"],
diff --git a/time_in_state.c b/time_in_state.c
index e54817c..b5d8d7d 100644
--- a/time_in_state.c
+++ b/time_in_state.c
@@ -17,9 +17,6 @@
#include <bpf_helpers.h>
#include <bpf_timeinstate.h>
-DEFINE_BPF_MAP_GRW(total_time_in_state_map, PERCPU_ARRAY, uint32_t, uint64_t, MAX_FREQS_FOR_TOTAL,
- AID_SYSTEM)
-
DEFINE_BPF_MAP_GRW(uid_time_in_state_map, PERCPU_HASH, time_key_t, tis_val_t, 1024, AID_SYSTEM)
DEFINE_BPF_MAP_GRW(uid_concurrent_times_map, PERCPU_HASH, time_key_t, concurrent_val_t, 1024, AID_SYSTEM)
@@ -35,12 +32,6 @@
DEFINE_BPF_MAP_GWO(nr_active_map, ARRAY, uint32_t, uint32_t, 1, AID_SYSTEM)
DEFINE_BPF_MAP_GWO(policy_nr_active_map, ARRAY, uint32_t, uint32_t, 1024, AID_SYSTEM)
-DEFINE_BPF_MAP_GWO(pid_tracked_hash_map, HASH, uint32_t, pid_t, MAX_TRACKED_PIDS, AID_SYSTEM)
-DEFINE_BPF_MAP_GWO(pid_tracked_map, ARRAY, uint32_t, tracked_pid_t, MAX_TRACKED_PIDS, AID_SYSTEM)
-DEFINE_BPF_MAP_GWO(pid_task_aggregation_map, HASH, pid_t, uint16_t, 1024, AID_SYSTEM)
-DEFINE_BPF_MAP_GRO(pid_time_in_state_map, PERCPU_HASH, aggregated_task_tis_key_t, tis_val_t, 1024,
- AID_SYSTEM)
-
struct switch_args {
unsigned long long ignore;
char prev_comm[16];
@@ -110,50 +101,6 @@
uint64_t delta = time - old_last;
if (val) val->ar[freq_idx % FREQS_PER_ENTRY] += delta;
- // Add delta to total.
- const uint32_t total_freq_idx = freq_idx < MAX_FREQS_FOR_TOTAL ? freq_idx :
- MAX_FREQS_FOR_TOTAL - 1;
- uint64_t* total = bpf_total_time_in_state_map_lookup_elem(&total_freq_idx);
- if (total) *total += delta;
-
- const int pid = args->prev_pid;
- const pid_t tgid = bpf_get_current_pid_tgid() >> 32;
- bool is_tgid_tracked = false;
-
- // eBPF verifier does not currently allow loops.
- // Instruct the C compiler to unroll the loop into a series of steps.
- #pragma unroll
- for (uint32_t index = 0; index < MAX_TRACKED_PIDS; index++) {
- const uint32_t key = index;
- tracked_pid_t* tracked_pid = bpf_pid_tracked_map_lookup_elem(&key);
- if (!tracked_pid) continue;
- if (tracked_pid->state == TRACKED_PID_STATE_UNUSED) {
- // Reached the end of the list
- break;
- }
-
- if (tracked_pid->state == TRACKED_PID_STATE_ACTIVE && tracked_pid->pid == tgid) {
- is_tgid_tracked = true;
- break;
- }
- }
-
- if (is_tgid_tracked) {
- // If this process is marked for time-in-state tracking, aggregate the CPU time-in-state
- // with other threads sharing the same TGID and aggregation key.
- uint16_t* aggregation_key = bpf_pid_task_aggregation_map_lookup_elem(&pid);
- aggregated_task_tis_key_t task_key = {
- .tgid = tgid,
- .aggregation_key = aggregation_key ? *aggregation_key : 0,
- .bucket = freq_idx / FREQS_PER_ENTRY};
- tis_val_t* task_val = bpf_pid_time_in_state_map_lookup_elem(&task_key);
- if (!task_val) {
- tis_val_t zero_val = {.ar = {0}};
- bpf_pid_time_in_state_map_update_elem(&task_key, &zero_val, BPF_NOEXIST);
- task_val = bpf_pid_time_in_state_map_lookup_elem(&task_key);
- }
- if (task_val) task_val->ar[freq_idx % FREQS_PER_ENTRY] += delta;
- }
key.bucket = nactive / CPUS_PER_ENTRY;
concurrent_val_t* ct = bpf_uid_concurrent_times_map_lookup_elem(&key);
if (!ct) {
@@ -203,42 +150,4 @@
return 0;
}
-// The format of the sched/sched_process_free event is described in
-// adb shell cat /d/tracing/events/sched/sched_process_free/format
-struct sched_process_free_args {
- unsigned long long ignore;
- char comm[16];
- pid_t pid;
- int prio;
-};
-
-DEFINE_BPF_PROG("tracepoint/sched/sched_process_free", AID_ROOT, AID_SYSTEM, tp_sched_process_free)
-(struct sched_process_free_args* args) {
- const int ALLOW = 1;
-
- int pid = args->pid;
- bool is_last = true;
-
- // eBPF verifier does not currently allow loops.
- // Instruct the C compiler to unroll the loop into a series of steps.
- #pragma unroll
- for (uint32_t index = 0; index < MAX_TRACKED_PIDS; index++) {
- const uint32_t key = MAX_TRACKED_PIDS - index - 1;
- tracked_pid_t* tracked_pid = bpf_pid_tracked_map_lookup_elem(&key);
- if (!tracked_pid) continue;
- if (tracked_pid->pid == pid) {
- tracked_pid->pid = 0;
- tracked_pid->state = is_last ? TRACKED_PID_STATE_UNUSED : TRACKED_PID_STATE_EXITED;
- bpf_pid_tracked_hash_map_delete_elem(&key);
- break;
- }
- if (tracked_pid->state == TRACKED_PID_STATE_ACTIVE) {
- is_last = false;
- }
- }
-
- bpf_pid_task_aggregation_map_delete_elem(&pid);
- return ALLOW;
-}
-
LICENSE("GPL");