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

[KERNEL][3.18.140+][EOL for now] SwanKernel for the LG V20

Search This thread

AShiningRay

Senior Member
Sep 1, 2021
58
30
Xiaomi Redmi Note 4
LG V20
SwanKernelLogo.png


A custom kernel for (most) V20 variants

SwanKernel is an android kernel based on the latest Lineage OS 18.1 sources for the LG MSM8996 phones, aiming to bring those features and updates and improve them with some extra tuning, fixing and external features tailored specifically for the LG V20's performance characteristics and feature set, while trying to maximize the battery life and responsiveness of the device at the same time.​

This kernel is based on Linux 3.18.140, and has become EOL with the last commit, as i don't think there's anything else that can be optimized for the V20 on this source anymore.

Which phone variants/models does this kernel support?


The kernel currently supports the following variants:
  • H910/H915
  • H918
  • H990
  • LS997
  • US996
  • VS995
Support for other special variants like the US996Santa might come at a later date if needed.


What does this kernel intend to achieve?

The main goal here is to have a kernel that not only has extra features and improvements, but is also clean and concise, having only features that are truly needed from a kernel that will run alongside a Android 11-based ROM. One example of that is Kcal display control, a feature that is unnecessary here since most, if not all Android 11 ROMs have LiveDisplay for that exact same purpose and without the need to root. This helps the kernel have a smaller file size and lower processing overhead, as well as promote better maintainability.

This kernel does have a battery life bias, but will still scale up to maximum performance when needed. No Overclocking is done for now.


Does it have any features over stock?

Yes, a lot. The kernel is divided into two variants, here are the features both variants have over stock:

  1. AdrenoBoost for improved GPU performance.
  2. GPU and CPU/Cache Undervolt for better power efficiency on load.
  3. CPU governors tuned for better battery life and thermal stability without impacting performance all that much.
  4. Almost no unnecessary debug flags on the kernel for better kernel performance.
  5. Westwood TCP Congestion Algorithm set as default in order to have better network performance and consistency.
  6. AutoSMP CPU Hotplug to shutdown the big cores when their stronger performance isn't needed, slightly improving battery life on light loads and idle.
  7. Disabled CPU Boost when a finger is detected on screen, preventing unnecessary frequency boosts when no meaningful action is done other than tapping on screen and slightly scrolling around. We have Schedutil to keep it smooth anyways.
  8. USB Fast Charge.
  9. Multiple cherry-picks from different msm8996 sources with fixes and improvements to the kernel.
  10. Configurable wakelock blocker (boeffla) for roms that have some "unneeded" wakelocks enabled by default and/or users that know which wakelocks can be blocked for better battery life.
  11. Dynamic FSync, giving better IO performance in general and a massive boost to random writes without compromising data integrity by outright disabling FSync.
  12. Anxiety IO Scheduler enabled by default, offering a read bias and lower latency in IO operations.
  13. Kernel updated to Linux 3.18.140 with some extra patches from Googlesource.
  14. Wireguard support, improving VPN performance.
  15. Cryptographic functions optimizations, slightly improving the phone's performance when calculating hashes and so on.

The Extreme variant has some extra features over the Stable one, those being:
  1. Stronger Undervolts (i'm talking about borderline unstable undervolts here, so i really recommend that you flash the Stable one first).
  2. CPU Voltage Control if you need to setup a custom undervolt to keep it more stable and have no need to compile the kernel from source just to change the values... and that's assuming your phone even boots with this variant of the kernel.
  3. Disabled Battery BCL which eliminates the power throttling caused by the battery, just be careful when running demanding tasks while having almost no battery left.


Are there any bugs?

Right now, there's the dreaded Infrared Blaster, and it... kinda works? The IR is able to send the very first command i give to my LG TV without any problems after every reboot, but refuses to send anything else after that first command. The IR Blaster's light still works all the time though despite having some big delays between on/off states.


Download & Installation

The folders containing each kernel variant can be found here:
To install the kernel, it's the standard procedure:
  1. Download the kernel you want for your device
  2. Place it into the phone
  3. Boot into recovery, select it and then flash
  4. Wipe Dalvik Cache (optional, you only need to wipe it if you face random Force Closes, but it is a good practice anyway)
  5. Reboot.
  6. Open any app that can check the device info and look for "kernel", where it will show "... 3.18.xxx-Swan" if it installed correctly. I personally use SmartPack for that, but it requires root.
  7. Enjoy the experience!


Performance and Battery metrics
And now to the kernel's real world performance. But before delving in, keep in mind that my refurbished H910 is apparently a Snapdragon 821 prototype, that's why you will see higher than normal performance and clock values on cpu matters even with the LITTLE cores underclocked to 1785MHz instead of 2188MHz, the snapdragon 820 ones should not have any underclock applied and will reach the max of 1593MHz on them. I also took the liberty of testing those on the Extreme variant as BCL often interferes with the performance results and the extra undervolt doesn't increase performance in any substantial way, 5-7% at most on Geekbench.

Battery life:
Screen SOT test (Youtube looping through a massive playlist of songs with some scrolling to change between them):
Screenshot_20211025-185046214.jpgScreenshot_20211025-193015235.jpg

Not very impressive, until you consider the battery currently powering it:
Screenshot_20211025-185057599.jpg

CPU/GPU Performance:

CPU performance according to Geekbench 5.4.1 (there is some minor variance of about 15-21 points in multithread):
Screenshot_20211025-195919247.jpg

CPU sustained performance on CPU Throttling Test(running it for 15+ minutes barely changes the curve, as it stabilizes at around 80-82 Celsius, i suppose a Snap 820 will fare better here due to the lower clocks):
Screenshot_20211025-194844892.jpg

GPU general performance on GFXBench 5:
Screenshot_20211025-205142387.jpg

No copper shim replacement or thermal pad change was made, the phone's internal structure is still the same from when i bought it.

Storage Performance:

General IO performance in Androbench 5(Not very accurate, but welp, if anyone has a more in-depth one feel free to share):
Screenshot_20211025-205621339.jpg

And there we go, everything i could benchmark so far. This will not be the best kernel on every front so the stock kernel on Lineage 18.1, Lighthouse's kernel or mk2000 might suit you better depending on your needs.

Changelog

*********** Swankernel V1.09 [Last 3.18 version, i think] ***********
  1. Minor performance and power-saving optimizations throughout the kernel
  2. CPU M4M cache undervolting (not really a big difference, but nice to have anyway).
  3. A few cherry-picked fixes for the 3.18 msm8996 kernel tree.
  4. Crypto function optimizations and HW acceleration for CRC32 Enabled.
  5. Not actually a kernel change but: Can now be flashed on android versions lower than 11.

*********** Swankernel V1.08 ***********
  1. Small performance optimizations related to the voltage curves, especially in the GPU.
  2. PC USB Charging has been fixed and the phone can now be charged over it again.

*********** Swankernel V1.06 ***********
  1. Upstreamed kernel to 3.18.140 + some extra patches, with more coming later.​
  2. Added Wireguard support for better VPN performance compared to IPSec.​
  3. Smaller fixes to the kernel zip files, improving compatibility with some models.​
  4. Minor performance optimizations, shouldn't be noticeable to the end user.​
  5. Now stable enough (at least the Stable version is) to be used as a daily driver.​

*********** Swankernel V1.00 ***********
Initial release. Has the features from 1 to 12 on both versions, and from 1 to 3 on the Extreme version.​

Closing notes

With V1.09, the kernel can now be flashed on basically any android version and should work out-of-the-box, although i didn't test it on stock roms at all and there are no reports of it working there, so it might not work on them.

From what i could gather during the multiple Pre-Beta tests, the battery life improved considerably over the kernel shipped by default with Lighthouse V20 and even more when compared to Lineage's stock kernel.

If you have any suggestion or idea that can possibly improve the kernel, do not hesitate to share, i will try to implement it when my time allows it. If there are any problems that only happen on this kernel, submit a log and i'll try to look at it.

The kernel's source code can be found here.

And last but not least, a special thanks for those that helped me even if indirectly:

 
Last edited:

AShiningRay

Senior Member
Sep 1, 2021
58
30
Xiaomi Redmi Note 4
LG V20
The ir is most likely consumer ir related so, we'll have to tweak it until it starts working
I was discussing the same thing with @askermk2000 a while ago and that seems to be the case, as not even gamma kernel had a working IR on the branch he tested, and neither the IR files or the git log of it shows any relevant difference on the IR when compared to Lineage's sources. I will keep the disclaimer about it for now because it makes things clearer as there is some confusion about the IR being a kernel problem, so the less convoluted it is to the user for the time being, the better.

Edit: Also, if you need any logs about the infrared while testing it, i can help (i even have some older ones describing the behaviour). Just hit me up when needed since my device will be mostly used as a development phone for the time being.
 
Last edited:

xxseva44

Senior Member
I was discussing the same thing with @askermk2000 a while ago and that seems to be the case, as not even gamma kernel had a working IR on the branch he tested, and neither the IR files or the git log of it shows any relevant difference on the IR when compared to Lineage's sources. I will keep the disclaimer about it for now because it makes things clearer as there is some confusion about the IR being a kernel problem, so the less convoluted it is to the user for the time being, the better.

Edit: Also, if you need any logs about the infrared while testing it, i can help (i even have some older ones describing the behaviour). Just hit me up when needed since my device will be mostly used as a development phone for the time being.
It's more likely an issue with the implementation of the ir drivers not playing well with consumerIR or vise versa. Atm ir only works on the older versions of gamma as they weren't upstreamed like los 18
 

AShiningRay

Senior Member
Sep 1, 2021
58
30
Xiaomi Redmi Note 4
LG V20
Hello when I try to flash Swan-H918-Stable.zip on an h918 I get "Unsupported device. Aborting..."
Huh... that's strange. I must have messed something up during the anykernel zipping procedure on that model. I'm almost pushing an update to the kernel, so i'll be back in a while with a fix for that.

Edit: Yeah, it was something in the script file, i forgot to change the H910 to H918 on that specific variant flashable. Sorry for that.
I just pushed the file with the fixed script for all the models i checked. If you could test that, i would appreciate it.
 
Last edited:

Aethera

Senior Member
Feb 18, 2012
209
45
Bay Area
Huh... that's strange. I must have messed something up during the anykernel zipping procedure on that model. I'm almost pushing an update to the kernel, so i'll be back in a while with a fix for that.

Edit: Yeah, it was something in the script file, i forgot to change the H910 to H918 on that specific variant flashable. Sorry for that.
I just pushed the file with the fixed script for all the models i checked. If you could test that, i would appreciate it.
Just successfully flashed the new Swan-H918-Stable.zip thank you!

Code:
$ uname -a
Linux localhost 3.18.113-Swan-g24ffa95cf1b3-dirty #1 SMP PREEMPT Wed Oct 20 00:18:37 -03 2021 aarch64
 

Aethera

Senior Member
Feb 18, 2012
209
45
Bay Area
Here is some output from 'logcat *:E' in case it is of interest:

10-31 16:19:38.753 5926 5926 E ActivityThread: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
10-31 16:19:40.586 905 937 E ANDR-PERF-MPCTL: Invalid profile no. 0, total profiles 0 only
10-31 16:19:41.778 959 1031 E QC-time-services: Lib:time_genoff_operation: Connection failed !!
10-31 16:19:41.783 959 1031 E QC-time-services: Lib:time_genoff_operation: Connection failed !!
10-31 16:19:42.002 10005 10005 E receiver.modul: Not starting debugger since process cannot load the jdwp agent.
10-31 16:19:42.143 455 455 E lowmemorykiller: Error writing /proc/7941/oom_score_adj; errno=22
10-31 16:19:43.218 10025 10025 E hbox:interacto: Not starting debugger since process cannot load the jdwp agent.
10-31 16:19:44.391 455 455 E lowmemorykiller: Error writing /proc/9412/oom_score_adj; errno=22
10-31 16:19:44.658 1144 1217 E KernelCpuSpeedReader: Failed to read cpu-freq: /sys/devices/system/cpu/cpu2/cpufreq/stats/time_in_state: open failed: ENOENT (No such file or directory)
10-31 16:19:44.675 1144 1214 E libprocessgroup: Error encountered killing process cgroup uid 99005 pid 9572: Permission denied
10-31 16:19:46.683 1144 1550 E LightsService: Light requested not available on this device. 2
10-31 16:19:47.629 0 0 E variable_rate_pll_clk_enable_hwfsm: PLL pwrcl_pll didn't lock after enabling it!
10-31 16:19:51.008 1144 4213 E WifiService: Permission violation - getScanResults not allowed for uid=10086, packageName=com.google.android.gms, reason=java.lang.SecurityException: Location mode is disabled for the device
10-31 16:19:56.216 0 0 E vote : name[BATTCHG_SUSPEND], client[BATTCHG_UNKNOWN_BATTERY_EN_VOTER,0], enabled[0], val[0]
10-31 16:19:56.216 0 0 E SMBCHG : smbchg_config_chg_battery_type: BATTERY FULL NAME : LGE_BL44E1F_LGC_3200mAh
10-31 16:20:09.541 0 0 E : LGE charging scenario : state 0 -> 0(0-0), temp=292, volt=4404, fl_volt=4400 BTM=0, charger=1, cur_set=1000/0, chg_cur = -481
10-31 16:20:09.541 0 0 E [LGE-CC] lge_monitor_batt_temp_work: (work_queue)->(work_queue)
10-31 16:20:09.541 0 0 E vote : name[BATT_FCC], client[LGE_POWER_CLASS_FCC_VOTER,1], enabled[1], val[1000]
10-31 16:20:09.541 0 0 E vote : name[BATTCHG_SUSPEND], client[LGCC_EN_VOTER,1], enabled[0], val[0]
10-31 16:20:09.541 0 0 E vote : name[BATTCHG_SUSPEND], client[STORE_MODE_EN_VOTER,2], enabled[0], val[0]
10-31 16:20:09.541 0 0 E vote : name[USB_SUSPEND], client[STORE_MODE_USB_EN_VOTER,2], enabled[0], val[0]
10-31 16:20:29.221 0 0 E variable_rate_pll_clk_enable_hwfsm: PLL pwrcl_pll didn't lock after enabling it!


Here is some more:

10-31 16:21:38.622 10126 10148 E libEGL : Driver indicates EGL 1.5 support, but does not have a critical API
10-31 16:21:38.739 905 937 E ANDR-PERF-RESOURCEQS: Failed to reset optimization [2, 1]
10-31 16:21:38.740 905 937 E ANDR-PERF-RESOURCEQS: Failed to reset optimization [2, 1]
10-31 16:21:43.557 905 937 E ANDR-PERF-MPCTL: Invalid profile no. 0, total profiles 0 only
10-31 16:21:43.558 905 937 E ANDR-PERF-RESOURCEQS: Failed to apply optimization [2, 2, 0]
10-31 16:22:09.540 0 0 E : LGE charging scenario : state 0 -> 0(0-0), temp=292, volt=4408, fl_volt=4400 BTM=0, charger=1, cur_set=1000/0, chg_cur = -358
10-31 16:22:09.541 0 0 E [LGE-CC] lge_monitor_batt_temp_work: (work_queue)->(work_queue)
10-31 16:22:22.518 0 0 E vote : name[BATTCHG_SUSPEND], client[BATTCHG_UNKNOWN_BATTERY_EN_VOTER,0], enabled[0], val[0]
10-31 16:22:22.518 0 0 E SMBCHG : smbchg_config_chg_battery_type: BATTERY FULL NAME : LGE_BL44E1F_LGC_3200mAh
10-31 16:22:37.783 0 0 E rmt_storage: INFO:rmt_storage_rw_iovec_cb: Write iovec request received for /boot/modem_fs1
10-31 16:22:37.783 0 0 E rmt_storage: INFO:rmt_storage_client_thread: Calling Write [offset=0, size=2097152]for /boot/modem_fs1!
10-31 16:22:37.814 0 0 E rmt_storage: INFO:rmt_storage_client_thread: Done Write (bytes = 2097152) for /boot/modem_fs1!
10-31 16:23:00.530 0 0 E variable_rate_pll_clk_enable_hwfsm: PLL pwrcl_pll didn't lock after enabling it!
10-31 16:23:09.540 0 0 E : LGE charging scenario : state 0 -> 0(0-0), temp=292, volt=4408, fl_volt=4400 BTM=0, charger=1, cur_set=1000/0, chg_cur = -324
10-31 16:23:09.540 0 0 E [LGE-CC] lge_monitor_batt_temp_work: (work_queue)->(work_queue)
 

AShiningRay

Senior Member
Sep 1, 2021
58
30
Xiaomi Redmi Note 4
LG V20
Here is some output from 'logcat *:E' in case it is of interest:

10-31 16:19:38.753 5926 5926 E ActivityThread: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
10-31 16:19:40.586 905 937 E ANDR-PERF-MPCTL: Invalid profile no. 0, total profiles 0 only
10-31 16:19:41.778 959 1031 E QC-time-services: Lib:time_genoff_operation: Connection failed !!
10-31 16:19:41.783 959 1031 E QC-time-services: Lib:time_genoff_operation: Connection failed !!
10-31 16:19:42.002 10005 10005 E receiver.modul: Not starting debugger since process cannot load the jdwp agent.
10-31 16:19:42.143 455 455 E lowmemorykiller: Error writing /proc/7941/oom_score_adj; errno=22
10-31 16:19:43.218 10025 10025 E hbox:interacto: Not starting debugger since process cannot load the jdwp agent.
10-31 16:19:44.391 455 455 E lowmemorykiller: Error writing /proc/9412/oom_score_adj; errno=22
10-31 16:19:44.658 1144 1217 E KernelCpuSpeedReader: Failed to read cpu-freq: /sys/devices/system/cpu/cpu2/cpufreq/stats/time_in_state: open failed: ENOENT (No such file or directory)
10-31 16:19:44.675 1144 1214 E libprocessgroup: Error encountered killing process cgroup uid 99005 pid 9572: Permission denied
10-31 16:19:46.683 1144 1550 E LightsService: Light requested not available on this device. 2
10-31 16:19:47.629 0 0 E variable_rate_pll_clk_enable_hwfsm: PLL pwrcl_pll didn't lock after enabling it!
10-31 16:19:51.008 1144 4213 E WifiService: Permission violation - getScanResults not allowed for uid=10086, packageName=com.google.android.gms, reason=java.lang.SecurityException: Location mode is disabled for the device
10-31 16:19:56.216 0 0 E vote : name[BATTCHG_SUSPEND], client[BATTCHG_UNKNOWN_BATTERY_EN_VOTER,0], enabled[0], val[0]
10-31 16:19:56.216 0 0 E SMBCHG : smbchg_config_chg_battery_type: BATTERY FULL NAME : LGE_BL44E1F_LGC_3200mAh
10-31 16:20:09.541 0 0 E : LGE charging scenario : state 0 -> 0(0-0), temp=292, volt=4404, fl_volt=4400 BTM=0, charger=1, cur_set=1000/0, chg_cur = -481
10-31 16:20:09.541 0 0 E [LGE-CC] lge_monitor_batt_temp_work: (work_queue)->(work_queue)
10-31 16:20:09.541 0 0 E vote : name[BATT_FCC], client[LGE_POWER_CLASS_FCC_VOTER,1], enabled[1], val[1000]
10-31 16:20:09.541 0 0 E vote : name[BATTCHG_SUSPEND], client[LGCC_EN_VOTER,1], enabled[0], val[0]
10-31 16:20:09.541 0 0 E vote : name[BATTCHG_SUSPEND], client[STORE_MODE_EN_VOTER,2], enabled[0], val[0]
10-31 16:20:09.541 0 0 E vote : name[USB_SUSPEND], client[STORE_MODE_USB_EN_VOTER,2], enabled[0], val[0]
10-31 16:20:29.221 0 0 E variable_rate_pll_clk_enable_hwfsm: PLL pwrcl_pll didn't lock after enabling it!


Here is some more:

10-31 16:21:38.622 10126 10148 E libEGL : Driver indicates EGL 1.5 support, but does not have a critical API
10-31 16:21:38.739 905 937 E ANDR-PERF-RESOURCEQS: Failed to reset optimization [2, 1]
10-31 16:21:38.740 905 937 E ANDR-PERF-RESOURCEQS: Failed to reset optimization [2, 1]
10-31 16:21:43.557 905 937 E ANDR-PERF-MPCTL: Invalid profile no. 0, total profiles 0 only
10-31 16:21:43.558 905 937 E ANDR-PERF-RESOURCEQS: Failed to apply optimization [2, 2, 0]
10-31 16:22:09.540 0 0 E : LGE charging scenario : state 0 -> 0(0-0), temp=292, volt=4408, fl_volt=4400 BTM=0, charger=1, cur_set=1000/0, chg_cur = -358
10-31 16:22:09.541 0 0 E [LGE-CC] lge_monitor_batt_temp_work: (work_queue)->(work_queue)
10-31 16:22:22.518 0 0 E vote : name[BATTCHG_SUSPEND], client[BATTCHG_UNKNOWN_BATTERY_EN_VOTER,0], enabled[0], val[0]
10-31 16:22:22.518 0 0 E SMBCHG : smbchg_config_chg_battery_type: BATTERY FULL NAME : LGE_BL44E1F_LGC_3200mAh
10-31 16:22:37.783 0 0 E rmt_storage: INFO:rmt_storage_rw_iovec_cb: Write iovec request received for /boot/modem_fs1
10-31 16:22:37.783 0 0 E rmt_storage: INFO:rmt_storage_client_thread: Calling Write [offset=0, size=2097152]for /boot/modem_fs1!
10-31 16:22:37.814 0 0 E rmt_storage: INFO:rmt_storage_client_thread: Done Write (bytes = 2097152) for /boot/modem_fs1!
10-31 16:23:00.530 0 0 E variable_rate_pll_clk_enable_hwfsm: PLL pwrcl_pll didn't lock after enabling it!
10-31 16:23:09.540 0 0 E : LGE charging scenario : state 0 -> 0(0-0), temp=292, volt=4408, fl_volt=4400 BTM=0, charger=1, cur_set=1000/0, chg_cur = -324
10-31 16:23:09.540 0 0 E [LGE-CC] lge_monitor_batt_temp_work: (work_queue)->(work_queue)
Some of those errors are due to the massive amount of debug flags i disabled in the kernel (it still tries to load many of them up for some reason). Are you facing any bugs on the device so far? My H910 also prints many "errors" similar to these but it works just as fine as when it used Lineage's stock kernel, but i didn't test other variants so i don't know if this kernel works fine on them as well.
 

Aethera

Senior Member
Feb 18, 2012
209
45
Bay Area
Some of those errors are due to the massive amount of debug flags i disabled in the kernel (it still tries to load many of them up for some reason). Are you facing any bugs on the device so far? My H910 also prints many "errors" similar to these but it works just as fine as when it used Lineage's stock kernel, but i didn't test other variants so i don't know if this kernel works fine on them as well.
One thing I'm noticing is that the adb USB connection keeps breaking. I run 'adb shell' and it connects then after a few seconds disconnects. It never did this before.

EDIT: Now it stopped doing it. For a while it kept disconnecting but now it is staying connected.
 
Last edited:

AShiningRay

Senior Member
Sep 1, 2021
58
30
Xiaomi Redmi Note 4
LG V20
One thing I'm noticing is that the adb USB connection keeps breaking.
That's weird, some time ago when i started taking logs to debug the IR i managed keep running the adb logcat for quite a while with no problems whatsoever. Is there a certain amount of time that it takes to happen?

Edit: Oh, ok then. Might have been some random issue with adb's connection. If any other problem arises, do tell.
 
Last edited:

Aethera

Senior Member
Feb 18, 2012
209
45
Bay Area
Unfortunately the phone is still crashing at random intervals (was happening before using this kernel).

10-31 19:17:56.642 0 0 E : Fatal error on the modem.
10-31 19:17:56.642 0 0 E : modem subsystem failure reason: sleep_target.c:305:.
10-31 19:17:56.647 0 0 E M-Notify: General: 8
 

AShiningRay

Senior Member
Sep 1, 2021
58
30
Xiaomi Redmi Note 4
LG V20
Unfortunately the phone is still crashing at random intervals (was happening before using this kernel).

10-31 19:17:56.642 0 0 E : Fatal error on the modem.
10-31 19:17:56.642 0 0 E : modem subsystem failure reason: sleep_target.c:305:.
10-31 19:17:56.647 0 0 E M-Notify: General: 8
I see.. well, i tried searching this sleep_target.c that seems to be related in some manner to the problem in the kernel directory but there is no file with such a name. It could be something ROM-related, but i can't rule that out yet. Are there any other logs with more info about it?
 

Aethera

Senior Member
Feb 18, 2012
209
45
Bay Area
I see.. well, i tried searching this sleep_target.c that seems to be related in some manner to the problem in the kernel directory but there is no file with such a name. It could be something ROM-related, but i can't rule that out yet. Are there any other logs with more info about it?
I will try to do some various types of log filtering over the next day or so to see if I can get more information.
 

Aethera

Senior Member
Feb 18, 2012
209
45
Bay Area
I see.. well, i tried searching this sleep_target.c that seems to be related in some manner to the problem in the kernel directory but there is no file with such a name. It could be something ROM-related, but i can't rule that out yet. Are there any other logs with more info about it?
Looks like most if not all info about sleep_target.c is in Chinese. For example:
https://cloud-tencent-com.translate...auto&_x_tr_tl=en&_x_tr_hl=en-US&_x_tr_pto=nui

This one appears to have more detail: https://www-cnblogs-com.translate.g...auto&_x_tr_tl=en&_x_tr_hl=en-US&_x_tr_pto=nui
 
Last edited:

AShiningRay

Senior Member
Sep 1, 2021
58
30
Xiaomi Redmi Note 4
LG V20
Yeah, and the problem is... none of the files the article talks about are present in the kernel's source. tlmm_bsp for example also returns no results here. The fact that you log referenced a specific line from the file means it actually is present somewhere, but i'm not able to ascertain where exactly it is. I'll have to look at it in more details later.
 

Aethera

Senior Member
Feb 18, 2012
209
45
Bay Area
Yeah, and the problem is... none of the files the article talks about are present in the kernel's source. tlmm_bsp for example also returns no results here. The fact that you log referenced a specific line from the file means it actually is present somewhere, but i'm not able to ascertain where exactly it is. I'll have to look at it in more details later.
It is related to the Qualcomm MSM8996 system-on-chip. Perhaps it is embedded in the firmware. It appears there's some way to enable a debug mode for the modem and access various flags and voltage levels. This would explain why the error seems to be power-related. The device is trying to throttle the voltage to a "bottom current" which is a minimal current when the device is sleeping and for whatever reason it's crashing.

FYI here is a tool which can extract a MSM8996 modem image.
 
Last edited:

AShiningRay

Senior Member
Sep 1, 2021
58
30
Xiaomi Redmi Note 4
LG V20
It is related to the Qualcomm MSM8996 system-on-chip. Perhaps it is embedded in the firmware. It appears there's some way to enable a debug mode for the modem and access various flags and voltage levels. This would explain why the error seems to be power-related. The device is trying to throttle the voltage to a "bottom current" which is a minimal current when the device is sleeping and for whatever reason it's crashing.

FYI here is a tool which can extract a MSM8996 modem image.
Ok, so it means that those files might actually be located inside the modem partition? I can see how a improper voltage can lead to kernel crashes (Undervolting the SoC's Kryo cores themselves too hard does the same thing, crashing the phone into either a black screen or a green one with some tracing info about the files that caused the problem), but how do we even go about testing if the modem is the one causing the problem? I'm not familiar with the modem images and structures at all so i doubt i would be able to fix those things, especially the voltages since we probably have no voltage table to determine which voltages are acceptable, too high, or too low.
 
  • Like
Reactions: Aethera

Top Liked Posts

  • There are no posts matching your filters.
  • 2
    Hello when I try to flash Swan-H918-Stable.zip on an h918 I get "Unsupported device. Aborting..."
    Huh... that's strange. I must have messed something up during the anykernel zipping procedure on that model. I'm almost pushing an update to the kernel, so i'll be back in a while with a fix for that.

    Edit: Yeah, it was something in the script file, i forgot to change the H910 to H918 on that specific variant flashable. Sorry for that.
    I just pushed the file with the fixed script for all the models i checked. If you could test that, i would appreciate it.
    2
    Alright, with the recently released V1.09 i now deem this kernel EOL, or at least, its 3.18 version since i will now be focusing on porting 4.4 to the LG MSM8996 family of devices alongside @askermk2000, since that tree is still being actively developed by linux-stable and also contains a slew of general improvements to both security and performance over the current 3.18 source that i don't think can be further optimized or fixed. The IR is still in need of fixing, but at this point i think starting fresh from a clean source might prove more beneficial to solve it than looking around the entire kernel source again. But if any issues with that new release crop up, do tell me and i will try to provide support.
    2
    Wow this Kernel is amazing! Thermals improved massively and the V20 runs much faster and smoother now. I'm able to do things that were impossible before like browse the web while watching Youtube. Duck Duck Go used to stutter when clearing my data, now it does it smoothly.

    Everything is faster while somehow the phone runs much colder. I still need to test my GCam and if I can take a few photos without crashing.

    I'm using the H990DS with Lineage 18.1. During the throttle 1 core stayed at 70C while others were around 60-65C (I'm using a thermal pad).

    wMdy5DJ5brSFPd05n_mBKCwOhYVDJR6Vjzx0jZqG2CjSu49-ox1wbRIeKsg2K6bgNJtjgt6Wr5Vyz8wSr7gAFIMd4jDQeu067ZUeTe5swd1rRFwx0s6es5YfIWKimlNZLKGTHYdigwLbnzYgtBaOhIPXXQz1wrG0BCuzCI4mjY7A-4WaV3ek5ypESqSq_2JuSOVVNcul0m0d9VnlLB2tnlsBxuyhm5ZDiMi6L2BtMxJHtlFiCnCYLESRdCtuC-0zm5IZ6TgljsIbKyRNWpn7H8y_aGrq7AZ2z_G65lsKzAUuMVAFdCcmcOvBJ4QUL8Zzj_c_Vk7Ts1WPptem2Htmmyrp8AZ33cnis4tchiloGvkmbw5BLNY6GOzWuegjkM-hUFtGVwBs2O0lDD9JVQZSrP7xjedS8sAdYiVETEdVzKouF0d8lutIp7epGRFjWGD1jaTtd9-l3P9vVxYo_FJ5KRtJ-tlx-2FNGt1nj8OFQddH6vUBFxza_tZDV5SrJvcUDtcRe52ZWgUF2BQ8u5fZIh7ErO1da0f1kXv0s4-LlAyaZ6YXx0rIJZrEMEwTS7WwCOsnErw2ec_Hz6mxPK4jO4OPPee_m1LS1EQKN5A1-OLaf1JwqUrNMSU98IgAcF-AVSF7kY-Am7z8U_BJWAYxtc8yyFA42GQFRTMhIncu8KaShmOzBX_lazgHyjwJU477CYu_ES9uX6DCEQwT4jcklOcneQ=w497-h937-no

    I bought a V60 as a replacement but now I don't even need it anymore, it's a shame I can't refund it now. Amazing job and thanks for all the devs keeping this phone alive. Might try Lighthouse later but I'm lazy to back up all my data for migration.
    Thanks! Happy to know the kernel is being useful to others as well. And a bit of a spoiler (xxseva already hinted at it in a few places, lol), but there's definitely a lot more coming for the V20, G5 and G6, although i can't share many details about it nor a ETA of when it will arrive. But if/when it arrives, you can expect Android 12 with a kernel that's essentially the best parts of Swan and mk2000 mashed together.
    1
    It is related to the Qualcomm MSM8996 system-on-chip. Perhaps it is embedded in the firmware. It appears there's some way to enable a debug mode for the modem and access various flags and voltage levels. This would explain why the error seems to be power-related. The device is trying to throttle the voltage to a "bottom current" which is a minimal current when the device is sleeping and for whatever reason it's crashing.

    FYI here is a tool which can extract a MSM8996 modem image.
    Ok, so it means that those files might actually be located inside the modem partition? I can see how a improper voltage can lead to kernel crashes (Undervolting the SoC's Kryo cores themselves too hard does the same thing, crashing the phone into either a black screen or a green one with some tracing info about the files that caused the problem), but how do we even go about testing if the modem is the one causing the problem? I'm not familiar with the modem images and structures at all so i doubt i would be able to fix those things, especially the voltages since we probably have no voltage table to determine which voltages are acceptable, too high, or too low.
    1
    I used Cherish H910 to install my vs995, I tried flashing Swan-H910-H915-Stable.zip and it still failed to install.
    Swan-VS995-Stable.zip both October 25th and October 31st failed to install
    Thankfully the H910-H915 version didn't get flashed, or else you would have probably be stuck in a bootloop. Since you have a VS995, i will get a zip without device checks and host it for you to download. If it flashes and no bugs or glitches happen afterwards, your phone is just using a different model string according to your recovery. I'll be back shortly.

    Edit 2: Problem should be fixed on newer kernel zips.
  • 7
    SwanKernelLogo.png


    A custom kernel for (most) V20 variants

    SwanKernel is an android kernel based on the latest Lineage OS 18.1 sources for the LG MSM8996 phones, aiming to bring those features and updates and improve them with some extra tuning, fixing and external features tailored specifically for the LG V20's performance characteristics and feature set, while trying to maximize the battery life and responsiveness of the device at the same time.​

    This kernel is based on Linux 3.18.140, and has become EOL with the last commit, as i don't think there's anything else that can be optimized for the V20 on this source anymore.

    Which phone variants/models does this kernel support?


    The kernel currently supports the following variants:
    • H910/H915
    • H918
    • H990
    • LS997
    • US996
    • VS995
    Support for other special variants like the US996Santa might come at a later date if needed.


    What does this kernel intend to achieve?

    The main goal here is to have a kernel that not only has extra features and improvements, but is also clean and concise, having only features that are truly needed from a kernel that will run alongside a Android 11-based ROM. One example of that is Kcal display control, a feature that is unnecessary here since most, if not all Android 11 ROMs have LiveDisplay for that exact same purpose and without the need to root. This helps the kernel have a smaller file size and lower processing overhead, as well as promote better maintainability.

    This kernel does have a battery life bias, but will still scale up to maximum performance when needed. No Overclocking is done for now.


    Does it have any features over stock?

    Yes, a lot. The kernel is divided into two variants, here are the features both variants have over stock:

    1. AdrenoBoost for improved GPU performance.
    2. GPU and CPU/Cache Undervolt for better power efficiency on load.
    3. CPU governors tuned for better battery life and thermal stability without impacting performance all that much.
    4. Almost no unnecessary debug flags on the kernel for better kernel performance.
    5. Westwood TCP Congestion Algorithm set as default in order to have better network performance and consistency.
    6. AutoSMP CPU Hotplug to shutdown the big cores when their stronger performance isn't needed, slightly improving battery life on light loads and idle.
    7. Disabled CPU Boost when a finger is detected on screen, preventing unnecessary frequency boosts when no meaningful action is done other than tapping on screen and slightly scrolling around. We have Schedutil to keep it smooth anyways.
    8. USB Fast Charge.
    9. Multiple cherry-picks from different msm8996 sources with fixes and improvements to the kernel.
    10. Configurable wakelock blocker (boeffla) for roms that have some "unneeded" wakelocks enabled by default and/or users that know which wakelocks can be blocked for better battery life.
    11. Dynamic FSync, giving better IO performance in general and a massive boost to random writes without compromising data integrity by outright disabling FSync.
    12. Anxiety IO Scheduler enabled by default, offering a read bias and lower latency in IO operations.
    13. Kernel updated to Linux 3.18.140 with some extra patches from Googlesource.
    14. Wireguard support, improving VPN performance.
    15. Cryptographic functions optimizations, slightly improving the phone's performance when calculating hashes and so on.

    The Extreme variant has some extra features over the Stable one, those being:
    1. Stronger Undervolts (i'm talking about borderline unstable undervolts here, so i really recommend that you flash the Stable one first).
    2. CPU Voltage Control if you need to setup a custom undervolt to keep it more stable and have no need to compile the kernel from source just to change the values... and that's assuming your phone even boots with this variant of the kernel.
    3. Disabled Battery BCL which eliminates the power throttling caused by the battery, just be careful when running demanding tasks while having almost no battery left.


    Are there any bugs?

    Right now, there's the dreaded Infrared Blaster, and it... kinda works? The IR is able to send the very first command i give to my LG TV without any problems after every reboot, but refuses to send anything else after that first command. The IR Blaster's light still works all the time though despite having some big delays between on/off states.


    Download & Installation

    The folders containing each kernel variant can be found here:
    To install the kernel, it's the standard procedure:
    1. Download the kernel you want for your device
    2. Place it into the phone
    3. Boot into recovery, select it and then flash
    4. Wipe Dalvik Cache (optional, you only need to wipe it if you face random Force Closes, but it is a good practice anyway)
    5. Reboot.
    6. Open any app that can check the device info and look for "kernel", where it will show "... 3.18.xxx-Swan" if it installed correctly. I personally use SmartPack for that, but it requires root.
    7. Enjoy the experience!


    Performance and Battery metrics
    And now to the kernel's real world performance. But before delving in, keep in mind that my refurbished H910 is apparently a Snapdragon 821 prototype, that's why you will see higher than normal performance and clock values on cpu matters even with the LITTLE cores underclocked to 1785MHz instead of 2188MHz, the snapdragon 820 ones should not have any underclock applied and will reach the max of 1593MHz on them. I also took the liberty of testing those on the Extreme variant as BCL often interferes with the performance results and the extra undervolt doesn't increase performance in any substantial way, 5-7% at most on Geekbench.

    Battery life:
    Screen SOT test (Youtube looping through a massive playlist of songs with some scrolling to change between them):
    Screenshot_20211025-185046214.jpgScreenshot_20211025-193015235.jpg

    Not very impressive, until you consider the battery currently powering it:
    Screenshot_20211025-185057599.jpg

    CPU/GPU Performance:

    CPU performance according to Geekbench 5.4.1 (there is some minor variance of about 15-21 points in multithread):
    Screenshot_20211025-195919247.jpg

    CPU sustained performance on CPU Throttling Test(running it for 15+ minutes barely changes the curve, as it stabilizes at around 80-82 Celsius, i suppose a Snap 820 will fare better here due to the lower clocks):
    Screenshot_20211025-194844892.jpg

    GPU general performance on GFXBench 5:
    Screenshot_20211025-205142387.jpg

    No copper shim replacement or thermal pad change was made, the phone's internal structure is still the same from when i bought it.

    Storage Performance:

    General IO performance in Androbench 5(Not very accurate, but welp, if anyone has a more in-depth one feel free to share):
    Screenshot_20211025-205621339.jpg

    And there we go, everything i could benchmark so far. This will not be the best kernel on every front so the stock kernel on Lineage 18.1, Lighthouse's kernel or mk2000 might suit you better depending on your needs.

    Changelog

    *********** Swankernel V1.09 [Last 3.18 version, i think] ***********
    1. Minor performance and power-saving optimizations throughout the kernel
    2. CPU M4M cache undervolting (not really a big difference, but nice to have anyway).
    3. A few cherry-picked fixes for the 3.18 msm8996 kernel tree.
    4. Crypto function optimizations and HW acceleration for CRC32 Enabled.
    5. Not actually a kernel change but: Can now be flashed on android versions lower than 11.

    *********** Swankernel V1.08 ***********
    1. Small performance optimizations related to the voltage curves, especially in the GPU.
    2. PC USB Charging has been fixed and the phone can now be charged over it again.

    *********** Swankernel V1.06 ***********
    1. Upstreamed kernel to 3.18.140 + some extra patches, with more coming later.​
    2. Added Wireguard support for better VPN performance compared to IPSec.​
    3. Smaller fixes to the kernel zip files, improving compatibility with some models.​
    4. Minor performance optimizations, shouldn't be noticeable to the end user.​
    5. Now stable enough (at least the Stable version is) to be used as a daily driver.​

    *********** Swankernel V1.00 ***********
    Initial release. Has the features from 1 to 12 on both versions, and from 1 to 3 on the Extreme version.​

    Closing notes

    With V1.09, the kernel can now be flashed on basically any android version and should work out-of-the-box, although i didn't test it on stock roms at all and there are no reports of it working there, so it might not work on them.

    From what i could gather during the multiple Pre-Beta tests, the battery life improved considerably over the kernel shipped by default with Lighthouse V20 and even more when compared to Lineage's stock kernel.

    If you have any suggestion or idea that can possibly improve the kernel, do not hesitate to share, i will try to implement it when my time allows it. If there are any problems that only happen on this kernel, submit a log and i'll try to look at it.

    The kernel's source code can be found here.

    And last but not least, a special thanks for those that helped me even if indirectly:

    2
    The ir is most likely consumer ir related so, we'll have to tweak it until it starts working
    2
    Hello when I try to flash Swan-H918-Stable.zip on an h918 I get "Unsupported device. Aborting..."
    Huh... that's strange. I must have messed something up during the anykernel zipping procedure on that model. I'm almost pushing an update to the kernel, so i'll be back in a while with a fix for that.

    Edit: Yeah, it was something in the script file, i forgot to change the H910 to H918 on that specific variant flashable. Sorry for that.
    I just pushed the file with the fixed script for all the models i checked. If you could test that, i would appreciate it.
    2
    Alright, with the recently released V1.09 i now deem this kernel EOL, or at least, its 3.18 version since i will now be focusing on porting 4.4 to the LG MSM8996 family of devices alongside @askermk2000, since that tree is still being actively developed by linux-stable and also contains a slew of general improvements to both security and performance over the current 3.18 source that i don't think can be further optimized or fixed. The IR is still in need of fixing, but at this point i think starting fresh from a clean source might prove more beneficial to solve it than looking around the entire kernel source again. But if any issues with that new release crop up, do tell me and i will try to provide support.
    2
    Wow this Kernel is amazing! Thermals improved massively and the V20 runs much faster and smoother now. I'm able to do things that were impossible before like browse the web while watching Youtube. Duck Duck Go used to stutter when clearing my data, now it does it smoothly.

    Everything is faster while somehow the phone runs much colder. I still need to test my GCam and if I can take a few photos without crashing.

    I'm using the H990DS with Lineage 18.1. During the throttle 1 core stayed at 70C while others were around 60-65C (I'm using a thermal pad).

    wMdy5DJ5brSFPd05n_mBKCwOhYVDJR6Vjzx0jZqG2CjSu49-ox1wbRIeKsg2K6bgNJtjgt6Wr5Vyz8wSr7gAFIMd4jDQeu067ZUeTe5swd1rRFwx0s6es5YfIWKimlNZLKGTHYdigwLbnzYgtBaOhIPXXQz1wrG0BCuzCI4mjY7A-4WaV3ek5ypESqSq_2JuSOVVNcul0m0d9VnlLB2tnlsBxuyhm5ZDiMi6L2BtMxJHtlFiCnCYLESRdCtuC-0zm5IZ6TgljsIbKyRNWpn7H8y_aGrq7AZ2z_G65lsKzAUuMVAFdCcmcOvBJ4QUL8Zzj_c_Vk7Ts1WPptem2Htmmyrp8AZ33cnis4tchiloGvkmbw5BLNY6GOzWuegjkM-hUFtGVwBs2O0lDD9JVQZSrP7xjedS8sAdYiVETEdVzKouF0d8lutIp7epGRFjWGD1jaTtd9-l3P9vVxYo_FJ5KRtJ-tlx-2FNGt1nj8OFQddH6vUBFxza_tZDV5SrJvcUDtcRe52ZWgUF2BQ8u5fZIh7ErO1da0f1kXv0s4-LlAyaZ6YXx0rIJZrEMEwTS7WwCOsnErw2ec_Hz6mxPK4jO4OPPee_m1LS1EQKN5A1-OLaf1JwqUrNMSU98IgAcF-AVSF7kY-Am7z8U_BJWAYxtc8yyFA42GQFRTMhIncu8KaShmOzBX_lazgHyjwJU477CYu_ES9uX6DCEQwT4jcklOcneQ=w497-h937-no

    I bought a V60 as a replacement but now I don't even need it anymore, it's a shame I can't refund it now. Amazing job and thanks for all the devs keeping this phone alive. Might try Lighthouse later but I'm lazy to back up all my data for migration.
    Thanks! Happy to know the kernel is being useful to others as well. And a bit of a spoiler (xxseva already hinted at it in a few places, lol), but there's definitely a lot more coming for the V20, G5 and G6, although i can't share many details about it nor a ETA of when it will arrive. But if/when it arrives, you can expect Android 12 with a kernel that's essentially the best parts of Swan and mk2000 mashed together.