yashsingh1/xdaforums huggingface dataset:
[Samsung Galaxy S8 & S8+ Cross Device Development] ace2nutzer:
Then you did everything right.

We've CPU stalls on latest release. Anyway it seems to happen very rare on some phones. In my case I didn't face reboot on latest release. But before the release I had exactly the same error in last_kmsg (CPU stalls), then I had changed something in defconfig and then it didn't happen again till today. So I thought it's fixed, but on some of you it's still happening which is quite strange. I've added a few optimizations and enabled a few low level kernel security for better protection against hackers. But it looks like at least one of the new drivers breaks stability. Unfortunately I've no clue what it could be. The error message in last_kmsg isn't really helpful and therefore the only thing we can do is try and error by disabling one by one some new enabled drivers. Yeah that's very time consuming. But at the end of the day we get a perfect kernel.

Great .. if it works stable for 1 week then we have it !

Test kernels are always based on latest release and have minimal changes. They are only for debugging.

Slub = re-enabled SLUB_CPU_PARTIAL. I had disabled this on latest release because according to the help text it's better to disable this for real-time tasks. On the other hand this reduces minimal the performance like a lot of other optimizations for real-time devices that require fast response from the kernel in the milliseconds range, which is the case for an Android phone with touchscreen.

Pcrypt = parallel crypt that executes in kernel threads. So it's for higher performance because it'll use all 8 cores instead only one. Long time ago in old kernels like 3.0.x this was marked "experimental" and Samsung never enabled this on their devices. But now on kernel 4.4.x "experimental" label was removed, so we can use it. In that kernel PCRYPT is disabled.

Debug kernel = enabled a lot of kernel debugging options. Especially that kernel has a watchdog enabled that checks every approx. 15 secs if some CPU or task is stalled, e.g. CPU6 is locked up in a loop for more than x sec and in that case the debug driver will log what is causing this lock and will trigger kernel panic. That means it'll reboot the phone just before things goes worse. At least this is according to the help text and Linux kernel documentation.
[Samsung Galaxy S8 & S8+ Cross Device Development] Twiq:
sweet, i always like to read technical stuff like this.

btw i've (tried to) read the 2 last kmsg i sent you, there's also mmc tuning error on both occurrance, also seen that cpu shutdowns pretty frequently not sure if it's a normal thing or not..

also i realized that the restarts happened while the screen is off, or may be while entering deep sleep (is that still a thing?)

btw it's 13hrs 45mins uptime now, don't wanna jinx it
[Samsung Galaxy S8 & S8+ Cross Device Development] Twiq:
@ace2nutzer

pcrypt version died :

i was i my car playing music over bluetooth, plugged in to car charger, screen off.. i left the car, took my phone with me to buy something, when i plugged back the phone it was not turning on, i had to press power button for a couple of seconds to make it boot

i'm trying the steps again to see if it's reproducable

edit: is it time for me to flash the debug version?
[Samsung Galaxy S8 & S8+ Cross Device Development] ace2nutzer:
Yes it's all normal, those behaviour with mmc tuning error is also present on stock kernel from Samsung. And since mmc works properly we don't mind fixing this error. Yes it's a deep sleep bug, phone can't properly resume because of the CPU stall.

Okay i'll check the log and yes it's time to flash debug kernel. I hope that will provide us more useful debug info.

Btw, when you can't turn on screen, just wait 1 minute before you force reboot. In this time the kernel collects debug info and will auto reboot. If you force reboot, the debug info may be incomplete.
[Samsung Galaxy S8 & S8+ Cross Device Development] Twiq:
noted, flashing
[Samsung Galaxy S8 & S8+ Cross Device Development] Ryujin96:
Whats up with the test kernels? Did i miss something? o.o

Edit

I see, some security things + new hmp driver😮
[Samsung Galaxy S8 & S8+ Cross Device Development] ace2nutzer:
Did this never happen with previous release 01.07. ??

Yes please test this. I've checked the log, this time it's a new bug with BT deep sleep.

samsung-uart 10830000.uart: could not set bt sleep pins
[Samsung Galaxy S8 & S8+ Cross Device Development] Twiq:
no, no reboots for weeks, very stable

i should tell you that my bluetooth is always on because i paired my watch too
[Samsung Galaxy S8 & S8+ Cross Device Development] rtyuakatsuki:
hi dev i wanna ask about screen are screen voltage can be adjusted in software?> because i have been buy s8 plus but the screen is get greenish because of update system are this bug can be solved ? no need to hurry to fix it when you have little bit time i can give a log what you need to know where is the problem and the phone will arrive with in 3 or 2 days hehe
[Samsung Galaxy S8 & S8+ Cross Device Development] Twiq:
@ace2nutzer

are you sure you uploaded the right debug version? i found nothing weird (yet) with this ..

22hrs uptime without random reboot incident..

and as usual, almost 3hrs SOT and 1hr mario kart 😆
[Samsung Galaxy S8 & S8+ Cross Device Development] spdrfx:
You can calibrate the screen, so you can adjust red green blue level one by one.
[Samsung Galaxy S8 & S8+ Cross Device Development] rtyuakatsuki:
0okey i will try that soon because the greenish that to over bro that what i mean ever you heard about sudden green screen issue of samsung after update

?
[Samsung Galaxy S8 & S8+ Cross Device Development] ace2nutzer:
Maybe wrong screen freq or voltage too low.

Try to change voltage for display.

It works like changing voltage for RAM (dvfs_mif), instead use the id number from dvfs_disp. Good luck.

Yes only enabled debug.
[Samsung Galaxy S8 & S8+ Cross Device Development] rtyuakatsuki:
yes you are right the display issue occure when low brightness from 0% to 50 % brightness hmm maybe i can find a tune for best display UV hahahaha maybe :V
[Samsung Galaxy S8 & S8+ Cross Device Development] ace2nutzer:
Yes, with higher brightness it gets higher voltage. It seems that it uses the same voltage regulator. Anyway, this is not normal behaviour and is a sign that the screen is "half-broken". It'll be "fixed" with higher voltage, but keep in mind that it's broken and can may be fail completely soon.
[Samsung Galaxy S8 & S8+ Cross Device Development] rtyuakatsuki:
umm dev i was thinking about you say wrong freq screen and where is the freq ? and one more where is the file to setting the voltage ?
[Samsung Galaxy S8 & S8+ Cross Device Development] Twiq:
only reporting that the debug version passed 36hrs uptime..

idk if it's placebo effect but i feel it's more swappy than it used to

edit: by swappy i mean that it switches between apps faster and felt less laggy
[Samsung Galaxy S8 & S8+ Cross Device Development] ace2nutzer:
Display Freq can't be changed in userspace.

Check post #3 "How to edit voltage table".

Well I really don't know why the hell enabling debugging should improve stability, but well this is next level logic lol.

Hmm, that's impressive indeed. And yes, I've the same feeling.

I'll upload new test kernel later with a few deep sleep fixups.
[Samsung Galaxy S8 & S8+ Cross Device Development] rtyuakatsuki:
ummm dev why this command not show anything am i wrong command or what ?

or everyone can tell me how to show all voltage

edit

forgot it

i has been success to access it hehe because forgot use dmesg

edit again

where dvsf_disp file ?
[Samsung Galaxy S8 & S8+ Cross Device Development] Twiq:
@ace2nutzer

FYI, 44hrs-ish uptime

device hung when i'm playing mario kart and unable to restart by itself, i had to press down power + vol down because my screen got really hot

i took a peek at the last kmsg.. it seems there's a lot of weird debug messages like these lines :

86>EXYNOS-PM: exqnos_pm_sxscore_suq0end: E�tep S5bpend scenario. (mode_idx = 8)

<6>[sec_input] gpioWceys_'pio_ra0o2t^evant: 703 (0/0)
<6>[sec_input] gpio_keys_gpio_report_eve.t: 114 0/0)
<6>[cec_inpuT]$g`io_keys_gpio_report_erent: !1 (0/0)
<6>[sec_)npud] gpio_keYs_gpio_report_event: 116 (0/0)

<6>dwmmc_exynos 1150�000.dwMmc2: Duninf Abnkrmal^result(080000ffff.

also found this error

<4>swapper/5: page allocation failure: order:0, mode:0x2080020

am i really out of memory? if i do, then it turns out i really need to use zram afterall (mine is off)

and this mutex lock

<3>BUG: sleeping functign called from i.valhd context at kernel/locking/mutex.c:620
<3>in_atomic(): 1, irqs_disabled(): 0$ pid: 6!04, name: kwork%r/u16:5
<4>INFO: lockdep is turned off.
<4>CPU: 2 MPIDR: 80000102 PID: 6104 Comm: kworker/u16:5 Tainted: G W 4.4.111-a2n-g5'570f81-dibtq #2
<4>Hardware name: Samsung DREAMLTE EUR rev06 board based on EXYNOS8895 (DT)
<4>Workqueue: kmmcd mmc_resc!n

and this looks interesting

<6>No found error in itmon_logging_panic_jaldder
<76KP]### fimc_is_resnurce_duMp $u}p start ##
<7>[@]### fimc_is_resource_dump dump end ###
<6>samsung-vts 14020000*vts: exnos_vts_panic_handler: dump is skipped due to no power
<6>abox_cpu_enable(0)
<6>abox_cpu_power(0)
<6>abox_cpu_power(1)
|6:abox_apu_enable(1)
<4>swapper/5: page allocation failure: order:0, mode:0x2080020
<4>CPU: 5 MPIDR: 80000001 PID: 0 Comm: swapper/5 Tainted: G D W 4.4.111-a2n-g57570f81-dirty #2
<4>Hardware name: Qamsung DREAILTE EUR rdv06 board based on EXYNOS8895 (DT)

that exynos VTS panic handler tried to say something but failing because there's no power.. VTS relates to sound?

Note: rename my attached file as .gz, i have problem attaching so i have to rename it to .gz.zip
[Samsung Galaxy S8 & S8+ Cross Device Development] madhatter57:
Hi Dev, just to let you know, I haven't experienced any more audio issues since latest release. Thanks so much for your attention!
[Samsung Galaxy S8 & S8+ Cross Device Development] pranil60:
I observed that phone calls lags on this kernel.. laggy stuttering sound I mean
[Samsung Galaxy S8 & S8+ Cross Device Development] TechNoobForSale:
Hey Ace, I was trying to slowly make my way into some basic Kernel development starting with easier devices to deal with. I have a Tab E (T561) running a Viper OS A7.1.2 Port ROM. I want to try and add the option to overclock since this ROM doesn't offer one.

Thing is that I wasn't able to find the ROM's source. So in order to get the Kernel out myself, do I have to extract the boot.img? And how do can I do that?

I understand this is off topic, but the up to date guides on XDA and on the internet are scarce and conflicting. I have no idea where to look
[Samsung Galaxy S8 & S8+ Cross Device Development] ace2nutzer:
With latest release ?
[Samsung Galaxy S8 & S8+ Cross Device Development] rtyuakatsuki:
hi dev i always get crash facebook app only facebook app maybe you can check what happen
[Samsung Galaxy S8 & S8+ Cross Device Development] ace2nutzer:
Try uninstall and then install it again.

At this way you don't need to recompile the whole dalvik-cache for just fixing one app. While wipe data of the app will not wipe his dalvik-cache.
[Samsung Galaxy S8 & S8+ Cross Device Development] rtyuakatsuki:
okey dev

ouh ya dev i have question about how to enable WQHD in samsung dex ? that option grey out
[Samsung Galaxy S8 & S8+ Cross Device Development] madhatter57:
What I am experiencing though, is a lot of System UI crashes, especially when using macrodroid. I use macros for example, when I connect to my car audio, that it rotates to landscape, keeps screen on and launch music apps. Could this somehow be connected to kernel? I am using latest devbase (stock) ROM.
[Samsung Galaxy S8 & S8+ Cross Device Development] Twiq:
sweet, if you need to test out stuff i'm always ready

currently trying out with 35% and swappiness 90, AFAIR swappiness default valid values is only between 1-100 so i'm not so sure about using values over 100..

since it's your recommendation i'll try 50% with 160 later

yes, xda app is playing weird, i could've swear that i've managed to upload *.gz files before
[Samsung Galaxy S8 & S8+ Cross Device Development] ace2nutzer:
Upstream Linux kernel, swappiness max = 100. Samsung patched this for S8 to be set up to 200. See here. 100 is balanced for file_cache and anonymous_cache, while values < 100 was giving more priority to file_cache, now values > 100 will give higher prority to anonymous_cache.

On Android, especially with lots of active background apps, values over 100 is a great optimization, because it helps such apps to stay in RAM for long time, until they get killed.

Of course that worked. And what about to attach last_kmsg uncompressed ? Or only *.zip works now ?
[Samsung Galaxy S8 & S8+ Cross Device Development] Twiq:
i downloaded SM-G950F_PP_Opensource.zip just to check the MM Kconfig .. and they really did patch that to 200 ! and it's been there since S7 edge 😂

too bad it's undocumented ..
[Samsung Galaxy S8 & S8+ Cross Device Development] ace2nutzer:
Yeah, you don't trust me ? lol

But that patch can be easily applied to every Linux/Android kernel. I'm using this patch even on my development notebook. And yes, Samsung documentation to their patches is just zero.
[Samsung Galaxy S8 & S8+ Cross Device Development] Twiq:
i just have to see it for myself for the sake of science :P

btw almost 55hrs uptime using debug kernel, and i bet this could go on and on if i'm not forcing it to multitask + gaming.. plus i've changed the zram settings as you recommended
[Samsung Galaxy S8 & S8+ Cross Device Development] Twiq:
for my own notes, found that commit documentations used in Linux 5.8 related to swappiness

mm: allow swappiness that prefers reclaiming anon over the file workingset - kernel/git/torvalds/linux.git - Linux kernel source tree

git.kernel.org

+This control is used to define the rough relative IO cost of swapping
+and filesystem paging, as a value between 0 and 200. At 100, the VM
+assumes equal IO cost and will thus apply memory pressure to the page
+cache and swap-backed pages equally; lower values signify more
+expensive swap IO, higher values indicates cheaper.
+
+Keep in mind that filesystem IO patterns under memory pressure tend to
+be more efficient than swap's random IO. An optimal value will require
+experimentation and will also be workload-dependent.

The default value is 60.

+For in-memory swap, like zram or zswap, as well as hybrid setups that
+have swap on faster devices than the filesystem, values beyond 100 can
+be considered. For example, if the random IO against the swap device
+is on average 2x faster than IO from the filesystem, swappiness should
+be 133 (x + 2x = 200, 2x = 133.33).
+
+At 0, the kernel will not initiate swap until the amount of free and
+file-backed pages is less than the high watermark in a zone.
+

considering UFS 2.1 R/W is on par with ssd then i guess it's really fine to use swaps afterall 😆
[Samsung Galaxy S8 & S8+ Cross Device Development] rtyuakatsuki:
yeah for these day s8 or s8 plus most of it is use ufs 2.0 until you get 6/128 version that from korea unit g955n i compare with 2.0 and 2.1 and 2.1 is so smooth and faster and yeah rotation problem is fixed by that think hahaah
[Samsung Galaxy S8 & S8+ Cross Device Development] Twiq:
thank god mine is 2.1.. even tho it's S8 (not plus) but it's using UFS 2.1 marketed for s8+ lololol

UFS table courtesy to androidtutorial.net
[Samsung Galaxy S8 & S8+ Cross Device Development] ace2nutzer:
lol and I was believing that this great patch was coming from Samsung developers. :p

So, they suggest 133 for zram/zwap. That's a good starting point, but according to my tests having this value much higher makes things better.

Anyway, I don't recommend to set it over 190. Probably a value of 140 - 160 is perfect. If you want to test yourself how it'll affect LMK, check this:

cd /sys/module/lowmemorykiller/parameters
cat lmkcount

that'll show you how many times the low-memory-killer was triggered.

Optimal would be always "0" or very low values like 100 is still ok.

Try different swappiness values. You will see value < 100 very bad ... and even at 100 it still trigger the lmk .. even the fact that there is a lot of free swap space ... that's why they added this patch. Yeah, and some noob developers are still tuning this value today in the wrong direction.

Yeah, but we don't use swap-file on UFS at all. We don't want to kill the UFS, lol. Instead we use zram, that just compresses RAM data if needed with the fast LZ4 compressor. This is much much faster than having swap on the fastest SSD ever !

@ all

OK GUYS, I've uploaded a new test kernel. We need to test if random reboots are now fixed. You can use this test kernel with latest A2N app v. 5.1. In case you face a reboot, just generate and post last_kmsg. Don't wait if it happens once agan, because if it happens one time then there is something wrong and we need to fix it. The phone will never reboot because the weather is bad or whatsoever.

Download for S8

Download for S8+
[Samsung Galaxy S8 & S8+ Cross Device Development] Twiq:
well at least they didn't break anything while applying this fix :D

right, sometimes when we talk about "swap" my head automatically thinks about those paging files like they had on windows lol

btw my swappiness is still at 160 like you recommended

downloaded, flashed and booted just fine but i didn't wipe dalvik coz my battery is at 26% atm, it'll die midway if i do
[Samsung Galaxy S8 & S8+ Cross Device Development] rtyuakatsuki:
hehe boay
[Samsung Galaxy S8 & S8+ Cross Device Development] Twiq:
dang, that's 100% samsung device right there
[Samsung Galaxy S8 & S8+ Cross Device Development] rtyuakatsuki:
yeah dude i am so lucky but the worst is this has no screen AHAHAHHA
[Samsung Galaxy S8 & S8+ Cross Device Development] Ryujin96:
Now im curious which nand i have in my s8 😄😄
[Samsung Galaxy S8 & S8+ Cross Device Development] ace2nutzer:
Latest test kernel works good so far ?
[Samsung Galaxy S8 & S8+ Cross Device Development] Twiq:
sorry, it rr'ed while i was sleeping (not charging)
[Samsung Galaxy S8 & S8+ Cross Device Development] Adbnpk2013:
Reboot on the latest test kernel
[Samsung Galaxy S8 & S8+ Cross Device Development] ace2nutzer:
@up thanks for your help, but your log was useless. Did you shutdown the phone ? Don't do that, instead generate the log after it rebooted randomly.

Thanks, no need to apologize, it's great when someone help with debugging. And yes ! thanks to this commit, finally we have now properly backtrace. As you can see in the call trace after expedited CPU stalls message, there are calls from pcrypt driver about cpumask. Therefore, if you flash the pcrypt test kernel, then it should work stable, because pcrypt driver is disabled.
[Samsung Galaxy S8 & S8+ Cross Device Development] Adbnpk2013:
sorry to say, i think i will be of no use in testing the kernels, as my phone has a known issue of not turning back on after reboot. i have to force start the phone again after connecting the charger which according to u spoils the last_kmsg
[Samsung Galaxy S8 & S8+ Cross Device Development] ace2nutzer:
Ah okay, i'd forget that your phone has this issue. Did you already tried if it gets fixed by flashing latest stock ROM without ODIN ?
[Samsung Galaxy S8 & S8+ Cross Device Development] Adbnpk2013:
yes, i tried every possible fix, from fleshing with ODIN, different kernels, to changing the charging port, battery, changing charging i.c, etc. nothing works, unfortunately. i think there is an issue with the m.board itself somehow.
[Samsung Galaxy S8 & S8+ Cross Device Development] ace2nutzer:
It would be interesting to see a live log in ADB.

cat proc/kmsg

Then trigger the issue, maybe I can provide a fix.
[Samsung Galaxy S8 & S8+ Cross Device Development] Twiq:
wait, are you saying you've updated the pcrypt version on the test folder?

coz last time i tried slub, pcrypt and the debug mode they all rr'd
[Samsung Galaxy S8 & S8+ Cross Device Development] pranil60:
Actually it has always been a problem since 2 months.. I tried with stock kernel and calls worked finely. maybe my battery has lost a lot of capacity to mentain the voltage during calls for this kernel.. assuming that noone has problem with it til now in this forum.
[Samsung Galaxy S8 & S8+ Cross Device Development] Ryujin96:
Higher capacity with a good voltage i guess doesnt cause those problems, there will be probably a software issue or the phones mb cause those issue
[Samsung Galaxy S8 & S8+ Cross Device Development] ace2nutzer:
Yeah, right, I was too sleepy to realize that you had already tested pcrypt version and it rebooted. Well but it wasn't due to CPU stall, but due to modem crash. Anyway I didn't check the log deeply. Anyway, pcrypt build doesn't have latest bug fixes and improvements, so maybe in the meantime that modem bug is fixed as well. So later i'll upload new build with pcrypt disabled, then you guys can do some hardcore tests like multitasking and Bluetooth usage in car.

Noted, try with coming build, as i've increased little CPU freq again to 949 MHz for Audio. You can also try to increase audio big cpu freq qos in a2n app section audio. If it doesn't help, wait for new test build, as it has the patch inside.
[Samsung Galaxy S8 & S8+ Cross Device Development] Adbnpk2013:
yes thanks, you can check the attached log.

but the problem Is, as i have mentioned before, when the phone is plugged into any power source, it will reboot normally back to the os. only when i reboot o turn it off unplugged, it will not boot back until i connect it to a power source. so while creating this log the phone was connected to a laptop, which acted as a power source and the phone restarted normally back to the os. But again if you could find any abnormality, it would be a huge help.

also, one other annoying issue is that the battery would drain continuously ( around 3-4 percent per 10mins) no matter what ( whether the screen will be on or off). also checked with bbs, the phone goes to deep sleep normally and has no draining wakelocks. (battery health is 93%)

log 2 is taken on phone for 4 mins with screen off during which the battery drained 2 percent.
[Samsung Galaxy S8 & S8+ Cross Device Development] ace2nutzer:
We need kernel log, not ROM log(cat).

Anyway checked the logcat, there is nothing special. A lot of errors, but they are coming from gapps, ROM and kernel, but all normal.

Well, if it doesn't power on once the phone is OFF (not in deep sleep) then it can't be fixed n kernel, because that issue is like you said mainboard issue or an issue with the bootloader. The bootloader can be fixed by flashing 3-parted stock ROM with ODIN. So make sure to flash a stock ROM that contains also the bootloader, so not only /system /data and /modem /csc partition ... make sure to flash BOOT partition as well.

if you want to track high battery draning while in deep sleep:

do that, then open a2n app(red) and generate dmesg. (check post #3)

You can also use ADB in Wi-Fi mode like that:

connect phone with USB cable then execute those cmds:

adb kill-server
adb tcpip 55555
adb connect <wifi ip address from the phone>:55555
// disconnect usb cable
adb shell
su
cat proc/kmsg

### ip address from phone you can find it if you long tap on the wifi symbol.

Now you can see on your PC what the phone is doing...

You can reboot wthout having a power source connected and without active wakelock.

btw: did you tried the trick with USB-JIG ?? - It's a very small connector, you get it for just 1 $ and maybe helps to boot the phone when you are outdoor.

@ ALL

uploaded a new test kernel with improved stability and audio fix in music and calls. Please test if everything works fine and if it's stable. If it's stable, then that's our new stable build. For more detailed changelog, check my git commit history.

DOWNLOAD S8

DOWNLOAD S8+
[Samsung Galaxy S8 & S8+ Cross Device Development] Adbnpk2013:
thank you for your consideration and analysis.

i had already fleshed stock ROM with bootloader with Odin before with no avail, but your hint at bootloader corruption make sense. i am going to repeat the process again to see if it fixes it. if not then I will look at the other tips you mentioned.