summaryrefslogtreecommitdiff
path: root/power-libperfmgr
AgeCommit message (Collapse)Author
2023-03-08ADPF: send ADPF_FIRST_FRAME hintJimmy Shiu
To send ADPF_FIRST_FRAME hint when reportWorkDurations was called first time after stale state. Bug: 243025173 Test: PtsUiBench & CUJ Change-Id: I4377b1f549646bcf44bdf26b2657b7bc0646f9a4 Merged-In: I4377b1f549646bcf44bdf26b2657b7bc0646f9a4
2023-03-08ADPF: support sending power hintJimmy Shiu
Send a hint only when the system can support the hint. Bug: 243025173 Test: PtsUiBench & CUJ Change-Id: If56d0c22f8dd61f5fe27ba79f08f2963269abe41 Merged-In: If56d0c22f8dd61f5fe27ba79f08f2963269abe41
2022-10-28ADPF: fix use-after-free crashJimmy Shiu
The main problem is the timer thread could be woken after the session was destroyed. We did have a closed flag which was set in destructor and the flag would be checked before handleMessage accessing the session instance. To fix the problem, the operations of flag checking and session instance accessing should be guarded by the lock. Bug: 236674672 Test: manual test Change-Id: I49a18efbc135b1bc070b101038a8a0bcc6e19fec
2022-10-14libperfmgr: add control property to control actionWei Wang
Add some basic control logic into libperfmgr to disable or enable certain actions. "EnableProperty" can be set by external process or internally by PropertyNode, if not assigned or set, action is enabled by default. Bug: 241054358 Test: /data/nativetest64/libperfmgr_test/libperfmgr_test Signed-off-by: Wei Wang <wvw@google.com> Change-Id: I5742bb901492f2675c5c88d9b09c1072ded8432a
2022-08-16ADPF: optimize the wakeup performance and fix unstable boost.jimmyshiu
Optimize boost: A more efficient way is to trigger the wakeup boost through mTidSessionListMap, so the time complexity reduce from O(n^3) to O(n^2). The original code path: PSM:wakeSessions() contains a loop that is O(n), inside the loop, it calls to PHS::wakeup() which call to PSM::setUclampMinLocked(), and PSM::setUclampMinLocked() contains two loops O(n^2) The new code path: PSM::wakeSessions() directly checks all the ADPF tasks O(n) and get the wakeup boost value O(n), then directly set the uclamp.min The time complexity lower to O(n^2). Fix unstable boost: The original flow is to find max boost and wake it up from stale state one by one. But the previous woken ones would not be counted when the later ones finding their max boost value. The new flow boost all the tasks first, then wake up all those sessions. Bug: 235510337 Test: Manually playing UIBench -> Transitions -> ActivityTransition Change-Id: I995673b74401e198eb72188134ba1ebc134f971c
2022-08-09ADPF: extend non-stale session timer in wakeupWei Wang
For DISPLAY_UPDATE_IMMINENT wakeup signal, non-stale session's timer should be also extended. This resolves the performance issue caused those sessions to go stale     prematurely. Bug: 241621485 Test: Build Signed-off-by: Wei Wang <wvw@google.com> Change-Id: I06330e064060248bb556ae35e0cb8fd302cef231
2022-06-16ADPF: Fix updateHintBoost blocks the binder threadjimmyshiu
post the task into a looper thread. Bug: 232992641 Test: Manually playing UIBench -> Transitions -> ActivityTransition Change-Id: Ibd241834f904b4c87a51363e766e110d2818d496
2022-06-09Fix uclamp_min stuck at high freqjimmyshiu
Separate Stale and EarlyBoost handlers and refine the code. Test: adb shell dumpsys android.hardware.power.IPower/default Test: Manual Bug: 232992641 Change-Id: I81a4fd96fb7311ae5bbb7cbabe72378c9cad4aa3
2022-06-07Fix race between closing a session and receiving a boostWill McVicker
We need to be holding the session lock when we dereference mDescriptor since mDescriptor is destroyed when the session is closed. This patch takes the session lock and verifies if it's still open during wakeup. Test: vts run -m VtsHalGraphicsComposerV2_4TargetTest Bug: 232992641 Change-Id: I4000a85bf2932cfdcddd3006d671a3c91ed32c48
2022-05-27Merge changes from topic "ADPF-I-Signal-And-Init" into tm-devWei Wang
* changes: ADPF: dump ADPF session info ADPF: uclamp.min integration ADPF: Add UclampMinInit in ADPF profile
2022-05-27ADPF: dump ADPF session infojimmyshiu
Dump current ADPF profile and ADPF session list into bugreport. Bug: 204444691 Test: adb root && adb shell dumpsys android.hardware.power.IPower/default Test: gpaste/6469309887938560 Change-Id: I17c0d615051f5e51c2e1fe99d17c402f9a65679a
2022-05-27ADPF: uclamp.min integrationjimmyshiu
Integrate the uclamp.min across sessions. Add UClampMininit as the display update boost Bug: 232313238 Test: Manual test Change-Id: I601f407b0b5383a1e39eac448d45cbaaeb7788fb
2022-05-26ADPF: Add UclampMinInit in ADPF profilejimmyshiu
For display hints, adding UclampMinInit as boost value. Bug: 198663407 Test: manual test Change-Id: Ie110e9ecbf01c2d5047a006fed02bf61aed53e0d
2022-05-20Merge "Fix cancelling hints when refreshing expiring hints." into tm-devWei Wang
2022-05-16Fix cancelling hints when refreshing expiring hints.Misha Wagner
When choose a new throttle option, we: 1. Send the new hints. 2. Cancel the old hints. After b/230316778, we also sometimes do this when the hint *doesn't change*, so we can "refresh" the hint if it's about to expire. This send & immediately cancels the same hints, which essentially just cancels the hint. The solution is to only do step #1 from above when refreshing the hint. Bug: 232782573 Test: manual Change-Id: I2a6d83a29b683d7e1f8d71b8fff700b51d1839cf
2022-05-13ADPF: remove UclampMin_Granularity from HintManagerTestjimmyshiu
No need to prevent uclamp.min update rate by Granularity. There is no perf impact. Bug: 232336917 Test: /data/nativetest64/libperfmgr_test/libperfmgr_test Change-Id: Iec836709bb1b9b3f1ae5d0e93bbe677a06bf0475
2022-05-13PowerHAL: remove UclampMinGranularityWei Wang
This is causing session update skipped and stuck. Bug: 232336917 Test: /data/nativetest64/libperfmgr_test/libperfmgr_test Signed-off-by: Wei Wang <wvw@google.com> Change-Id: I8928b6f6a60dcf8d21e60228a74d3aa0ab792eff
2022-05-03Merge "Prevent hint timeouts when same hint is repeatedly sent." into tm-devMisha Wagner
2022-04-29Ignore system hint sessions for universal boostMatt Buckley
Currently PowerHAL does not distinguish between system processes and apps when deciding whether to apply universal boost. This patch distinguishes system sessions and app sessions and ignores system ones, making the disabling of universal boost dependent on the presence of app hint sessions. Bug: b/230511824 Test: manual Change-Id: I08dea29b3a45f2ba69ed99a9f188fa83ba143423
2022-04-27Fix libperfmgr_testMilo Sredkov
Add require_root: true to libperfmgr_test, as it fails to set system properties otherwise. Also delete the TEST_MAPPING file as it has no effect. Bug: 226554297 Bug: 219861370 Test: atest libperfmgr_test Change-Id: Ib9d69fbe68203c4ce8181e76fb0747bd5bbb0595 Merged-In: Ib9d69fbe68203c4ce8181e76fb0747bd5bbb0595
2022-04-25Prevent hint timeouts when same hint is repeatedly sent.Misha Wagner
If we repeatedly send the same hint (as we do in lab test to constantly throttle) then we will only send the hint once, as we don't send a hint if the hint doesn't change. The timeout still applies to these hints, resulting in the hint only lasting 2s, despite being consistently renewed. This problem is unlikely to significantly effect ACPU, as we often change the throttle level more frequently than every 2s. However, this will still have some impact. Thanks vvaldes@ for spotting this! Bug: 230316778 Test: manual Change-Id: I255cfcfbd732782cfa60f2b86d785ef4d62d3ead
2022-04-25ADPF: log clean upjimmyshiu
Remove ALOGD logs. Bug: 230205812 Test: adb shell logcat -b all | grep libperf Change-Id: I4125afec526b76e3905e75c22fc2bfb555810fa8
2022-04-21Merge "Add minimal binder thread prio as -20 to match process prio" into tm-devWei Wang
2022-04-21Merge "Add the tests in power-libperfmgr to device-tests" into tm-devTreeHugger Robot
2022-04-21Add minimal binder thread prio as -20 to match process prioWei Wang
Bug: 227811781 Test: Build Change-Id: I94670429ede032703661ee8eb8b1ea6456f5cbd5 Signed-off-by: Wei Wang <wvw@google.com>
2022-04-21Add the tests in power-libperfmgr to device-testsMilo Sredkov
Bug: 219861370 Test: atest Change-Id: I213f37d870dbd3011c1e2e01aeebfa15c39495e6 (cherry picked from commit c8c1dc41875a2583c0606141759fdeac3a17238c) Merged-In: I213f37d870dbd3011c1e2e01aeebfa15c39495e6
2022-04-21Merge "Update Adaptive CPU model to 0704_D35_IT3_ALT_s141k." into tm-devMisha Wagner
2022-04-20Update Adaptive CPU model to 0704_D35_IT3_ALT_s141k.Misha Wagner
Performance shows ~7% reduction in CPU drain, and ~1% increase in missed deadlines. We will experiment with this model in teamfood. Bug: 192553577 Test: m & flash Change-Id: I76129528c065b2cf50dca97eda22d5b80437c3a8
2022-04-20ADPF: add Early Hint featureJimmy Shiu
Add Early Hint feature and integrate with Stale Timer Bug: 198379880 Test: build and manual test Change-Id: I17009ee5b9ff922a79ccf5cb68be5b959038267d
2022-04-20ADPF: Use Adpf Profile for PID tunnablesJimmy Shiu
1. Use Adpf Profile to replace system-property-based PID tunnables. 2. Add a tunable for switch PID on/off 3. Switch Adpf Profile by hint name (ex: REFRESH_120FPS) Bug: 202158746 Bug: 204444691 Bug: 206061061 Test: Build Change-Id: Ia673a6bf64d40128ca1797d1e26fe564b3b35ff1
2022-04-20ADPF: HintManager supports ADPF ProfilesJimmy Shiu
Add the following function to support ADPF profiles HintManager::ParseAdpfConfigs, HintManager::setAdpfProfile, HintManager::getAdpfProfile functions Bug: 202158746 Test: make libperfmgr_test -j100 && adb push \ out/target/product/raven/data/nativetest64/libperfmgr_test/libperfmgr_test \ /data/nativetest64/libperfmgr_test/libperfmgr_test \ && adb shell /data/nativetest64/libperfmgr_test/libperfmgr_test Change-Id: Ib7194eabc9c110de36c5ee7cc1fff9020d1c8175
2022-04-20ADPF: make uclamp.min stableJimmy Shiu
Considering the previous uclamp.min value is the base of PID output. Instead of: `next_min = std::min(sUclampMinHighLimit, output);` We should use: `next_min = std::min(sUclampMinHighLimit, current_min + output);` When session status entered stale state, set the uclamp to 0, but keep the current_min. That would be helpful for boosting the heavy workload of the first few frames. Bug: 204444691 Test: build && manual test Change-Id: Idb19e2bfd8e9522fae5fd452b1fcc58786e96e65
2022-04-20Make HintManager a singleton classJimmy Shiu
HintManager is unique and widely used in many different components. This is for making it easiler to be reloaded for debugging. Bug: 172285365 Test: adb push \ out/target/product/raven/data/nativetest64/libperfmgr_test/libperfmgr_test \ /data/nativetest64/libperfmgr_test/libperfmgr_test && \ adb shell /data/nativetest64/libperfmgr_test/libperfmgr_test Change-Id: I3affdfe780073ebbc50fac7bfbdd1530ee9dc8c2
2022-04-07PowerHintSession: do not update PID controller when target changesWei Wang
There is no history kept in powerhint session, so let us just keep what we have in the PID controller and let new samples settle. Bug: 227003278 Test: Build Change-Id: Ia8b9a0be288389ec36ac35c668aca013d470c257
2022-03-31Merge "Fix race condition between Looper and destructor" into tm-devTreeHugger Robot
2022-03-31Fix race condition between Looper and destructorJimmy Shiu
1. Clean all messages before add new. 2. Insteading of using `this`, use the unique mStaleHandler sp so Looper can hold the sp to keep the instance alive until the last message done. Test: Manual Test Bug: 219965773 Change-Id: Ic039146f0b966c1f27d86b121d4b72b75ff360e5
2022-03-25Don't fail when acpu_stats is non-monotonic.Misha Wagner
This seems to happen very rarely. Submitting this client-side fix which can be rolled back if we find a root cause. Test: atest libadaptivecpu_test:KernelCpuFeatureReaderTest Bug: 219960248 Change-Id: Ibbb54e94a7dbea42adf016bcbbc5f3d9fc63f9c9 Merged-In: Ibbb54e94a7dbea42adf016bcbbc5f3d9fc63f9c9 (cherry picked from commit a0d958ddbe4bff7150744d87ea7fa1c9fbf2db0a)
2022-03-14Read `ro.product.device` in Adaptive CPU.Misha Wagner
See b/222438951 for justification. When model.inc is interpretting this enum, I think it should treat UNKNOWN as e.g. RAVEN, so the model can still do something sensible. I've left that to the model-side to make debugging the non-model code easier. Test: manual validation of counters: http://screen/Az9viP9e25eWQgL Bug: 222438951 Change-Id: Id648b23d7bee4c34cdf077e93cf4a932265673c7 Merged-In: Id648b23d7bee4c34cdf077e93cf4a932265673c7
2022-03-03Add OWNERS file for adaptivecpu/models.Misha Wagner
Bug: 188770301 Test: none Change-Id: I45aa2d355c9e8f671db7dc4cd96f4c9f783f24f9
2022-03-03Update model with tag `acpu-2202_EX01_IT02_TR01_plain`.Misha Wagner
vvaldes@ has been retraining the model for Pixel 6 Pro. While this won't be the final model, having a sensible model means we can start running a coin flip experiment & test our field infra. As this will take a while to make it to daily/weekly builds, I'd like to submit this ASAP so we can kick off experiments in 1-2 weeks. Bug: 192553577 Test: m Change-Id: Ic15f67eb5c6700b78c4929bdad1880d5de44407f
2022-02-28Change Adaptive CPU log tag to "powerhal-adaptivecpu".Misha Wagner
Bug: 188770301 Test: m Change-Id: I3a926d7a3573887a6ef31f728dc91875380d7a57 Merged-In: I3a926d7a3573887a6ef31f728dc91875380d7a57 (cherry picked from commit 7be08e5009d04787ae9a4a54c987cbf09b1e957c)
2022-02-28Fix out-of-bounds issue with sampling random decisions.Misha Wagner
Bug: 219743541 Test: atest libadaptivecpu_test:ModelTest Change-Id: I57eb81d9d21e5a1c36391d9427614c78147eafac Merged-In: I57eb81d9d21e5a1c36391d9427614c78147eafac (cherry picked from commit 0bedc2ac715eb30a408a7406a500b535a9285728)
2022-02-28Fix AdaptiveCpuConfigTest.Misha Wagner
Because we weren't clearing the properties, this was hiding some implementation issues. Test: atest libadaptivecpu_test:AdaptiveCpuConfigTest Bug: 219743541 Change-Id: I58a32a1fec8d6029fd69c04a7799038fd01228bd Merged-In: I58a32a1fec8d6029fd69c04a7799038fd01228bd (cherry picked from commit 87834c2ce78de02e6895d284a751bc3be442d962)
2022-02-28Clear randomThrottleOptions when re-reading config.Misha Wagner
Test: manual Bug: 219743541 Change-Id: Id8bf90497c1f4861cc11b3eba26b553f0c917072 (cherry picked from commit 3fede27cdb909bddf362e3800d47aefae5e57643)
2022-02-28Add random_throttle_options config to Adaptive CPU.Misha Wagner
We'll need this config for collecting traces in the field. These will need to (rarely) randomly throttle, but if we're training a model to use a subset of the actions (e.g. just NO_THROTTLE and THROTTLE_70) then we don't want randomly choose other actions (e.g. THROTTLE_80). Also, instead of just logging a warning, fail if the random throttle probabilty >100%. Test: atest libadaptivecpu_test:AdaptiveCpuConfigTest Bug: 219743541 Change-Id: Ie51bd5a4641176998a07d5ccea4933fbd50ef6eb Merged-In: Ie51bd5a4641176998a07d5ccea4933fbd50ef6eb (cherry picked from commit 43e7ec180a428669962aa27e751f413fc86cd9eb)
2022-02-17libperfmgr: Fix test failuresJimmy Shiu
Fix the following two testcases: FileNodeTest.DumpToFdTest PropertyNodeTest.DumpToFdTest Bug: 206981628 Test: adb shell /data/nativetest64/libperfmgr_test/libperfmgr_test Change-Id: Ib8e6ac3c41c687857bb0b93632fcbb79efc2d780
2022-02-15Add global debug property for override config path properlyWei Wang
An init trigger would restart powerhal as early as the property was loaded and it is hopefully early than any clients would try to connect. Also remove the obsolete restart hook with audio. Bug: 218872105 Test: boot Signed-off-by: Wei Wang <wvw@google.com> Change-Id: Ib55897f65709a963016b729f213718aae5af8e8c
2022-02-11Merge "Add a debug property for switching powerhint.json path"Jimmy Shiu
2022-02-11Add a debug property for switching powerhint.json pathJimmy Shiu
Add a bool property `vendor.powerhal.config.debug`. Power HAL would use `/data/vendor/etc/powerhint.json` when vendor.powerhal.config.debug = true. Bug: 218872105 Bug: 206061061 Test: adb wait-for-device root; adb shell mkdir -p /data/vendor/etc/; adb push powerhint_mod.json /data/vendor/etc/powerhint.json Test: adb shell setprop vendor.powerhal.config.debug true && \ adb shell getprop vendor.powerhal.config.debug && \ adb shell stop vendor.power-hal-aidl && \ adb shell start vendor.power-hal-aidl && adb shell stop && adb shell start Test: adb pull /data/local.prop ; vim local.prop + vendor.powerhal.config.debug=true Test: adb wait-for-device root && adb shell perfetto -o \ /data/misc/perfetto-traces/trace_file.perfetto-trace -t 20s sched freq \ idle am wm gfx view power hal && \ adb pull /data/misc/perfetto-traces/trace_file.perfetto-trace trace_profile_debug.pftrace Change-Id: Ibaf5df280b989a8268efce1e3ab9a3f1e5510800
2022-02-07Only open acpu_stats file once.Misha Wagner
This means we can just seek & read in the main loop. This speeds up feature collection 2x. Bug: 207662659 Test: atest libadaptivecpu_tests:KernelCpuFeatureReaderTest Change-Id: Ie9259ffea19bb9d10196b9ced5543581e1f80734