Bug 105196

Summary: Display hangs after resuming from hibernation
Product: DRI Reporter: amn-bas
Component: DRM/IntelAssignee: Imre Deak <imre.deak>
Status: CLOSED FIXED QA Contact: Intel GFX Bugs mailing list <intel-gfx-bugs>
Severity: normal    
Priority: high CC: imre.deak, intel-gfx-bugs
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: SKL i915 features: power/suspend-resume
Attachments:
Description Flags
dmesg
none
dmesg with all parameters and early kms enabled
none
dmesg custom kernel with dmc 1.27
none
dmesg dmc 1.27 drm.debug=0xe
none
dmesg custom 4.15 w/dmc 1.27
none
Fix hibernation with S0 target state
none
patched 4.15.6 with dmc 1.27 and patch 137791
none
Fix hibernation/debug
none
4.15 with debug patch
none
dmesg patched none

Description amn-bas 2018-02-21 17:13:42 UTC
Created attachment 137505 [details]
dmesg

OS: Archlinux 4.15.3-2-ARCH
Mesa: 17.3.4
PC: Dell XPS 15 (9550)
Graphics: Intel HD 530

The pc hangs for a few seconds after resuming from hibernation, it crashes and stops displaying anything if I have early KMS start.

mkinitcpio.conf:
# MODULES
MODULES=""
#"intel_agp i915"
BINARIES=""
FILES=""
HOOKS="base plymouth udev resume autodetect modconf block filesystems keyboard fsck"

xorg.conf:
Section "Device"
    Identifier  "Intel Graphics"
    Driver      "modesetting"
    Option      "TearFree" "true"
EndSection

cmdline:
initrd=\EFI\arch\intel-ucode.img initrd=\EFI\arch\initramfs-linux.img root=UUID=fdcdfaf9-f530-4274-a064-f697b811d9f4 rw resume=/dev/nvme0n1p2 resume_offset=34816 intel_idle.max_cstate=1 acpi_rev_override=5 pci=noaer acpi_backlight=vendor acpi_osi=Linux libahci.ignore_sss=1 pcie_aspm=force pcie_port_pm=off nmi_watchdog=0 intel_iommu=on quiet splash loglevel=3 rd.systemd.show_status=auto rd.udev.log-priority=3 vt.global_cursor_default=0

/etc/modprobe.d:
options snd_hda_intel power_save=1 power_save_controller=1
blacklist i2c_hid
options i915 enable_psr=0 enable_rc6=1 enable_fbc=1 semaphores=1 enable_guc_loading=1 enable_guc_submission=1 edp_vswing=2 disable_power_well=0
options iwldvm force_cam=0
options iwlwifi power_save=1 d0i3_disable=0 uapsd_disable=0
options usbcore autosuspend=5
Comment 1 Elizabeth 2018-02-22 16:15:28 UTC
Hello, could you please share crash dump /sys/class/drm/card0/error?

Does It still happens if you remove this parameters?:
enable_rc6=1 enable_fbc=1 semaphores=1 enable_guc_loading=1 enable_guc_submission=1
Comment 2 amn-bas 2018-02-26 07:23:57 UTC
The system kernel now is updated to 4.15.5-1-ARCH and Mesa is updated to 17.3.5, the issue is still present.

dmesg1
https://pastebin.com/hJuET9aN
This is the dmesg with all parameters included

dmesg2
https://pastebin.com/TU4h1C9G
This one is the one after removing the parameters

Either way I always get "No error state collected" from /sys/class/drm/card0/error
Comment 3 amn-bas 2018-02-26 08:08:48 UTC
Created attachment 137602 [details]
dmesg with all parameters and early kms enabled
Comment 4 Elizabeth 2018-02-26 17:31:52 UTC
Could you try dmc 1.27 https://bugs.freedesktop.org/show_bug.cgi?id=101991#c18?
Comment 5 amn-bas 2018-02-27 04:30:27 UTC
Created attachment 137628 [details]
dmesg custom kernel with dmc 1.27

Same issue with dmc 1.27
Comment 6 Imre Deak 2018-02-27 12:38:13 UTC
Does the problem happen when booting without any of the following options:

acpi_rev_override=5 pci=noaer acpi_osi=! acpi_osi="Windows 2009" acpi_osi=Linux libahci.ignore_sss=1 pcie_aspm=force pcie_port_pm=off intel_iommu=on

Could you provide a dmesg log containing the same error booting with drm.debug=0xe ?
Comment 7 amn-bas 2018-02-27 16:19:55 UTC
Created attachment 137650 [details]
dmesg dmc 1.27 drm.debug=0xe

# cat /proc/cmdline 
initrd=\EFI\arch\intel-ucode.img initrd=\EFI\arch\initramfs-linux-custom.img root=UUID=fdcdfaf9-f530-4274-a064-f697b811d9f4 rw resume=/dev/nvme0n1p2 resume_offset=34816 intel_idle.max_cstate=1 modprobe.blacklist=nvidiafb,nvidia,nouveau drm.debug=0xe
Comment 8 amn-bas 2018-02-27 16:21:05 UTC
Yes the problem still happens
Comment 9 Imre Deak 2018-02-28 13:19:30 UTC
(In reply to amn-bas from comment #8)
> Yes the problem still happens

Thanks. Something is strange with your config, could you check that?:

[  118.921490] [drm:skl_check_plane_surface [i915]] requested Y/RGB source size 7680x4320 too big (limit 8192x4096)
Comment 10 amn-bas 2018-02-28 17:23:00 UTC
Hmm, so I enabled early KMS and disabled all i915 options from /etc/modprobe.d and booting only with these parameters root=UUID=fdcdfaf9-f530-4274-a064-f697b811d9f4 rw resume=/dev/nvme0n1p2 resume_offset=34816 drm.debug=0xe

I tried comparing Arch LTS 4.14.22 with dmc 1.26 and a custom Arch 4.15.6 with dmc 1.27. The LTS one resumes fine after hibernation but with errors. "requested Y/RGB source size 7680x4320 too big" is not there.
LTS dmesg:
https://pastebin.com/kA23prNc

custom dmesg:
https://pastebin.com/iTxu6Rh7

The same config is used for both, I am using TLP and powertop for power saving you think they might affect that?
Comment 11 amn-bas 2018-03-02 03:31:55 UTC
I updated the mesa driver to the latest version on Archlinux repos 17.3.6 and now booting with LTS kernel (4.14) resumes without any errors. With 4.15 I'm still getting a black screen and a bunch of errors. I noticed that with 4.15 the screen backlight flashes after resuming something like if I set the backlight to 100% then to 30% and it does that for 2-4 times.
Comment 12 Imre Deak 2018-03-02 13:20:53 UTC
(In reply to amn-bas from comment #11)
> I updated the mesa driver to the latest version on Archlinux repos 17.3.6
> and now booting with LTS kernel (4.14) resumes without any errors. With 4.15
> I'm still getting a black screen and a bunch of errors. I noticed that with
> 4.15 the screen backlight flashes after resuming something like if I set the
> backlight to 100% then to 30% and it does that for 2-4 times.

Could you provide a full dmesg for the 4.15 boot (booting with drm.debug=0xe and making sure the dmesg log buffer is big enough to contain the PM: hibernate/resume sequence too)?

It'd be great if you could also try
the drm-tip branch from git://anongit.freedesktop.org/drm-tip  .
Comment 13 amn-bas 2018-03-05 03:45:46 UTC
Created attachment 137788 [details]
dmesg custom 4.15 w/dmc 1.27
Comment 14 Imre Deak 2018-03-05 11:10:09 UTC
Created attachment 137791 [details] [review]
Fix hibernation with S0 target state

> Created attachment 137788 [details]
> dmesg custom 4.15 w/dmc 1.27

There's the following:
[   64.041878] Unexpected DBuf power power state (0x0000000a)

during resuming. One possibility is that hibernation happens with an S0 ACPI target state (or at least target state < S3) and because of that we won't reinit power domains during resume. That's a failed attempt on my part to fix this issue in an earlier patch. Could you try the attached fix on top of 4.15.6 to try it again (and attach a log)?

In the log there is also the
[   69.146901] [drm:skl_check_plane_surface [i915]] requested Y/RGB source size 7680x4320 too big (limit 8192x4096)

error, that one looks like user space asking for an invalid config and unrelated to the above.
Comment 15 amn-bas 2018-03-06 00:14:44 UTC
Created attachment 137805 [details]
patched 4.15.6 with dmc 1.27 and patch 137791

I also get a weird screen when I do 'systemctl hibernate' https://imgur.com/a/mBvzB
Comment 16 amn-bas 2018-03-06 00:24:32 UTC
(In reply to Imre Deak from comment #14)
> Created attachment 137791 [details] [review] [review]
> Fix hibernation with S0 target state
> 
> > Created attachment 137788 [details]
> > dmesg custom 4.15 w/dmc 1.27
> 
> There's the following:
> [   64.041878] Unexpected DBuf power power state (0x0000000a)
> 
> during resuming. One possibility is that hibernation happens with an S0 ACPI
> target state (or at least target state < S3) and because of that we won't
> reinit power domains during resume. That's a failed attempt on my part to
> fix this issue in an earlier patch. Could you try the attached fix on top of
> 4.15.6 to try it again (and attach a log)?
> 
The problem still occurs after applying the patch.

> In the log there is also the
> [   69.146901] [drm:skl_check_plane_surface [i915]] requested Y/RGB source
> size 7680x4320 too big (limit 8192x4096)
> 
> error, that one looks like user space asking for an invalid config and
> unrelated to the above.

This one is strange because I don't see that with 4.14, it shows only with 4.15.
Comment 17 Imre Deak 2018-03-06 07:38:46 UTC
Created attachment 137812 [details] [review]
Fix hibernation/debug

(In reply to amn-bas from comment #16)
> The problem still occurs after applying the patch.

Could you try the attached debug patch providing a log?
Comment 18 amn-bas 2018-03-08 16:09:29 UTC
Created attachment 137899 [details]
4.15 with debug patch
Comment 19 Imre Deak 2018-03-08 17:45:58 UTC
(In reply to amn-bas from comment #18)
> Created attachment 137899 [details]
> 4.15 with debug patch

I don't think you are using the driver with my patched applied:

At least before the following trace

[  437.790429] Call Trace:
[  437.790444]  intel_modeset_setup_hw_state+0x1f1/0xfc0 [i915]
[  437.790459]  ? intel_update_cdclk+0x48/0x90 [i915]
[  437.790473]  __intel_display_resume+0x1e/0xc0 [i915]
[  437.790487]  intel_display_resume+0xe3/0x110 [i915]
[  437.790489]  ? _raw_spin_lock_irqsave+0x25/0x50
[  437.790491]  ? pci_pm_suspend_noirq+0x1a0/0x1a0
[  437.790500]  i915_drm_resume+0xe4/0x180 [i915]

I should see a

[drm:i915_drm_suspend [i915]] suspend

message. But I can't see in your log any of the debug messages that I added in my debug patch. Could be that you are using the wrong kernel (you can cross-check your booted kernel's version with your git repo by enabling CONFIG_LOCALVERSION_AUTO) or you didn't update your initramfs.
Comment 20 amn-bas 2018-03-09 02:46:26 UTC
Created attachment 137920 [details]
dmesg patched

I'm really sorry I'm using arch build system to build the kernel I've added the last two patches but I forgot to apply them in the build file so I was building the kernel without the last two patches LOL. However, after building it correctly the patch worked and I was able to resume from hibernation successfully.
Comment 21 Imre Deak 2018-03-09 08:03:20 UTC
(In reply to amn-bas from comment #20)
> Created attachment 137920 [details]
> dmesg patched
> 
> I'm really sorry I'm using arch build system to build the kernel I've added
> the last two patches but I forgot to apply them in the build file so I was
> building the kernel without the last two patches LOL. However, after
> building it correctly the patch worked and I was able to resume from
> hibernation successfully.

Ok, thanks for testing it, I'll follow up with the fix and close this once it's merged.
Comment 22 Imre Deak 2018-03-23 18:56:26 UTC
Fix merged to drm-tip.
Comment 23 Jani Saarinen 2018-04-03 10:35:20 UTC
Please re-open if problems still.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.