Bug 111594 - [guc/huc] Deep Package C-states never reached after laptop screen is turned off
Summary: [guc/huc] Deep Package C-states never reached after laptop screen is turned off
Status: RESOLVED FIXED
Alias: None
Product: DRI
Classification: Unclassified
Component: DRM/Intel (show other bugs)
Version: unspecified
Hardware: x86-64 (AMD64) Linux (All)
: high major
Assignee: Don Hiatt
QA Contact: Intel GFX Bugs mailing list
URL:
Whiteboard: Triaged, ReadyForDev
Keywords:
Depends on:
Blocks:
 
Reported: 2019-09-09 07:34 UTC by kitestramuort
Modified: 2019-11-16 10:09 UTC (History)
5 users (show)

See Also:
i915 platform: KBL
i915 features: display/eDP, display/FBC, firmware/guc, firmware/huc, power/runtime PM


Attachments
dmesg (159.16 KB, text/plain)
2019-09-09 07:34 UTC, kitestramuort
no flags Details
powertop before (11.37 KB, text/plain)
2019-09-09 07:35 UTC, kitestramuort
no flags Details
powertop after (11.37 KB, text/x-log)
2019-09-09 07:35 UTC, kitestramuort
no flags Details
turbostat before (16.75 KB, text/plain)
2019-09-09 07:36 UTC, kitestramuort
no flags Details
turbostat after (11.47 KB, text/plain)
2019-09-09 07:36 UTC, kitestramuort
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description kitestramuort 2019-09-09 07:34:44 UTC
Created attachment 145301 [details]
dmesg

Hardware is a laptop with a Core i5 8250U and Intel GFX 620 running Coreboot. 

# turbostat --show Pkg%pc8
Pkg%pc8
80.72
80.72

# xset dpms force off

wait a minute or so, then turn the screen back on

# turbostat --show Pkg%pc8
Pkg%pc8
0.00
0.00

Powertop also confirms this. PC states 2 and below are never reached.

All 5.3.0-RCs have this, 5.2.x all work well.
Comment 1 kitestramuort 2019-09-09 07:35:20 UTC
Created attachment 145302 [details]
powertop before
Comment 2 kitestramuort 2019-09-09 07:35:38 UTC
Created attachment 145303 [details]
powertop after
Comment 3 kitestramuort 2019-09-09 07:36:00 UTC
Created attachment 145304 [details]
turbostat before
Comment 4 kitestramuort 2019-09-09 07:36:38 UTC
Created attachment 145305 [details]
turbostat after
Comment 5 Lakshmi 2019-09-09 07:46:30 UTC
> All 5.3.0-RCs have this, 5.2.x all work well.
A bisect will help us to find clues. Can you bisect?
Comment 6 kitestramuort 2019-09-09 08:46:51 UTC
I'm afraid I can't :-/
Comment 7 kitestramuort 2019-09-16 13:46:17 UTC
5.3 final also has this. Tried with a Skylake laptop this time (Xps15, 6700HQ). Could it be firmware related, 5.3 uses a different GuC.
Comment 8 Radosław Szwichtenberg 2019-09-16 14:15:32 UTC
Could you please try with i915.enable_guc=0 and let us know if behaviour is different?
Comment 9 kitestramuort 2019-09-16 14:54:42 UTC
Nailed it! No problem with i915.enable_guc=0 on both machines.

Thanks.
Comment 10 Lakshmi 2019-09-16 15:27:26 UTC
Thanks for the feedback.(In reply to Radosław Szwichtenberg from comment #8)
> Could you please try with i915.enable_guc=0 and let us know if behaviour is
> different?

(In reply to kitestramuort from comment #9)
> Nailed it! No problem with i915.enable_guc=0 on both machines.
> 
> Thanks.

Thanks for the feedback.
Comment 11 sujaritha.sundaresan 2019-09-20 20:45:48 UTC
I'm currently assessing this bug. But it looks to be a firmware problem.
Comment 12 Don Hiatt 2019-10-25 17:01:14 UTC
This appears to be the same issue as fdo#111623. I have submitted a patch https://patchwork.freedesktop.org/patch/337552/ that is waiting for a review.
Comment 13 Kenneth C 2019-10-29 13:31:02 UTC
(In reply to Don Hiatt from comment #12)
> This appears to be the same issue as fdo#111623. I have submitted a patch
> https://patchwork.freedesktop.org/patch/337552/ that is waiting for a review.

Your patch fixes this issue for me; I can get rc6 states on a CoffeeLake UHD620 after a resume now.
Comment 14 kitestramuort 2019-10-29 16:49:31 UTC
Doesn't fix it for me on KBL. 
The patch fixes the problem when I force the screen off, not when the laptop resumes from suspend.

After suspend I have:

GFX%rc6
5.45
5.45

Pkg%pc8
0.00
0.00
Comment 15 Don Hiatt 2019-10-29 17:11:44 UTC
(In reply to kitestramuort from comment #14)
> Doesn't fix it for me on KBL. 
> The patch fixes the problem when I force the screen off, not when the laptop
> resumes from suspend.
> 
> After suspend I have:
> 
> GFX%rc6
> 5.45
> 5.45
> 
> Pkg%pc8
> 0.00
> 0.00

Suspend is what I'm using for this on kbl. I'll be posting a new patch later today and will update with the url. Are you changing the guc_enable without rebooting? (If so, check for error messages in dmesg). 

Can you please do fresh reboot and then post the output of this commands along with the dmesg. Thank you.

modprobe i915 enable_guc=3

turbostat --quiet --show CPU%c7,GFX%rc6,Totl%C0,Any%C0,GFX%C0 sleep 10

rtcwake -s 30 -m disk

turbostat --quiet --show CPU%c7,GFX%rc6,Totl%C0,Any%C0,GFX%C0 sleep 10
Comment 16 kitestramuort 2019-10-29 19:37:22 UTC
i915 is compiled in, along with the required firmware.

Finished loading DMC firmware i915/kbl_dmc_ver1_04.bin (v1.4)
[    0.264710] [drm] HuC: Loaded firmware i915/kbl_huc_ver02_00_1810.bin (version 2.0)
[    0.276705] [drm] GuC: Loaded firmware i915/kbl_guc_32.0.3.bin (version 32.0)
[    0.284788] [drm] CT: enabled
[    0.305613] [drm] Initialized i915 1.6.0 20190619 for 0000:00:02.0 on minor 0

# turbostat --quiet --show CPU%c7,GFX%rc6,Totl%C0,Any%C0,GFX%C0 sleep 10
10.004035 sec
CPU%c7	GFX%rc6	Totl%C0	Any%C0	GFX%C0
96.69	99.06	4.74	4.13	0.32
95.04	99.06	4.74	4.13	0.32
97.03
97.29
97.41

# rtcwake -s 30 -m disk


# turbostat --quiet --show CPU%c7,GFX%rc6,Totl%C0,Any%C0,GFX%C0 sleep 10
10.002372 sec
CPU%c7	GFX%rc6	Totl%C0	Any%C0	GFX%C0
96.35	5.20	7.43	6.78	80.83
91.77	5.20	7.43	6.78	80.83
99.09
96.83
97.71

The dreadful 5.20...
After that...
# turbostat --show Pkg%pc8
Pkg%pc8
0.00
0.00
Comment 17 Don Hiatt 2019-10-29 20:11:15 UTC
(In reply to kitestramuort from comment #16)
> i915 is compiled in, along with the required firmware.
> 
> Finished loading DMC firmware i915/kbl_dmc_ver1_04.bin (v1.4)
> [    0.264710] [drm] HuC: Loaded firmware i915/kbl_huc_ver02_00_1810.bin
> (version 2.0)
> [    0.276705] [drm] GuC: Loaded firmware i915/kbl_guc_32.0.3.bin (version
> 32.0)
> [    0.284788] [drm] CT: enabled
> [    0.305613] [drm] Initialized i915 1.6.0 20190619 for 0000:00:02.0 on
> minor 0
> 
> # turbostat --quiet --show CPU%c7,GFX%rc6,Totl%C0,Any%C0,GFX%C0 sleep 10
> 10.004035 sec
> CPU%c7	GFX%rc6	Totl%C0	Any%C0	GFX%C0
> 96.69	99.06	4.74	4.13	0.32
> 95.04	99.06	4.74	4.13	0.32
> 97.03
> 97.29
> 97.41
> 
> # rtcwake -s 30 -m disk
> 
> 
> # turbostat --quiet --show CPU%c7,GFX%rc6,Totl%C0,Any%C0,GFX%C0 sleep 10
> 10.002372 sec
> CPU%c7	GFX%rc6	Totl%C0	Any%C0	GFX%C0
> 96.35	5.20	7.43	6.78	80.83
> 91.77	5.20	7.43	6.78	80.83
> 99.09
> 96.83
> 97.71
> 
> The dreadful 5.20...
> After that...
> # turbostat --show Pkg%pc8
> Pkg%pc8
> 0.00
> 0.00
What value of guc_enable are you giving? Also, this is what it looks like on KBL with drm-tip with the proper firmware.

[  213.513852] [drm] Finished loading DMC firmware i915/kbl_dmc_ver1_04.bin (v1.4)
[  213.573467] [drm] GuC communication enabled
[  213.578063] i915 0000:00:02.0: GuC firmware i915/kbl_guc_33.0.0.bin version 33.0 submission:disabled
[  213.578065] i915 0000:00:02.0: HuC firmware i915/kbl_huc_4.0.0.bin version 4.0 authenticated:yes
[  213.579030] [drm] Initialized i915 1.6.0 20191007 for 0000:00:02.0 on minor 0
[  213.581581] ACPI: Video Device [GFX0] (multi-head: yes  rom: no  post: no)
Comment 18 Don Hiatt 2019-10-29 20:14:11 UTC
I'm working on a better way to determine if GuC submission is active per review comment, but v2 of the patch is: https://patchwork.freedesktop.org/patch/338019/
Comment 19 kitestramuort 2019-10-29 20:29:37 UTC
(In reply to Don Hiatt from comment #17)
> What value of guc_enable are you giving? Also, this is what it looks like on
> KBL with drm-tip with the proper firmware.
> 
> [  213.513852] [drm] Finished loading DMC firmware i915/kbl_dmc_ver1_04.bin
> (v1.4)
> [  213.573467] [drm] GuC communication enabled
> [  213.578063] i915 0000:00:02.0: GuC firmware i915/kbl_guc_33.0.0.bin
> version 33.0 submission:disabled
> [  213.578065] i915 0000:00:02.0: HuC firmware i915/kbl_huc_4.0.0.bin
> version 4.0 authenticated:yes
> [  213.579030] [drm] Initialized i915 1.6.0 20191007 for 0000:00:02.0 on
> minor 0
> [  213.581581] ACPI: Video Device [GFX0] (multi-head: yes  rom: no  post: no)

I'm on the current stable kernel, 5.3.8. enable_guc is -1, which on this platform should be equivalent to 2. 5.3 only accepts guc 32.0.3 and huc 02

[drm] HuC: Loaded firmware i915/kbl_huc_ver02_00_1810.bin (version 2.0)
[  116.266798] [drm] GuC: Loaded firmware i915/kbl_guc_32.0.3.bin (version 32.0)
[  116.266967] i915 0000:00:02.0: GuC firmware version 32.0
[  116.266968] i915 0000:00:02.0: GuC submission disabled
[  116.266969] i915 0000:00:02.0: HuC enabled
Comment 20 Don Hiatt 2019-10-29 20:33:25 UTC
(In reply to kitestramuort from comment #19)
> (In reply to Don Hiatt from comment #17)
> > What value of guc_enable are you giving? Also, this is what it looks like on
> > KBL with drm-tip with the proper firmware.
> > 
> > [  213.513852] [drm] Finished loading DMC firmware i915/kbl_dmc_ver1_04.bin
> > (v1.4)
> > [  213.573467] [drm] GuC communication enabled
> > [  213.578063] i915 0000:00:02.0: GuC firmware i915/kbl_guc_33.0.0.bin
> > version 33.0 submission:disabled
> > [  213.578065] i915 0000:00:02.0: HuC firmware i915/kbl_huc_4.0.0.bin
> > version 4.0 authenticated:yes
> > [  213.579030] [drm] Initialized i915 1.6.0 20191007 for 0000:00:02.0 on
> > minor 0
> > [  213.581581] ACPI: Video Device [GFX0] (multi-head: yes  rom: no  post: no)
> 
> I'm on the current stable kernel, 5.3.8. enable_guc is -1, which on this
> platform should be equivalent to 2. 5.3 only accepts guc 32.0.3 and huc 02
> 
> [drm] HuC: Loaded firmware i915/kbl_huc_ver02_00_1810.bin (version 2.0)
> [  116.266798] [drm] GuC: Loaded firmware i915/kbl_guc_32.0.3.bin (version
> 32.0)
> [  116.266967] i915 0000:00:02.0: GuC firmware version 32.0
> [  116.266968] i915 0000:00:02.0: GuC submission disabled
> [  116.266969] i915 0000:00:02.0: HuC enabled

Yes, enable_guc = -1 is equivalent to 2. That said, I've been debugging this issue with drmtip and the latest firmware. So that seems to be the reason it is working for others and not you. BTW, just to confirm, you did apply the patch?
Comment 21 Chris Wilson 2019-11-16 10:09:35 UTC
commit 82e0c5bbd6eb1d274b5a3e519ff0ab91f1f8e537 (HEAD -> drm-intel-next-queued, drm-intel/drm-intel-next-queued)
Author: Don Hiatt <don.hiatt@intel.com>
Date:   Fri Nov 15 15:15:38 2019 -0800

    drm/i915/guc: Skip suspend/resume GuC action on platforms w/o GuC submission
    
    On some platforms (e.g. KBL) that do not support GuC submission, but
    the user enabled the GuC communication (e.g for HuC authentication)
    calling the GuC EXIT_S_STATE action results in lose of ability to
    enter RC6. We can remove the GuC suspend/resume entirely as we do
    not need to save the GuC submission status.
    
    Add intel_guc_submission_is_enabled() function to determine if
    GuC submission is active.
    
    v2: Do not suspend/resume the GuC on platforms that do not support
        Guc Submission.
    v3: Fix typo, move suspend logic to remove goto.
    v4: Use intel_guc_submission_is_enabled() to check GuC submission
        status.
    v5: No need to look at engine to determine if submission is enabled.
        Squash fix + intel_guc_submission_is_enabled() patch into one.
    v6: Move resume check into intel_guc_resume() for symmetry.
        Fix commit Fixes tag.
    
    Reported-by: KiteStramuort <kitestramuort@autistici.org>
    Reported-by: S. Zharkoff <s.zharkoff@gmail.com>
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=111594
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=111623
    Fixes: ffd5ce22faa4 ("drm/i915/guc: Updates for GuC 32.0.3 firmware")
    Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
    Cc: Daniele Ceralo Spurio <daniele.ceraolospurio@intel.com>
    Cc: Stuart Summers <stuart.summers@intel.com>
    Cc: Chris Wilson <chris@chris-wilson.co.uk>
    Tested-by: Tomas Janousek <tomi@nomi.cz>
    Signed-off-by: Don Hiatt <don.hiatt@intel.com>
    Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
    Link: https://patchwork.freedesktop.org/patch/msgid/20191115231538.1249-1-don.hiatt@intel.com


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.