Merge "Cleanup symlink for system/core/{libbacktrace, libunwindstack}"
diff --git a/init/security.cpp b/init/security.cpp
index 2450d65..ac784a3 100644
--- a/init/security.cpp
+++ b/init/security.cpp
@@ -19,6 +19,7 @@
#include <errno.h>
#include <fcntl.h>
#include <linux/perf_event.h>
+#include <selinux/selinux.h>
#include <sys/ioctl.h>
#include <sys/syscall.h>
#include <unistd.h>
@@ -222,6 +223,19 @@
// supporting kernels that precede the perf_event_open hooks (Android common
// kernels 4.4 and 4.9).
Result<void> TestPerfEventSelinuxAction(const BuiltinArguments&) {
+ // Special case: for *development devices* that boot with permissive
+ // SELinux, treat the LSM hooks as present for the effect of lowering the
+ // perf_event_paranoid sysctl. The sysprop is reused for pragmatic reasons,
+ // as there no existing way for init rules to check for permissive boot at
+ // the time of writing.
+ if (ALLOW_PERMISSIVE_SELINUX) {
+ if (!security_getenforce()) {
+ LOG(INFO) << "Permissive SELinux boot, forcing sys.init.perf_lsm_hooks to 1.";
+ SetProperty("sys.init.perf_lsm_hooks", "1");
+ return {};
+ }
+ }
+
// Use a trivial event that will be configured, but not started.
struct perf_event_attr pe = {
.type = PERF_TYPE_SOFTWARE,
diff --git a/libprocessgroup/profiles/cgroups.json b/libprocessgroup/profiles/cgroups.json
index 4518487..5b7a28a 100644
--- a/libprocessgroup/profiles/cgroups.json
+++ b/libprocessgroup/profiles/cgroups.json
@@ -32,13 +32,6 @@
"Mode": "0700",
"UID": "root",
"GID": "system"
- },
- {
- "Controller": "schedtune",
- "Path": "/dev/stune",
- "Mode": "0755",
- "UID": "system",
- "GID": "system"
}
],
"Cgroups2": {
diff --git a/libprocessgroup/profiles/task_profiles.json b/libprocessgroup/profiles/task_profiles.json
index c4dbf8e..ea0064f 100644
--- a/libprocessgroup/profiles/task_profiles.json
+++ b/libprocessgroup/profiles/task_profiles.json
@@ -31,16 +31,6 @@
"File": "memory.swappiness"
},
{
- "Name": "STuneBoost",
- "Controller": "schedtune",
- "File": "schedtune.boost"
- },
- {
- "Name": "STunePreferIdle",
- "Controller": "schedtune",
- "File": "schedtune.prefer_idle"
- },
- {
"Name": "UClampMin",
"Controller": "cpu",
"File": "cpu.uclamp.min"
@@ -51,6 +41,11 @@
"File": "cpu.uclamp.max"
},
{
+ "Name": "UClampLatencySensitive",
+ "Controller": "cpu",
+ "File": "cpu.uclamp.latency_sensitive"
+ },
+ {
"Name": "FreezerState",
"Controller": "freezer",
"File": "cgroup.freeze"
@@ -65,7 +60,7 @@
"Name": "JoinCgroup",
"Params":
{
- "Controller": "schedtune",
+ "Controller": "cpu",
"Path": "background"
}
}
@@ -104,7 +99,7 @@
"Name": "JoinCgroup",
"Params":
{
- "Controller": "schedtune",
+ "Controller": "cpu",
"Path": ""
}
}
@@ -117,7 +112,7 @@
"Name": "JoinCgroup",
"Params":
{
- "Controller": "schedtune",
+ "Controller": "cpu",
"Path": "foreground"
}
}
@@ -130,7 +125,7 @@
"Name": "JoinCgroup",
"Params":
{
- "Controller": "schedtune",
+ "Controller": "cpu",
"Path": "top-app"
}
}
@@ -143,7 +138,7 @@
"Name": "JoinCgroup",
"Params":
{
- "Controller": "schedtune",
+ "Controller": "cpu",
"Path": "rt"
}
}
@@ -156,12 +151,25 @@
"Name": "JoinCgroup",
"Params":
{
- "Controller": "schedtune",
+ "Controller": "cpu",
"Path": "camera-daemon"
}
}
]
},
+ {
+ "Name": "NNApiHALPerformance",
+ "Actions": [
+ {
+ "Name": "JoinCgroup",
+ "Params":
+ {
+ "Controller": "cpu",
+ "Path": "nnapi-hal"
+ }
+ }
+ ]
+ },
{
"Name": "CpuPolicySpread",
@@ -170,7 +178,7 @@
"Name": "SetAttribute",
"Params":
{
- "Name": "STunePreferIdle",
+ "Name": "UClampLatencySensitive",
"Value": "1"
}
}
@@ -183,7 +191,7 @@
"Name": "SetAttribute",
"Params":
{
- "Name": "STunePreferIdle",
+ "Name": "UClampLatencySensitive",
"Value": "0"
}
}
diff --git a/rootdir/init.rc b/rootdir/init.rc
index 900edb4..746fc61 100644
--- a/rootdir/init.rc
+++ b/rootdir/init.rc
@@ -148,6 +148,27 @@
chmod 0664 /dev/stune/top-app/tasks
chmod 0664 /dev/stune/rt/tasks
+ # cpuctl hierarchy for devices using utilclamp
+ mkdir /dev/cpuctl/foreground
+ mkdir /dev/cpuctl/background
+ mkdir /dev/cpuctl/top-app
+ mkdir /dev/cpuctl/rt
+ chown system system /dev/cpuctl
+ chown system system /dev/cpuctl/foreground
+ chown system system /dev/cpuctl/background
+ chown system system /dev/cpuctl/top-app
+ chown system system /dev/cpuctl/rt
+ chown system system /dev/cpuctl/tasks
+ chown system system /dev/cpuctl/foreground/tasks
+ chown system system /dev/cpuctl/background/tasks
+ chown system system /dev/cpuctl/top-app/tasks
+ chown system system /dev/cpuctl/rt/tasks
+ chmod 0664 /dev/cpuctl/tasks
+ chmod 0664 /dev/cpuctl/foreground/tasks
+ chmod 0664 /dev/cpuctl/background/tasks
+ chmod 0664 /dev/cpuctl/top-app/tasks
+ chmod 0664 /dev/cpuctl/rt/tasks
+
# Create an stune group for NNAPI HAL processes
mkdir /dev/stune/nnapi-hal
chown system system /dev/stune/nnapi-hal
@@ -156,6 +177,14 @@
write /dev/stune/nnapi-hal/schedtune.boost 1
write /dev/stune/nnapi-hal/schedtune.prefer_idle 1
+ # cpuctl hierarchy for devices using utilclamp
+ mkdir /dev/cpuctl/nnapi-hal
+ chown system system /dev/cpuctl/nnapi-hal
+ chown system system /dev/cpuctl/nnapi-hal/tasks
+ chmod 0664 /dev/cpuctl/nnapi-hal/tasks
+ write /dev/cpuctl/nnapi-hal/cpu.uclamp.min 1
+ write /dev/cpuctl/nnapi-hal/cpu.uclamp.latency_sensitive 1
+
# Create blkio group and apply initial settings.
# This feature needs kernel to support it, and the
# device's init.rc must actually set the correct values.