summaryrefslogtreecommitdiffstats
path: root/llkd
diff options
context:
space:
mode:
authorMark Salyzyn2018-03-26 10:23:00 -0500
committerMark Salyzyn2018-04-18 16:02:05 -0500
commitd035dbbecf44191af398261b722d72026678eea8 (patch)
tree791494c18ef3cde456e80aee9c1da34ff4e74f0d /llkd
parentf089e1403baa70864869aea4eb680c82f7debbb1 (diff)
downloadplatform-system-core-d035dbbecf44191af398261b722d72026678eea8.tar.gz
platform-system-core-d035dbbecf44191af398261b722d72026678eea8.tar.xz
platform-system-core-d035dbbecf44191af398261b722d72026678eea8.zip
llkd: default enabled for userdebug
If LLK_ENABLE_DEFAULT is false, then check "ro.llk.enable" for "eng", also the default value if not set, and then check if userdebug build to establish a default of true for enable. Same for ro.khungtask.enable. Test: llkd_unit_test report eng status on "userdebug" or "user" builds Bug: 33808187 Bug: 72838192 Change-Id: I2adb23c7629dccaa2856c50bccbf4e363703c82c
Diffstat (limited to 'llkd')
-rw-r--r--llkd/README.md6
-rw-r--r--llkd/include/llkd.h8
-rw-r--r--llkd/libllkd.cpp4
-rw-r--r--llkd/llkd.rc34
-rw-r--r--llkd/tests/llkd_test.cpp25
5 files changed, 67 insertions, 10 deletions
diff --git a/llkd/README.md b/llkd/README.md
index 146a99895..71319c8af 100644
--- a/llkd/README.md
+++ b/llkd/README.md
@@ -66,9 +66,15 @@ default false, if true do not sysrq t (dump all threads).
66#### ro.llk.enable 66#### ro.llk.enable
67default false, allow live-lock daemon to be enabled. 67default false, allow live-lock daemon to be enabled.
68 68
69#### llk.enable
70default ro.llk.enable, and evaluated for eng.
71
69#### ro.khungtask.enable 72#### ro.khungtask.enable
70default false, allow [khungtask] daemon to be enabled. 73default false, allow [khungtask] daemon to be enabled.
71 74
75#### khungtask.enable
76default ro.khungtask.enable and evaluated for eng.
77
72#### ro.llk.mlockall 78#### ro.llk.mlockall
73default false, enable call to mlockall(). 79default false, enable call to mlockall().
74 80
diff --git a/llkd/include/llkd.h b/llkd/include/llkd.h
index 2ae28ed77..bd0739bb0 100644
--- a/llkd/include/llkd.h
+++ b/llkd/include/llkd.h
@@ -30,9 +30,11 @@ bool llkInit(const char* threadname); /* threadname NULL, not spawned */
30unsigned llkCheckMilliseconds(void); 30unsigned llkCheckMilliseconds(void);
31 31
32/* clang-format off */ 32/* clang-format off */
33#define LLK_ENABLE_PROPERTY "ro.llk.enable" 33#define LLK_ENABLE_WRITEABLE_PROPERTY "llk.enable"
34#define LLK_ENABLE_DEFAULT false 34#define LLK_ENABLE_PROPERTY "ro." LLK_ENABLE_WRITEABLE_PROPERTY
35#define KHT_ENABLE_PROPERTY "ro.khungtask.enable" 35#define LLK_ENABLE_DEFAULT false /* "eng" and userdebug true */
36#define KHT_ENABLE_WRITEABLE_PROPERTY "khungtask.enable"
37#define KHT_ENABLE_PROPERTY "ro." KHT_ENABLE_WRITEABLE_PROPERTY
36#define LLK_MLOCKALL_PROPERTY "ro.llk.mlockall" 38#define LLK_MLOCKALL_PROPERTY "ro.llk.mlockall"
37#define LLK_MLOCKALL_DEFAULT true 39#define LLK_MLOCKALL_DEFAULT true
38#define LLK_TIMEOUT_MS_PROPERTY "ro.llk.timeout_ms" 40#define LLK_TIMEOUT_MS_PROPERTY "ro.llk.timeout_ms"
diff --git a/llkd/libllkd.cpp b/llkd/libllkd.cpp
index b25eb06c0..d82810572 100644
--- a/llkd/libllkd.cpp
+++ b/llkd/libllkd.cpp
@@ -1032,6 +1032,10 @@ unsigned llkCheckMilliseconds() {
1032 1032
1033bool llkInit(const char* threadname) { 1033bool llkInit(const char* threadname) {
1034 llkLowRam = android::base::GetBoolProperty("ro.config.low_ram", false); 1034 llkLowRam = android::base::GetBoolProperty("ro.config.low_ram", false);
1035 if (!LLK_ENABLE_DEFAULT && android::base::GetBoolProperty("ro.debuggable", false)) {
1036 llkEnable = android::base::GetProperty(LLK_ENABLE_PROPERTY, "eng") == "eng";
1037 khtEnable = android::base::GetProperty(KHT_ENABLE_PROPERTY, "eng") == "eng";
1038 }
1035 llkEnable = android::base::GetBoolProperty(LLK_ENABLE_PROPERTY, llkEnable); 1039 llkEnable = android::base::GetBoolProperty(LLK_ENABLE_PROPERTY, llkEnable);
1036 if (llkEnable && !llkTopDirectory.reset(procdir)) { 1040 if (llkEnable && !llkTopDirectory.reset(procdir)) {
1037 // Most likely reason we could be here is llkd was started 1041 // Most likely reason we could be here is llkd was started
diff --git a/llkd/llkd.rc b/llkd/llkd.rc
index a257e76e1..f762a5ced 100644
--- a/llkd/llkd.rc
+++ b/llkd/llkd.rc
@@ -1,11 +1,41 @@
1# eng default for ro.llk.enable and ro.khungtask.enable
2on property:ro.debuggable=*
3 setprop llk.enable ${ro.llk.enable:-0}
4 setprop khungtask.enable ${ro.khungtask.enable:-0}
5
6on property:ro.debuggable=1
7 setprop llk.enable ${ro.llk.enable:-1}
8 setprop khungtask.enable ${ro.khungtask.enable:-1}
9
10on property:ro.llk.enable=eng
11 setprop llk.enable ${ro.debuggable:-0}
12
13on property:ro.khungtask.enable=eng
14 setprop khungtask.enable ${ro.debuggable:-0}
15
16on property:llk.enable=1
17 setprop llk.enable true
18
19on property:llk.enable=0
20 setprop llk.enable false
21
22on property:khungtask.enable=1
23 setprop khungtask.enable true
24
25on property:khungtask.enable=0
26 setprop khungtask.enable false
27
1# Configure [khungtaskd] 28# Configure [khungtaskd]
2on property:ro.khungtask.enable=true 29on property:khungtask.enable=true
3 write /proc/sys/kernel/hung_task_timeout_secs ${ro.khungtask.timeout:-720} 30 write /proc/sys/kernel/hung_task_timeout_secs ${ro.khungtask.timeout:-720}
4 write /proc/sys/kernel/hung_task_warnings 65535 31 write /proc/sys/kernel/hung_task_warnings 65535
5 write /proc/sys/kernel/hung_task_check_count 65535 32 write /proc/sys/kernel/hung_task_check_count 65535
6 write /proc/sys/kernel/hung_task_panic 1 33 write /proc/sys/kernel/hung_task_panic 1
7 34
8on property:ro.llk.enable=true 35on property:khungtask.enable=false
36 write /proc/sys/kernel/hung_task_panic 0
37
38on property:llk.enable=true
9 start llkd 39 start llkd
10 40
11service llkd /system/bin/llkd 41service llkd /system/bin/llkd
diff --git a/llkd/tests/llkd_test.cpp b/llkd/tests/llkd_test.cpp
index e3c95eba3..2de18205c 100644
--- a/llkd/tests/llkd_test.cpp
+++ b/llkd/tests/llkd_test.cpp
@@ -64,10 +64,16 @@ void execute(const char* command) {
64} 64}
65 65
66seconds llkdSleepPeriod(char state) { 66seconds llkdSleepPeriod(char state) {
67 auto default_enable = android::base::GetBoolProperty(LLK_ENABLE_PROPERTY, LLK_ENABLE_DEFAULT); 67 auto default_eng = android::base::GetProperty(LLK_ENABLE_PROPERTY, "eng") == "eng";
68 if (android::base::GetProperty(LLK_ENABLE_PROPERTY, "nothing") == "nothing") { 68 auto default_enable = LLK_ENABLE_DEFAULT;
69 GTEST_LOG_INFO << LLK_ENABLE_PROPERTY " defaults to " << (default_enable ? "true" : "false") 69 if (!LLK_ENABLE_DEFAULT && default_eng &&
70 << "\n"; 70 android::base::GetBoolProperty("ro.debuggable", false)) {
71 default_enable = true;
72 }
73 default_enable = android::base::GetBoolProperty(LLK_ENABLE_PROPERTY, default_enable);
74 if (default_eng) {
75 GTEST_LOG_INFO << LLK_ENABLE_PROPERTY " defaults to \"eng\" thus "
76 << (default_enable ? "true" : "false") << "\n";
71 } 77 }
72 // Hail Mary hope is unconfigured. 78 // Hail Mary hope is unconfigured.
73 if ((GetUintProperty(LLK_TIMEOUT_MS_PROPERTY, LLK_TIMEOUT_MS_DEFAULT) != 79 if ((GetUintProperty(LLK_TIMEOUT_MS_PROPERTY, LLK_TIMEOUT_MS_DEFAULT) !=
@@ -78,6 +84,8 @@ seconds llkdSleepPeriod(char state) {
78 execute("stop llkd"); 84 execute("stop llkd");
79 rest(); 85 rest();
80 std::string setprop("setprop "); 86 std::string setprop("setprop ");
87 execute((setprop + LLK_ENABLE_WRITEABLE_PROPERTY + " false").c_str());
88 rest();
81 execute((setprop + LLK_TIMEOUT_MS_PROPERTY + " 120000").c_str()); 89 execute((setprop + LLK_TIMEOUT_MS_PROPERTY + " 120000").c_str());
82 rest(); 90 rest();
83 execute((setprop + KHT_TIMEOUT_PROPERTY + " 130").c_str()); 91 execute((setprop + KHT_TIMEOUT_PROPERTY + " 130").c_str());
@@ -86,8 +94,15 @@ seconds llkdSleepPeriod(char state) {
86 rest(); 94 rest();
87 execute((setprop + LLK_ENABLE_PROPERTY + " true").c_str()); 95 execute((setprop + LLK_ENABLE_PROPERTY + " true").c_str());
88 rest(); 96 rest();
97 execute((setprop + LLK_ENABLE_WRITEABLE_PROPERTY + " true").c_str());
98 rest();
99 }
100 default_enable = LLK_ENABLE_DEFAULT;
101 if (!LLK_ENABLE_DEFAULT && (android::base::GetProperty(LLK_ENABLE_PROPERTY, "eng") == "eng") &&
102 android::base::GetBoolProperty("ro.debuggable", false)) {
103 default_enable = true;
89 } 104 }
90 default_enable = android::base::GetBoolProperty(LLK_ENABLE_PROPERTY, false); 105 default_enable = android::base::GetBoolProperty(LLK_ENABLE_PROPERTY, default_enable);
91 if (default_enable) { 106 if (default_enable) {
92 execute("start llkd"); 107 execute("start llkd");
93 rest(); 108 rest();