Bug 67526

Summary: [HSW ULT/desktop bisected] I-G-T testdisplay -a causes screen black
Product: DRI Reporter: cancan,feng <cancan.feng>
Component: DRM/IntelAssignee: Daniel Vetter <daniel>
Status: CLOSED FIXED QA Contact: Intel GFX Bugs mailing list <intel-gfx-bugs>
Severity: critical    
Priority: highest CC: huax.lu, przanoni
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments:
Description Flags
System boot messages
none
drm/i915: remove intel_dp NULL deref on psr_update.
none
Avoid the NULL deref none

Description cancan,feng 2013-07-30 08:58:44 UTC
Created attachment 83281 [details]
System boot messages

Environment:
---------------------
Kernel: (drm-intel-next-queued)fae5cbff3e3e4097de2e76178d462b90626c2bdb
Author: Daniel Vetter <daniel.vetter@ffwll.ch>
Date:   Sun Jul 21 21:37:09 2013 +0200

    drm/i915: clean up crtc timings computation

Description:
--------------------
This HSW ULT has eDP and miniHDMI. With eDP and miniHDMI plugged in, I execute ./testdisplay -a. 

[root@x-hswu32 tests]# ./testdisplay -a
CRTS(3):[0]  1920x1080 60 1920 1966 1996 2080 1080 1082 1086 1112 0xa 0x48 138780   <--- this is eDP's mode.
CRTS(3):[0]  1920x1080 60 1920 2008 2052 2200 1080 1084 1089 1125 0x5 0x48 148500   <--- this is HDMI's mode, both eDP and HDMI screen will turn to black. 

In addition, In my bisecting, I found that for some bad commits, when screen turns to black, system can't be accessed by ssh. But there are some commits can be accessed. Here I restrict this issue to "black screen" and get the bisect info:

4906557eb37b7fef84fad4304acef6dedf919880 is the first bad commit
commit 4906557eb37b7fef84fad4304acef6dedf919880
Author: Rodrigo Vivi <rodrigo.vivi@gmail.com>
Date:   Thu Jul 11 18:45:05 2013 -0300

    drm/i915: Hook PSR functionality

    PSR must be enabled after transcoder and port are running.
    And it is only available for HSW.

    v2: move enable/disable to intel_ddi
    v3: The spec suggests PSR should be disabled even before backlight (by pzanoni)
    v4: also disabling and enabling whenever panel is disabled/enabled.
    v5: make it last patch to avoid breaking whenever bisecting. So calling for
        update and force exit came to this patch along with enable/disable calls.
    v6: Remove unused and unecessary psr_enable/disable calls, as notice by Paulo.

    CC: Paulo Zanoni <paulo.r.zanoni@intel.com>
    Signed-off-by: Rodrigo Vivi <rodrigo.vivi@gmail.com>
    [danvet: Drop the psr exit code in the busy ioctl since I didn't merge
    that part of the infrastructure yet - it needs more thought.]
    Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>

:040000 040000 df6a542740e60b0ae2ea72ea72caf0e3aed17869 5c326989834a202dd43030eb4b6d69e1eb804ba2 

M      drivers
Comment 1 Paulo Zanoni 2013-07-30 14:52:10 UTC
(Reassigning to Rodrigo)

From the log, it looks like you're doing this with PSR disabled, which may make it easier to debug.
Comment 2 cancan,feng 2013-07-31 01:55:19 UTC
This issue also happens on HSW desktop.
Comment 3 Chris Wilson 2013-08-02 07:08:13 UTC
*** Bug 67609 has been marked as a duplicate of this bug. ***
Comment 4 Chris Wilson 2013-08-02 07:13:06 UTC
*** Bug 67236 has been marked as a duplicate of this bug. ***
Comment 5 Chris Wilson 2013-08-02 07:21:06 UTC
NULL crtc deref in intel_edp_psr_match_conditions()
Comment 6 Rodrigo Vivi 2013-08-02 19:18:39 UTC
Created attachment 83550 [details] [review]
drm/i915: remove intel_dp NULL deref on psr_update.

I couldn't find any crtc null deref and to be honest have no idea what can be happening here.

But this null deref at intel_dp shouldn't be here, so this is my best guess for now.

Please test and let me know if this fix the issue.

btw: I'm going to work on a psr rework to let it tied to pipe_config now.
Comment 7 Chris Wilson 2013-08-02 19:40:48 UTC
Created attachment 83551 [details] [review]
Avoid the NULL deref
Comment 8 Ben Widawsky 2013-08-03 21:27:47 UTC
Patch has been merged to the temporary dinq branch:

http://cgit.freedesktop.org/~bwidawsk/drm-intel/commit/?h=drm-intel-next-queued&id=2178d41e557267cbb54dfef1353be31bc60b2245
Comment 9 Daniel Vetter 2013-08-04 20:44:29 UTC
Fix is merged into the official -next branch as:

commit cd234b0bfd5ab012e42274b24aae420fa1823d58
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Fri Aug 2 20:39:49 2013 +0100

    drm/i915: Do not dereference NULL crtc or fb until after checking
Comment 10 Jari Tahvanainen 2016-10-07 05:44:12 UTC
Closing verified+fixed.

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.