[LG V20 Guides, News, & Discussion] Ooxae1le:
freeze on wakeup/unlock

Hi Everybody,

long time listener first time caller here :)

I recently got a used LG v20 H990N. With DS bootloader, I installed Lineage 17.1 on it.

Like many here before me, I was hit by this "freeze" issue on wakeup a few times.

I intend to use this phone as my daily driver, so i must fix this problem or at least find a reasonable workaround.

Therefore, I'll need to spend some time working on it and share with others here so that together we figure out a solution.

First step is to:

1) nail the repro and identify some key symptoms to make sure we are all experiencing the same issue or issues

Let me describe mine in some detail and please share yours in as much detail as you can so we can all compare and identify differences and similarities.

- I enable ADB and have a machine which has been pre-authorized for ADB ready to go.

- I put the phone on stock charger, lock it with the power button and wait "a while" (not just a minute or two, that won't do it, 30 minutes or more seems to do it, overnight has *always* done it for me, but i just got the phone so "always" means 3 out of 3). The state of charge does not seem to matter. I've just had a repro with the initial state of 100%. Previous two repros were in the 70% range. I initially thought this had to do with fast charging or something, but that does not appear to be the case. I was also able to repro on non-stock charger (which was able to deliver 1A or less), but in order to limit the number of variables, lets stick to the stock charger for now.

- I then disconnect the phone from the charger, but do not yet attempt to unlock it.

- I connect the phone to the pre-authorized ADB machine and go into adb shell. Prior to installing magisk, i would run adb root; adb shell; now with magisk, i would run adb shell and then type su there

- At this point there is nothing that indicates a "problem". ADB itself works fine, i don't see any unusual activity in logcat or dmesg. I define "unusual" by comparing the logs with the logs from before the phone was on charger and try to see something that stands out. As I said, at this point, nothing stands out to me.

- Attempt to wake up the phone. I tired both double tap and fingerprint, both seem to repro the problem for me.

- In some cases I've seen the screen remains black-ish (the backlight is on, i believe, but the picture is black), in some cases the screen is on, i get the background and the 'old' data is displayed on the 2nd screen (i.e. i see old timestamp as of the time when it was locked and old battery charge %, even though from dmesg output i know that it is now at 100%).

- Collect dmesg and logcat right after the (failed) wakeup attempt.

- Side note: if i wait long enough in this state (probably half an hour or so) the phone will eventually reboot to recovery, but during this time window i can collect data.

- One thing i noticed so far is that lots of processes go into ANR and dumps are collected.

- Another thing i noticed is the following errors in the kernel log:

[33787.759833] scm: secure world has been busy for 1 second!

[33788.868033] scm_call failed: func id 0x42001306, ret: -12, syscall returns: 0x0, 0x0, 0x0

[33788.868108] lmh_lite:lmh_read_and_update Error in SCM v8 read call. err:-12

[33788.983788] scm_call failed: func id 0x42000904, ret: -12, syscall returns: 0x0, 0x0, 0x0

[33788.983883] External command 3 failed with error 4294967284

[33790.127876] scm: secure world has been busy for 1 second!

[33790.207807] scm: secure world has been busy for 1 second!

[33791.351850] scm_call failed: func id 0x42001306, ret: -12, syscall returns: 0x0, 0x0, 0x0

[33791.351929] lmh_lite:lmh_read_and_update Error in SCM v8 read call. err:-12

[33791.431888] scm_call failed: func id 0x42000904, ret: -12, syscall returns: 0x0, 0x0, 0x0

[33791.431995] External command 3 failed with error 4294967284

This seems to indicate that the secure world is 'stuck' and lmh_read_and_update() in drivers/thermal/lmh_lite.c gets ENOMEM from LMH_GET_INTENSITY invocation:

ret = scm_call(SCM_SVC_LMH, LMH_GET_INTENSITY,

(void *) &cmd_buf, SCM_BUFFER_SIZE(cmd_buf), NULL, 0);

which is probably because the scm world is 'stuck'.

I'm not saying these have anything to do with the root cause of the problem, etc, etc. I'm just trying to find a repro and a 'signature' of the problem, so we can all collaborate on this together.

Side note 2: One thing i tried and it 'worked' 2 times initially, but failed on the 3rd try :(

is to disable the sleep in android by doing this as root:

echo Ooxae1le >/sys/power/wake_lock before attempting the repro (i.e. prior to putting the phone on charger and locking it)

Side note 3: I noticed that I can ping the phone over wifi before attempting to wake it up, but not after it.

Other thoughts and ideas: comparing our 'ancient' lineage kernel with something more recent might make sense, I'll start with the lmh driver and go from there... perhaps something has been already fixed and 'all we need to do' is to backport a fix or two?

i suspect that that lmh is just a 'victim' here, i.e. not a cause of the actual problem, but i'm not sure.