Bug 205205

Summary: S3 fails - dell latitude 7390 2 in 1
Product: Power Management Reporter: Steven Rostedt (rostedt)
Component: Hibernation/SuspendAssignee: Zhang Rui (rui.zhang)
Status: CLOSED DOCUMENTED    
Severity: normal CC: leho, rui.zhang, superm1, superm1, yu.c.chen
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 5.2.17 Subsystem:
Regression: No Bisected commit-id:
Attachments: Config file for my 5.2.17 kernel.
dmidecode output of my laptop

Description Steven Rostedt 2019-10-16 02:01:12 UTC
Created attachment 285513 [details]
Config file for my 5.2.17 kernel.

My Dell Latitude has issues with suspending. I noticed this on a normal Debian kernel (4.19.0-5-amd64) but tried out a newer kernel (one I have built for all my machines) and the issue still persists.

When I boot up, it only supsends to idle:

$ cat /sys/power/mem_sleep 
[s2idle] deep

If I switch it to deep and try suspending to mem, it just shuts down and doesn't come back.

# echo deep > /sys/power/mem_sleep
# echo mem > /sys/power/state

Attached is the config I used for my 5.2.17 kernel.
Comment 1 Zhang Rui 2019-12-29 02:16:45 UTC
what is the model name of your laptop? Probably S3 is not well supported for this mode.
Comment 2 Steven Rostedt 2020-01-02 20:23:14 UTC
It's a Dell Latitude 7390. I'll attach the dmidecode as well.
Comment 3 Steven Rostedt 2020-01-02 20:23:47 UTC
Created attachment 286595 [details]
dmidecode output of my laptop
Comment 4 Zhang Rui 2020-01-03 02:54:40 UTC
Hi, Mario,
do you know if S3 is supported on this model?
Comment 5 Chen Yu 2020-01-03 08:53:42 UTC
If 
echo core > /sys/power/pm_test
echo mem > /sys/power/state 
resumed back within 5 second, it is probably S3 is not supported on this platform.
Comment 6 Steven Rostedt 2020-01-03 14:45:19 UTC
Grumble, it gives me a "Resource temporarily unavailable" message, and dmesg gives me: "Unsupported test mode for suspend to idle, please choose none/freezer/devices/platform".
Comment 7 Zhang Rui 2020-01-04 03:30:04 UTC
you should run "# echo deep > /sys/power/mem_sleep" first, before your test.
Comment 8 Steven Rostedt 2020-01-04 03:39:29 UTC
(In reply to Zhang Rui from comment #7)
> you should run "# echo deep > /sys/power/mem_sleep" first, before your test.

Thanks! I just did and the laptop did go to sleep for about 5 seconds and came back without issue.
Comment 9 Steven Rostedt 2020-01-04 03:40:37 UTC
But from Comment 5, I'm guessing that means it's not supported?
Comment 10 Zhang Rui 2020-01-04 03:43:06 UTC
Well, I'd like very likely, but I still like to check with Mario about this.
Comment 11 Mario Limonciello 2020-01-06 15:31:56 UTC
@Zhang Rui:

S3 should not be supported on this model.
Comment 12 Zhang Rui 2020-01-07 16:22:45 UTC
Hi, Mario, thanks for confirming.

Hi, Steven, so the problem is clear that S3 is not supported on this platform. And that is why s2idle is made as default by the Linux kernel.

Bug closed as this is a BIOS bug, if S3 is not supported, BIOS should not expose _S3 control method at all.
Comment 13 Mario Limonciello 2020-01-07 16:27:21 UTC
So that being said - if you're having high power consumption under s2idle, we should debug it.

Ideally please use a more recent kernel version.  There are some pretty significant fixes that when into 5.4 that have drastic impacts on s2idle power consumption on Dell HW.  If you're continuing to have power consumption problems on s2idle with 5.4, open another issue and lets work through them.
Comment 14 Steven Rostedt 2020-01-07 21:16:30 UTC
Well, I tried under 5.4, and the same issue applies. Actually, the one thing that makes it hard to determine power usage problems, is that the laptop wakes up if the power or volume buttons are touched (which all exist on the exterior of the laptop case! That makes placing it in a laptop bag in suspend most likely to wake it up.

Note, this all works fine if I boot Windows on this laptop. Not sure what magic sauce Windows is doing. When in suspend, the outside buttons do not wake it up.

Note I can't really test Windows anymore, because I accidentally forgot to enable secure boot before booting it up, and as this is a work laptop, the windows configuration cleared out my account on this box when it detected secure boot was off! :-)  Thus, I can no longer log into windows. But that may be more of a feature than a bug ;-)
Comment 15 Mario Limonciello 2020-01-07 21:36:15 UTC
On a 5.4 kernel as you go down capture /sys/devices/system/cpu/cpuidle/{low_power_idle_system_residency_us, low_power_idle_cpu_residency_us}

Compare those after you wake up and you should see both going up.  If they're not going up there is still a separate power problem on your system that we should debug.  If they're going up we need to figure out how to know to prevent those buttons from waking the system.  I wouldn't expect volume to do it, but I would expect power to do so.
"Normally" the power button wakes traditional clamshell laptops from s2idle.  the same code is there in 2-in-1's, but nothing prevents it from waking.

I'd guess what we need is to examine the tablet mode switch in intel-vbtn (https://github.com/torvalds/linux/blob/master/drivers/platform/x86/intel-vbtn.c#L116) and if it's set into laptop mode don't listen to power button presses, and if it's in tablet mode follow power button presses.  You should probably raise this on the mailing lists (platform-x86 and linux-acpi).