• Introducing XDA Computing: Discussion zones for Hardware, Software, and more!    Check it out!

[KERNEL][11] Placebo Kernel - LOS 18.1 Undervolting

Search This thread

Boatshow

Senior Member
@v00d007 Are you using some kind of custom ROM? I've only tested this in LOS 18.1. Maybe a custom mod removed the stock hotplugger.

I can tell you about how 18.1 starts the hotplugger though. It should run as
Code:
/vendor/bin/mpdecision --avg_comp

There is a code snippet at /system/vendor/etc/init/hw/init.qcom.rc that includes
Code:
service mpdecision /vendor/bin/mpdecision --avg_comp
     class main
     user root
     group root readproc
     disabled

I think this is how the LOS makes the hotplugger start but I'm not sure. I opened a terminal with root, did killall mpdecision a few times and tried running it directly but nothing interesting happened. Anyone know how this binary can be manipulated?
 
Last edited:
  • Like
Reactions: v00d007

v00d007

Senior Member
Feb 28, 2014
1,369
468
@Boatshow
He says it's LOS stock kernel.

Yes, the MPDecision binary is present.

The command "/vendor/bin/mpdecision --avg_comp" seems to start MPDecision - at least somehow: strangely it sets just one core (core 2) offline for almost all the time. Energy saving for Multicore CPU is set to activated.
 
Last edited:

Boatshow

Senior Member
This information might be of interest to someone. There exists a file at /system/vendor/etc/thermal-engine-8974.conf and it seems like it's used by another Qualcomm binary that controls thermal throttling. It's possible to edit and replace this file with a Magisk module although it's probably not necessary.

I think set_point is the throttle temperature in celsius x 1000. When the component reaches set_point it throttles to the clock values in override until the temperature drops below set_point_clr.

The CPU core throttle seems to be 75C which can be pretty hard to reach if the phone is undervolted. Mine is generally around 65C when busy with normal workloads but I can cause throttling if I use the 4 core AES benchmark.

You can see various sampled temperatures the Qualcomm binaries by running "dmesg | grep msm" as root. No idea what the 10 numbers correspond to but they seem like temperatures.

Code:
sampling         5000

[SS-CPU0]
#algo_type       ss
sampling         100
sensor           cpu0
device           cpu
set_point        75000
set_point_clr    60000
override         15000

[SS-CPU1]
#algo_type       ss
sampling         100
sensor           cpu1
device           cpu
set_point        75000
set_point_clr    60000
override         15000

[SS-CPU2]
#algo_type       ss
sampling         100
sensor           cpu2
device           cpu
set_point        75000
set_point_clr    60000
override         15000

[SS-CPU3]
#algo_type       ss
sampling         100
sensor           cpu3
device           cpu
set_point        75000
set_point_clr    60000
override         15000

[SS-GPU]
#algo_type       ss
sampling         250
sensor           tsens_tz_sensor10
device           gpu
set_point        85000
set_point_clr    55000
override         15000

[SS-POPMEM]
#algo_type       ss
sampling         10
sensor           pop_mem
device           cpu
set_point        80000
set_point_clr    55000
override         15000
time_constant    16

[GPU_MONITOR]
algo_type        monitor
sensor           tsens_tz_sensor10
sampling         1000
thresholds       75000
thresholds_clr   55000
actions          battery
action_info      1

[CPU0_MONITOR]
algo_type        monitor
sensor           cpu0
sampling         65
thresholds       115000
thresholds_clr   110000
actions          shutdown
action_info      0

[CPU1_MONITOR]
algo_type        monitor
sensor           cpu1
sampling         65
thresholds       115000
thresholds_clr   110000
actions          shutdown
action_info      0

[CPU2_MONITOR]
algo_type        monitor
sensor           cpu2
sampling         65
thresholds       115000
thresholds_clr   110000
actions          shutdown
action_info      0

[CPU3_MONITOR]
algo_type        monitor
sensor           cpu3
sampling         65
thresholds       115000
thresholds_clr   110000
actions          shutdown
action_info      0
 
Last edited:

Nobby1960

Senior Member
Jun 3, 2016
841
401
Freiburg
Thanks, mate. But I left AOSP again for now and went back to my favorite (bugfree) TW rom. Good luck and thanks for your efforts.
If you would try an other AOSP ROM (in further times) I can warmly recommend the crDroid 6.10 final (Q), with the great Tuned Kernel. Runs really fine here on my second G900F. The other runs with the Alexandr TW ROM (nearly stock, debloated). So I can always compare well.
 
Last edited:

v00d007

Senior Member
Feb 28, 2014
1,369
468
But v5.5 has some major bugs. Search the thread and you'll find my and other's bug reports and you'll find v5.

I forgot: HERE ARE THE LINKS:

@Nobby1960
Thanks, but I'll pass...

@Boatshow
Sorry for this off-topic spam...
 
Last edited:
  • Like
Reactions: vlad3647

Boatshow

Senior Member
Experimental Magisk module to increase CPU temperature throttle thresholds on your S5. Only tested on LOS 18.1. Other custom ROMs may already have similar modifications.

THIS MODIFICATION WILL PROBABLY CAUSE YOUR PHONE AND BATTERY TO WEAR OUT FASTER! THERE IS PROBABLY NO GOOD REASON FOR ANYONE TO USE THIS MODIFICATION.

Will move this to the first post if somebody can explain to me how this can possibly be useful to anybody. Tampering with these values seems like a terrible idea to me.

CPU start throttle threshold changed from 75C -> 80C
CPU stop throttle threshold changed from 60C -> 65C

Installation:
1. Place thermal_banger.zip on phone
2. Open Magisk app and install zip
3. Reboot

Uninstallation:
1. Open Magisk app and disable the module with the slider

How to test before and after:
Before:
0. Your performance profile needs to be "Balanced" or higher. Efficient and Powersave throttles too hard and will not allow your CPU to cook.

Settings > Battery >Battery Saver and Performance > Performance Profile

1. Start a session in Termux and use su to gain root.
2. Run "while true; do dmesg | grep msm; sleep 5s; done"
3. Start a second session in Termux
4. Run "while true; do openssl speed -multi 2 -evp aes-256-gcm; done"
5. In the first Termux session with the temperature logs you should notice two reading that climbs to about 75C before plateauing.

After:
Repeat the same thing as above. You should notice two readings that climbs to about 80C before plateauing.

You may also look at SmartPack for general CPU temperature readings.

THIS MODIFICATION WILL PROBABLY CAUSE YOUR PHONE AND BATTERY TO WEAR OUT FASTER! THERE IS PROBABLY NO GOOD REASON FOR ANYONE TO USE THIS MODIFICATION.
 

Attachments

  • thermal_banger.zip
    3 KB · Views: 1
Last edited:

Top Liked Posts

  • There are no posts matching your filters.
  • 3
    Changelog:
    2021-06-06
    -Merge to 54ffccbf053b5b6ca4f6e45094b942fab92a25fc

    Disclaimer: I have no idea what I'm doing, I just copy pasted some stuff together and compiled the kernel. This kernel was only momentarily tested on an SM-G900T (klte). If there's a compatibility problem you will probably boot loop until you fix it. Undervolting can cause issues. You have been warned!

    This is the LOS 18.1 kernel from https://github.com/LineageOS/android_kernel_samsung_msm8974/ with the KTOONSEZ undervolting control mods from https://github.com/alaskalinuxuser/...mmit/37664e51977ccd27563458526463f53c6be0490a

    The gcc version is a 4.9 I got from this GitHub page:
    https://github.com/Duhjoker/arm-linux-androideabi-4.9

    Intro:
    This kernel allows tweaking CPU voltages. We're interested in undervolting the CPU so it uses less voltage to operate. The extent you can undervolt your CPU is based on luck. While your CPU will run more efficiently with an undervolt, real-world benefits are sometimes hard to tell. For example, your phone may compensate for cooler operation by running at a higher speed more often. Any battery life benefits to undervolting this one part of the phone are ambiguous, it's really hard to test.

    Prerequisites:
    You will need root on your phone! If you don't have root you can get it by installing Magisk. First install Magisk's apk file in Android. Then rename the apk so it has a .zip file extension and leave it in your phone's storage.

    Instructions:
    0. Keep a copy of Magisk's .zip on your phone!
    1. Download the latest *boot.img and place it in your phone's storage
    2. Boot to TWRP recovery or the recovery you use
    3. Tap Install -> Tap "Install Image" to toggle the button
    4. Select boot.img and FLASH TO YOUR BOOT PARTITION
    4a. If you use Magisk it's broken now. Tap "Install Zip" to toggle the button and flash Magisk's zip
    5. Reboot
    6. Install SmartPack Kernel Manager OR Kernel Adiutor and grant it root privileges. You may now tweak your CPU voltage in the app. Once you are happy with your settings use the "Apply on Boot" to make the settings permanent.
    https://f-droid.org/en/packages/com.smartpack.kernelmanager/
    https://f-droid.org/en/packages/com.nhellfire.kerneladiutor/

    Note: The kernel does not persist. You will need to reinstall it after every LOS update.

    (Not) Optional: Consider making a TWRP backup of your phone. Unstable undervolting can result in data loss.

    Help, I'm boot looping/can't boot because of unstable undervolt:
    Download your phone's particular LineageOS zip from https://download.lineageos.org/ and unzip it. Put the boot.img file on your phone and flash it to the BOOT partition in recovery.

    Undervolting guide:
    Not all two phones are the same. Look at your stock voltages or old forum posts for reference. The S5's SoC is the MSM8974PRO/MSM8974AC, marketed as the Snapdragon 801. Also see the binning info at the bottom of this guide to learn your phone's binning.

    Open SmartPack and go to CPU Voltage in the menu. It will display a big list of CPU clock speeds and voltages. These are your stock voltages. Your goal is to lower them some amount without your phone crashing. On the top part of the app you can scroll to "Global Offset" and enter one number to lower all the voltages at once.

    I recommend trying a -30 mV or -40 mV global offset first, it seems like most phones can handle this. After you set your undervolt you should test for stability before making it permanent. Here are some ideas:
    -Use your phone as you normally would.
    -Keep playing videos on your phone
    -Try the stress test in the bottom of this guide

    Do not daily drive your phone for work until you're reasonably sure your undervolt is stable. You don't want it to crash when doing something important.

    Once you have a good global offset you can start tweaking individual CPU states to lower voltages even more. This can get really annoying since there are so many. If you want to fine-tune I recommend only giving special attention to the top speed (2457), the middle speeds (1574 in particular, but include everything up to 1267 if you have to), and the lowest speed (300.)

    The average phone tends to spend the most time in those states so focusing on those will help save your sanity.

    To set your undervolt permanently enable "Apply on Boot" and SmartPack will set the values when your phone starts.

    Spotting an unstable undervolt:
    If one or more CPU states are unstable your phone will suddenly hang, hard reboot, fast reboot or other anomalies. You will probably also see CPU problems in the logs. Do "su; dmesg" in a Terminal or "su;logcat" to see. The cure for a bad undervolt is not undervolting so much. It can be hard to tell which CPU states are unstable unfortunately, you may have to adjust all of them to be sure,

    Tips:
    -Undervolts can be hard to test for stability, so try to leave some overhead if you don't have all day. SmartPack/Kernel Adiutor lets you set a global offset if you only want a small UV!
    -You can set unusually low voltages for 300 MHz. Its stock voltage is about 750-800 mV but it will usually work on 650 mV and go as low as 600 mV if you're lucky.
    -Low freqs are usually better at getting undervolted than the top freqs
    -Not all cores will run at the same freqs/voltages. Disabling most of your cores is a good way to prevent your phone from heating up during stress tests but may lead to instability when you reactivate all of your cores.
    -Your phone's battery draining may spontaneously cause your undervolt to become unstable. Unfortunately you just have to make the UV less aggressive if this happens.
    -Try not switch the governor. To change CPU behavior go to Settings > Battery >Battery Saver and Performance > Performance Profile and toggle the slider as you see fit.

    I recommend using Balanced and switching to Quick when you need your phone to be faster.

    Performance is very energy inefficient. It prevents all cores from parking and tries to peg at least some of them to top speed. One core performance can be better than quick but multi-core makes it very easy for the phone to throttle.

    LOS uses Qualcomm's MPDecision hotplugger. Switching governors causes glitches MPDecision and prevent CPU cores from parking. If you really want to try out governor tweaks, you should disable MPDecision in SmartPack first. Disabling MPDecision will incur a battery life penalty since your CPU will no longer park.

    Synthetic stress test:
    Install Termux and run this one-liner to stress one core:
    Code:
    while true; do openssl speed -evp aes-256-gcm; sleep 15s; done

    For 4 cores:
    Code:
    while true; do openssl speed -multi 4 -evp aes-256-gcm; sleep 15s; done
    You can also use this test to compare performance or to observe thermal throttling. OpenSSL will return a performance score after each run.

    Sample stock/undervolt values from my speed3-pvs9-bin-v1 SM-G900T:
    Stock.png
    Undervolt.png


    Very minor LOS power saving tweaks that don't help very much but they're funny:
    -Search "Backlight" in the settings and turn off the backlight for the Menu and Back keys.
    -The battery/notification LED can be adjusted down to about 7% brightness
    -LOS has several settings for turning off haptic feedback/vibrations. I turned them off for the touch keyboard and the Menu/Back keys.

    SoC Binning Information:
    Your phone's SoC is tested for quality and assigned a PVS number at the factory. For S5, it ranges from PVS0 (low quality) to PVS15 (high quality). Higher quality have lower stock voltages. Check by running these in a terminal:
    Code:
    su
    cat /sys/module/clock_krait_8974/parameters/table_name
    You can compare the bins here
    2
    Here you can find the final version (MEGA). I've never tested this ROM.
    I got this one too
    2
    i founf nemesis v4 but couldn't the v5.5
    Here you can find the final version (MEGA). I've never tested this ROM.
    1
    I don't mind boot loop,I reinstall everything
    You can always fix the boot loop by flashing boot.img from the lineageos zip.

    I compiled build PlaceboKernel05072021V2.img without modified PVS tables in the first post. Still works on my phone.

    I uploaded a V3 as boot.img, I don't know if this makes a difference. Works on my phone.
    1
    But v5.5 has some major bugs. Search the thread and you'll find my and other's bug reports and you'll find v5.

    I forgot: HERE ARE THE LINKS:

    @Nobby1960
    Thanks, but I'll pass...

    @Boatshow
    Sorry for this off-topic spam...