When asserting the switch to the kernel context is complete, we know
that the requests should also have been retired. We can assert that this
is so in order to give us some more insight into the state of affairs
should we ever see a bug along this path, such as:

<4>[  206.836931] WARN_ON(dev_priv->gt.awake)
<4>[  206.836982] WARNING: CPU: 1 PID: 105 at 
drivers/gpu/drm/i915/i915_gem.c:4966 i915_gem_suspend+0x10b/0x130 [i915]
<4>[  206.836983] Modules linked in: vgem snd_hda_codec_analog 
snd_hda_codec_generic i915 snd_hda_intel snd_hda_codec snd_hwdep coretemp 
snd_hda_core snd_pcm lpc_ich mei_me e1000e mei
<4>[  206.836992] CPU: 1 PID: 105 Comm: kworker/u16:7 Tainted: G     U          
 4.16.0-rc6-g94f5d9189e61-nodebug_1+ #1
<4>[  206.836993] Hardware name: Dell Inc. OptiPlex 755                 
/0PU052, BIOS A08 02/19/2008
<4>[  206.836997] Workqueue: events_unbound async_run_entry_fn
<4>[  206.837017] RIP: 0010:i915_gem_suspend+0x10b/0x130 [i915]
<4>[  206.837018] RSP: 0000:ffffada54037fd60 EFLAGS: 00010282
<4>[  206.837019] RAX: 000000000000001b RBX: ffff9901f361faa8 RCX: 
0000000000000001
<4>[  206.837020] RDX: 0000000080000001 RSI: 0000000000000092 RDI: 
00000000ffffffff
<4>[  206.837021] RBP: ffff9901f3618000 R08: 000000000000001b R09: 
000000000000001b
<4>[  206.837022] R10: 0000000000000040 R11: 00000000001c8b58 R12: 
ffff9901f361d648
<4>[  206.837023] R13: 0000000000000000 R14: 0000000000000002 R15: 
ffffffffa80c42c9
<4>[  206.837024] FS:  0000000000000000(0000) GS:ffff9901fd240000(0000) 
knlGS:0000000000000000
<4>[  206.837025] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
<4>[  206.837025] CR2: 00005613fbbfef76 CR3: 0000000078710000 CR4: 
00000000000006e0
<4>[  206.837026] Call Trace:
<4>[  206.837046]  i915_drm_suspend+0x62/0x160 [i915]
<4>[  206.837050]  pci_pm_suspend+0x7a/0x1d0
<4>[  206.837052]  ? pci_pm_suspend_noirq+0x290/0x290
<4>[  206.837054]  dpm_run_callback+0x4d/0x180
<4>[  206.837055]  __device_suspend+0xf6/0x4b0
<4>[  206.837057]  async_suspend+0x1a/0x90
<4>[  206.837058]  async_run_entry_fn+0x31/0x140
<4>[  206.837060]  process_one_work+0x1c8/0x3d0
<4>[  206.837062]  worker_thread+0x47/0x3f0
<4>[  206.837064]  kthread+0xf5/0x130
<4>[  206.837066]  ? process_one_work+0x3d0/0x3d0
<4>[  206.837067]  ? _kthread_create_on_node+0x40/0x40
<4>[  206.837069]  ret_from_fork+0x35/0x40
<4>[  206.837071] Code: 89 ef e8 89 fe ff ff 48 89 ef e8 31 e7 fd ff 48 83 c4 
08 31 c0 5b 5d c3 48 c7 c6 7f b5 56 c0 48 c7 c7 1c b5 56 c0 e8 b5 1b bc e6 <0f> 
0b eb bc 48 c7 c6 a0 85 57 c0 48 c7 c7 1c b5 56 c0 e8 9e 1b
<4>[  206.837115] WARNING: CPU: 1 PID: 105 at 
drivers/gpu/drm/i915/i915_gem.c:4966 i915_gem_suspend+0x10b/0x130 [i915]

Signed-off-by: Chris Wilson <ch...@chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/i915_gem.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 9650a7b10c5f..9b6f995b658f 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -4894,6 +4894,8 @@ static void assert_kernel_context_is_current(struct 
drm_i915_private *i915)
                
GEM_BUG_ON(__i915_gem_active_peek(&engine->timeline->last_request));
                GEM_BUG_ON(engine->last_retired_context != kernel_context);
        }
+
+       GEM_BUG_ON(i915->gt.active_requests);
 }
 
 void i915_gem_sanitize(struct drm_i915_private *i915)
-- 
2.16.3

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reply via email to