Bug 79354

Summary: [BDW bisected]igt/kms_flip subcases cause "WARNING: CPU: 0 PID: 4846 at drivers/gpu/drm/i915/intel_display.c:3315 intel_crtc_wait_for_pending_flips+0xe6/0x13a [i915]()"
Product: DRI Reporter: Guo Jinxian <jinxianx.guo>
Component: DRM/IntelAssignee: Ville Syrjala <ville.syrjala>
Status: CLOSED FIXED QA Contact: Intel GFX Bugs mailing list <intel-gfx-bugs>
Severity: blocker    
Priority: highest CC: intel-gfx-bugs, james.ausmus, lei.a.liu, yi.sun
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments:
Description Flags
dmesg
none
Don't do vblank wait unconditionally
none
[PATCH] drm/i915: Wait for vblank after enabling the primary plane on BDW
none
dmesg none

Description Guo Jinxian 2014-05-28 07:13:25 UTC
Created attachment 100009 [details]
dmesg

==System Environment==
--------------------------
Regression: Yes. 
The cases only failed, didn't have CallTrace before.

Non-working platforms: BDW

==kernel==
--------------------------
origin/drm-intel-nightly: 9f53d4f6f55aa0c037f299dbe2986eec9151be9b(fails)
    drm-intel-nightly: 2014y-05m-28d-00h-00m-47s integration manifest
origin/drm-intel-next-queued: 38d811545c61cf188beac860615a08fb32f73eb1(fails)
    drm/i915/vlv: add pll assertion when disabling DPIO common well   
origin/drm-intel-fixes: d23db88c3ab233daed18709e3a24d6c95344117f(works)
    drm/i915: Prevent negative relocation deltas from wrapping

==Bug detailed description==
-----------------------------
igt/kms_flip subcases cause "WARNING: CPU: 0 PID: 4846 at drivers/gpu/drm/i915/intel_display.c:3315 intel_crtc_wait_for_pending_flips+0xe6/0x13a [i915]()"

Dmesg shows:
 WARNING: CPU: 0 PID: 4846 at drivers/gpu/drm/i915/intel_display.c:3315 intel_crtc_wait_for_pending_flips+0xe6/0x13a [i915]()
[  971.797703] Modules linked in: dm_mod snd_hda_codec_hdmi iTCO_wdt iTCO_vendor_support ppdev snd_hda_intel snd_hda_controller snd_hda_codec snd_hwdep snd_pcm pcspkr i2c_i801 lpc_ich mfd_core snd_timer snd soundcore battery parport_pc parport ac acpi_cpufreq i915 video button drm_kms_helper drm
[  971.797706] CPU: 0 PID: 4846 Comm: kms_flip Tainted: G        W     3.15.0-rc7_drm-intel-nightly_9f53d4_20140528+ #3050
[  971.797709]  0000000000000000 0000000000000009 ffffffff8172443b 0000000000000000
[  971.797711]  ffffffff8103516a 0000000000000246 ffffffffa009fc48 0000000000000283
[  971.797712]  0000000000000000 ffff880149e97000 ffff880145690000 ffff8800aa8fe800
[  971.797713] Call Trace:
[  971.797718]  [<ffffffff8172443b>] ? dump_stack+0x41/0x51
[  971.797721]  [<ffffffff8103516a>] ? warn_slowpath_common+0x73/0x8b
[  971.797732]  [<ffffffffa009fc48>] ? intel_crtc_wait_for_pending_flips+0xe6/0x13a [i915]
[  971.797741]  [<ffffffffa009fc48>] ? intel_crtc_wait_for_pending_flips+0xe6/0x13a [i915]
[  971.797744]  [<ffffffff8105f5fb>] ? __wake_up_sync+0x7/0x7
[  971.797755]  [<ffffffffa00a7c5d>] ? intel_crtc_set_config+0x72d/0xa17 [i915]
[  971.797765]  [<ffffffffa000bd4f>] ? drm_mode_set_config_internal+0x48/0xad [drm]
[  971.797768]  [<ffffffffa0049abe>] ? drm_fb_helper_restore_fbdev_mode+0x8f/0xa8 [drm_kms_helper]
[  971.797771]  [<ffffffffa0049e88>] ? drm_fb_helper_set_par+0x43/0x6b [drm_kms_helper]
[  971.797775]  [<ffffffff81319cb5>] ? fb_set_var+0x246/0x32c
[  971.797777]  [<ffffffff810daf3a>] ? kmem_cache_alloc+0x23/0xac
[  971.797780]  [<ffffffff81354ad2>] ? check_tty_count+0x1c/0x93
[  971.797782]  [<ffffffff813120ca>] ? fbcon_blank+0x71/0x230
[  971.797785]  [<ffffffff8136729b>] ? do_unblank_screen+0xed/0x166
[  971.797788]  [<ffffffff8135f91f>] ? vt_ioctl+0x4b0/0xf7f
[  971.797790]  [<ffffffff8135806b>] ? tty_ioctl+0x8b5/0x924
[  971.797793]  [<ffffffff810ece7a>] ? do_filp_open+0x2d/0x75
[  971.797796]  [<ffffffff810eeb83>] ? do_vfs_ioctl+0x3ec/0x435
[  971.797799]  [<ffffffff810f6521>] ? __fd_install+0x15/0x43
[  971.797802]  [<ffffffff810eec15>] ? SyS_ioctl+0x49/0x78
[  971.797805]  [<ffffffff8172ec22>] ? system_call_fastpath+0x16/0x1b


==Reproduce steps==
---------------------------- 
1. ./kms_flip --run-subtest vblank-vs-hang-interruptible

==Bisect results==
----------------------------
fe5b1886a78d92e0e4681e449725714e947dfc58 is the first bad commit
commit fe5b1886a78d92e0e4681e449725714e947dfc58
Author:     Imre Deak <imre.deak@intel.com>
AuthorDate: Mon May 12 18:35:05 2014 +0300
Commit:     Daniel Vetter <daniel.vetter@ffwll.ch>
CommitDate: Thu May 22 21:53:27 2014 +0200

    drm/i915: disable GT power saving early during system suspend

    Atm, we disable GT power saving during the end of the suspend sequence
    in i915_save_state(). Doing the disabling at that point seems arbitrary.
    One reason to disable it early though is to have a quiescent HW state
    before we do anything else (for example save registers). So move the
    disabling earlier, which also takes care canceling of the deferred RPS
    enabling work done by intel_disable_gt_powersave().

    Note that after the move we'll call intel_disable_gt_powersave() only
    in case modeset is enabled, but that's anyway the only case where we
    have it enabled in the first place.

    Signed-off-by: Imre Deak <imre.deak@intel.com>
    Reviewed-by: Robert Beckett <robert.beckett@intel.com>
    Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Comment 1 Imre Deak 2014-05-28 08:49:40 UTC
This commit should affect only the system suspend path and that isn't exercised according to the dmesg. So maybe this bug is not 100% reproducible and you need to try each bisect point before this commit multiple times.
Comment 2 Imre Deak 2014-05-28 13:11:47 UTC
Ville might have a fix for this, so assigning it to him.
Comment 3 Ville Syrjala 2014-05-28 13:15:34 UTC
Please test:
http://patchwork.freedesktop.org/patch/26649/
Comment 4 liulei 2014-05-29 07:31:52 UTC
(In reply to comment #3)
> Please test:
> http://patchwork.freedesktop.org/patch/26649/

The patch doesn't work.
-------------------------------
[  181.830550] WARNING: CPU: 1 PID: 4159 at drivers/gpu/drm/i915/intel_display.c:3315 intel_crtc_wait_for_pending_flips+0xe6/0x13a [i915]()
[  181.830564] Modules linked in: dm_mod snd_hda_codec_hdmi iTCO_wdt iTCO_vendor_support ppdev pcspkr i2c_i801 snd_hda_intel lpc_ich snd_hda_controller mfd_core snd_hda_codec snd_hwdep snd_pcm snd_timer snd soundcore battery parport_pc parport ac acpi_cpufreq i915 video button drm_kms_helper drm
[  181.830567] CPU: 1 PID: 4159 Comm: kms_flip Not tainted 3.15.0-rc3_prts_33d59c_20140529 #2
[  181.830570]  0000000000000000 0000000000000009 ffffffff81723690 0000000000000000
[  181.830572]  ffffffff8103517a 0000000000000246 ffffffffa009fb10 0000000000000216
[  181.830573]  0000000000000000 ffff880148d90000 ffff880144600000 ffff8800a6c27000
Comment 5 Guang Yang 2014-06-05 03:25:11 UTC
update priority because this impact tons of subcases and block QA's work.
Comment 6 Daniel Vetter 2014-06-05 06:46:41 UTC
Created attachment 100438 [details] [review]
Don't do vblank wait unconditionally

Please test the attached patch on all affected testcases, thanks.
Comment 7 Daniel Vetter 2014-06-05 06:47:08 UTC
Ignore this, wrong bug.
Comment 8 Ville Syrjala 2014-06-23 20:33:03 UTC
Created attachment 101610 [details] [review]
[PATCH] drm/i915: Wait for vblank after enabling the primary plane on BDW

Looks like this turned out to be a bdw specific issue after all. The flip done interrupt seems to a bit broken on bdw. This patch should cure it.
Comment 9 Guo Jinxian 2014-06-24 06:15:08 UTC
Created attachment 101638 [details]
dmesg

(In reply to comment #8)
> Created attachment 101610 [details] [review] [review]
> [PATCH] drm/i915: Wait for vblank after enabling the primary plane on BDW
> 
> Looks like this turned out to be a bdw specific issue after all. The flip
> done interrupt seems to a bit broken on bdw. This patch should cure it.

The bug unable to reproduce with this patch.
Comment 10 Jani Nikula 2014-06-30 10:12:50 UTC
commit 33c3b0d19184cb11bfe8cf8e552918650f81f767
Author: Ville Syrjälä <ville.syrjala@linux.intel.com>
Date:   Tue Jun 24 13:59:28 2014 +0300

    drm/i915: Wait for vblank after enabling the primary plane on BDW
Comment 11 Guo Jinxian 2014-07-02 08:01:18 UTC
Verified on latest -nightly(9bfcb9dda09b60e9b44c21cf6277224c56450184).
Comment 12 Jari Tahvanainen 2016-10-13 08:27:01 UTC
Closing verified+fixed. Fixed by commit 33c3b0d.

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.