linux/drivers/gpu/drm/i915
Daniel Vetter 9db529aac9 drm/i915: More surgically unbreak the modeset vs reset deadlock
There's no reason to entirely wedge the gpu, for the minimal deadlock
bugfix we only need to unbreak/decouple the atomic commit from the gpu
reset. The simplest way to fix that is by replacing the
unconditional fence wait a the top of commit_tail by a wait which
completes either when the fences are done (normal case, or when a
reset doesn't need to touch the display state). Or when the gpu reset
needs to force-unblock all pending modeset states.

The lesser source of deadlocks is when we try to pin a new framebuffer
and run into a stall. There's a bunch of places this can happen, like
eviction, changing the caching mode, acquiring a fence on older
platforms. And we can't just break the depency loop and keep going,
the only way would be to break out and restart. But the problem with
that approach is that we must stall for the reset to complete before
we grab any locks, and with the atomic infrastructure that's a bit
tricky. The only place is the ioctl code, and we don't want to insert
code into e.g. the BUSY ioctl. Hence for that problem just create a
critical section, and if any code is in there, wedge the GPU. For the
steady-state this should never be a problem.

Note that in both cases TDR itself keeps working, so from a userspace
pov this trickery isn't observable. Users themselvs might spot a short
glitch while the rendering is catching up again, but that's still
better than pre-TDR where we've thrown away all the rendering,
including innocent batches. Also, this fixes the regression TDR
introduced of making gpu resets deadlock-prone when we do need to
touch the display.

One thing I noticed is that gpu_error.flags seems to use both our own
wait-queue in gpu_error.wait_queue, and the generic wait_on_bit
facilities. Not entirely sure why this inconsistency exists, I just
picked one style.

A possible future avenue could be to insert the gpu reset in-between
ongoing modeset changes, which would avoid the momentary glitch. But
that's a lot more work to implement in the atomic commit machinery,
and given that we only need this for pre-g4x hw, of questionable
utility just for the sake of polishing gpu reset even more on those
old boxes. It might be useful for other features though.

v2: Rebase onto 4.13 with a s/wait_queue_t/struct wait_queue_entry/.

v3: Really emabarrassing fixup, I checked the wrong bit and broke the
unbreak/wakeup logic.

v4: Also handle deadlocks in pin_to_display.

v5: Review from Michel:
- Fixup the BUILD_BUG_ON
- Don't forget about the overlay

Cc: Michel Thierry <michel.thierry@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Mika Kuoppala <mika.kuoppala@intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com> (v2)
Cc: Michel Thierry <michel.thierry@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20170808080828.23650-3-daniel.vetter@ffwll.ch
Reviewed-by: Michel Thierry <michel.thierry@intel.com>
2017-08-14 17:03:36 +02:00
..
gvt drm/i915/hsw+: Add has_fuses power well attribute 2017-07-27 09:38:53 +02:00
selftests drm/i915: Supply the engine-id for our mock_engine() 2017-08-10 12:18:35 +01:00
dvo_ch7xxx.c drm/i915/dvo: fix debug logging on unknown DID 2017-06-01 15:53:03 +03:00
dvo_ch7017.c drm/i915/lvds: Remove magic from PLL programming 2017-05-10 13:47:55 +03:00
dvo_ivch.c
dvo_ns2501.c
dvo_sil164.c
dvo_tfp410.c
dvo.h
i915_cmd_parser.c drm/i915: Redefine ptr_pack_bits() and friends 2017-05-17 13:38:04 +01:00
i915_debugfs.c drm/i915/cnl: Add slice and subslice information to debugfs. 2017-08-10 13:59:29 -07:00
i915_drv.c Merge airlied/drm-next into drm-intel-next-queued 2017-08-10 18:12:01 +02:00
i915_drv.h drm/i915: More surgically unbreak the modeset vs reset deadlock 2017-08-14 17:03:36 +02:00
i915_gem_batch_pool.c drm/i915: Reinstate reservation_object zapping for batch_pool objects 2017-06-14 14:06:22 +01:00
i915_gem_batch_pool.h
i915_gem_clflush.c drm/i915: Force CPU synchronisation even if userspace requests ASYNC 2017-07-27 09:39:00 +02:00
i915_gem_clflush.h drm/i915: Force CPU synchronisation even if userspace requests ASYNC 2017-07-27 09:39:00 +02:00
i915_gem_context.c drm/i915: Suppress switch_mm emission between the same aliasing_ppgtt 2017-08-12 16:50:12 +01:00
i915_gem_context.h drm/i915: Make i915_gem_context_mark_guilty() safe for unlocked updates 2017-07-27 09:38:47 +02:00
i915_gem_dmabuf.c drm/i915: Implement dma_buf_ops->kmap 2017-05-03 23:15:02 +01:00
i915_gem_evict.c drm/i915: Eliminate lots of iterations over the execobjects array 2017-06-16 16:54:05 +01:00
i915_gem_execbuffer.c drm/i915: Force CPU synchronisation even if userspace requests ASYNC 2017-07-27 09:39:00 +02:00
i915_gem_fence_reg.c
i915_gem_fence_reg.h
i915_gem_gtt.c drm/i915: Fix the kernel panic when using aliasing ppgtt 2017-07-07 11:05:53 +01:00
i915_gem_gtt.h drm/i915: pass the vma to insert_entries 2017-06-22 16:48:50 +01:00
i915_gem_internal.c drm/i915: Store i915_gem_object_is_coherent() as a bit next to cache-dirty 2017-06-16 14:52:27 +01:00
i915_gem_object.h drm/i915: Store a direct lookup from object handle to vma 2017-06-16 16:54:04 +01:00
i915_gem_render_state.c drm/i915: Perform an invalidate prior to executing golden renderstate 2017-08-08 14:53:50 +01:00
i915_gem_render_state.h
i915_gem_request.c drm/i915: Squelch reset messages during selftests 2017-07-27 09:38:57 +02:00
i915_gem_request.h Merge tag 'drm-intel-next-2017-07-17' of git://anongit.freedesktop.org/git/drm-intel into drm-next 2017-07-20 11:31:43 +10:00
i915_gem_shrinker.c drm/i915/shrinker: Wrap need_resched() inside preempt-disable 2017-08-04 13:11:39 +01:00
i915_gem_stolen.c drm/i915: More stolen quirking 2017-07-19 14:04:03 +02:00
i915_gem_tiling.c drm/i915: Fix logical inversion for gen4 quirking 2017-06-07 16:31:34 +03:00
i915_gem_timeline.c drm/i915: Squash repeated awaits on the same fence 2017-05-03 11:08:48 +01:00
i915_gem_timeline.h drm/i915: Rename intel_timeline.sync_seqno[] to .global_sync[] 2017-05-03 11:08:52 +01:00
i915_gem_userptr.c drm/i915: Wait upon userptr get-user-pages within execbuffer 2017-06-16 16:54:05 +01:00
i915_gem.c drm/i915: Call the unlocked version of i915_gem_object_get_pages() 2017-07-27 09:56:11 +02:00
i915_gem.h drm/i915: Squash repeated awaits on the same fence 2017-05-03 11:08:48 +01:00
i915_gpu_error.c drm/i915: Make i915_gem_context_mark_guilty() safe for unlocked updates 2017-07-27 09:38:47 +02:00
i915_guc_reg.h
i915_guc_submission.c drm/i915: Differentiate between sw write location into ring and last hw read 2017-06-19 10:52:34 +03:00
i915_ioc32.c
i915_irq.c drm/i915: More surgically unbreak the modeset vs reset deadlock 2017-08-14 17:03:36 +02:00
i915_memcpy.c
i915_mm.c
i915_oa_bdw.c drm/i915/perf: leave GDT_CHICKEN_BITS programming in configs 2017-08-03 18:18:44 +01:00
i915_oa_bdw.h drm/i915/perf: prune OA configs 2017-08-03 18:18:05 +01:00
i915_oa_bxt.c drm/i915/perf: leave GDT_CHICKEN_BITS programming in configs 2017-08-03 18:18:44 +01:00
i915_oa_bxt.h drm/i915/perf: prune OA configs 2017-08-03 18:18:05 +01:00
i915_oa_chv.c drm/i915/perf: leave GDT_CHICKEN_BITS programming in configs 2017-08-03 18:18:44 +01:00
i915_oa_chv.h drm/i915/perf: prune OA configs 2017-08-03 18:18:05 +01:00
i915_oa_glk.c drm/i915/perf: leave GDT_CHICKEN_BITS programming in configs 2017-08-03 18:18:44 +01:00
i915_oa_glk.h drm/i915/perf: prune OA configs 2017-08-03 18:18:05 +01:00
i915_oa_hsw.c drm/i915/perf: leave GDT_CHICKEN_BITS programming in configs 2017-08-03 18:18:44 +01:00
i915_oa_hsw.h drm/i915/perf: prune OA configs 2017-08-03 18:18:05 +01:00
i915_oa_kblgt2.c drm/i915/perf: leave GDT_CHICKEN_BITS programming in configs 2017-08-03 18:18:44 +01:00
i915_oa_kblgt2.h drm/i915/perf: prune OA configs 2017-08-03 18:18:05 +01:00
i915_oa_kblgt3.c drm/i915/perf: leave GDT_CHICKEN_BITS programming in configs 2017-08-03 18:18:44 +01:00
i915_oa_kblgt3.h drm/i915/perf: prune OA configs 2017-08-03 18:18:05 +01:00
i915_oa_sklgt2.c drm/i915/perf: leave GDT_CHICKEN_BITS programming in configs 2017-08-03 18:18:44 +01:00
i915_oa_sklgt2.h drm/i915/perf: prune OA configs 2017-08-03 18:18:05 +01:00
i915_oa_sklgt3.c drm/i915/perf: leave GDT_CHICKEN_BITS programming in configs 2017-08-03 18:18:44 +01:00
i915_oa_sklgt3.h drm/i915/perf: prune OA configs 2017-08-03 18:18:05 +01:00
i915_oa_sklgt4.c drm/i915/perf: leave GDT_CHICKEN_BITS programming in configs 2017-08-03 18:18:44 +01:00
i915_oa_sklgt4.h drm/i915/perf: prune OA configs 2017-08-03 18:18:05 +01:00
i915_params.c Revert "drm/i915: Add heuristic to determine better way to adjust brightness" 2017-07-21 09:32:48 +03:00
i915_params.h Revert "drm/i915: Add heuristic to determine better way to adjust brightness" 2017-07-21 09:32:48 +03:00
i915_pci.c drm/i915: Disable per-engine reset for Broxton 2017-07-27 09:38:48 +02:00
i915_perf.c drm/i915/perf: Drop redundant check for perf.initialised on reset 2017-08-10 21:43:11 +01:00
i915_pvinfo.h drm/i915: Fix GVT-g PVINFO version compatibility check 2017-06-13 11:19:22 +03:00
i915_reg.h drm/i915: add register macro definition style guide 2017-08-10 22:47:32 +03:00
i915_selftest.h
i915_suspend.c
i915_sw_fence.c main drm pull for v4.13 2017-07-09 18:48:37 -07:00
i915_sw_fence.h main drm pull for v4.13 2017-07-09 18:48:37 -07:00
i915_syncmap.c drm/i915: Squash repeated awaits on the same fence 2017-05-03 11:08:48 +01:00
i915_syncmap.h drm/i915: Squash repeated awaits on the same fence 2017-05-03 11:08:48 +01:00
i915_sysfs.c drm/i915: add const to bin_attribute 2017-08-03 12:20:09 +02:00
i915_trace_points.c
i915_trace.h drm/i915: Add g4x watermark tracepoint 2017-05-10 16:48:32 +03:00
i915_utils.h drm/i915: Store a direct lookup from object handle to vma 2017-06-16 16:54:04 +01:00
i915_vgpu.c drm/i915: Fix GVT-g PVINFO version compatibility check 2017-06-13 11:19:22 +03:00
i915_vgpu.h
i915_vma.c main drm pull for v4.13 2017-07-09 18:48:37 -07:00
i915_vma.h drm/i915: Remove assertion from raw __i915_vma_unpin() 2017-07-27 09:38:59 +02:00
intel_acpi.c ACPI: Switch to use generic guid_t in acpi_evaluate_dsm() 2017-06-07 12:20:49 +02:00
intel_atomic_plane.c drm/i915/skl+: Check for supported plane configuration in Interlace mode 2017-07-04 16:52:30 +03:00
intel_atomic.c drm/i915/cnl: Fix Cannonlake scaler mode programing. 2017-06-12 09:45:55 -07:00
intel_audio.c drm/i915: Reorganize intel_lpe_audio_notify() arguments 2017-05-03 16:20:48 +03:00
intel_bios.c drm/i915/cnl: Don't trust VBT's alternate pin for port D for now. 2017-07-07 09:11:46 -07:00
intel_bios.h
intel_breadcrumbs.c drm/i915: Skip adding the request to the signal tree is complete 2017-06-08 12:33:08 +01:00
intel_cdclk.c drm/i915: reintroduce VLV/CHV PFI programming power domain workaround 2017-07-03 16:12:44 +03:00
intel_color.c drm/i915: Fix out-of-bounds array access in bdw_load_gamma_lut 2017-08-02 15:06:13 +02:00
intel_crt.c drm: Nuke drm_atomic_helper_connector_dpms 2017-08-08 14:48:48 +02:00
intel_csr.c drm/i915: Use HAS_CSR instead of gen number on DMC load. 2017-06-12 09:45:30 -07:00
intel_ddi.c drm/i915: Return correct EDP voltage swing table for 0.85V 2017-08-11 11:36:38 -07:00
intel_device_info.c drm/i915: Use HAS_PCH_CPT() everywhere 2017-06-22 19:08:34 +03:00
intel_display.c drm/i915: More surgically unbreak the modeset vs reset deadlock 2017-08-14 17:03:36 +02:00
intel_dp_aux_backlight.c Revert "drm/i915: Add heuristic to determine better way to adjust brightness" 2017-07-21 09:32:48 +03:00
intel_dp_link_training.c drm/i915: Explicit the connector name for DP link training result 2017-07-19 08:32:42 +02:00
intel_dp_mst.c drm/i915: Avoid null dereference if mst_port is unset. 2017-08-10 13:59:26 -07:00
intel_dp.c drm/i915: Introduce intel_hpd_pin function. 2017-08-11 11:53:47 -07:00
intel_dpio_phy.c
intel_dpll_mgr.c drm/i915/cnl: Dump the right pll registers when dumping pipe config. 2017-08-11 11:41:45 -07:00
intel_dpll_mgr.h drm/i915/cnl: Initialize PLLs 2017-06-12 09:42:18 -07:00
intel_drv.h drm/i915: Add format modifiers for Intel 2017-08-10 17:58:39 +01:00
intel_dsi_dcs_backlight.c drm/i915: Pass atomic state to backlight enable/disable/set callbacks. 2017-06-12 16:06:28 +02:00
intel_dsi_pll.c
intel_dsi_vbt.c drm/i915/glk: Calculate high/low switch count for GLK 2017-05-15 18:29:46 +03:00
intel_dsi.c drm: Nuke drm_atomic_helper_connector_dpms 2017-08-08 14:48:48 +02:00
intel_dsi.h
intel_dvo.c drm: Nuke drm_atomic_helper_connector_dpms 2017-08-08 14:48:48 +02:00
intel_engine_cs.c drm/i915: Move idle checks before intel_engine_init_global_seqno() 2017-07-27 09:38:46 +02:00
intel_fbc.c drm/i915/fbc: only update no_fbc_reason when active 2017-08-11 16:57:18 +02:00
intel_fbdev.c Merge airlied/drm-next into drm-intel-next-queued 2017-08-10 18:12:01 +02:00
intel_fifo_underrun.c drm/i915: Consistently use enum pipe for PCH transcoders 2017-07-18 08:39:03 +02:00
intel_frontbuffer.c
intel_frontbuffer.h
intel_guc_ct.c drm/i915/guc: Introduce buffer based cmd transport 2017-05-26 13:26:53 +01:00
intel_guc_ct.h drm/i915/guc: Introduce buffer based cmd transport 2017-05-26 13:26:53 +01:00
intel_guc_fwif.h drm/i915/guc: Introduce buffer based cmd transport 2017-05-26 13:26:53 +01:00
intel_guc_loader.c drm/i915/guc: Load GuC on Coffee Lake 2017-06-09 11:56:53 -07:00
intel_guc_log.c drm/i915: Treat WC a separate cache domain 2017-04-12 12:35:17 +01:00
intel_gvt.c drm/i915/gvt: Return -EIO if host GuC submission is enabled when loading GVT-g 2017-05-30 16:00:07 +03:00
intel_gvt.h drm/i915/gvt: Add gvt options sanitize function 2017-05-30 15:59:47 +03:00
intel_hangcheck.c drm/i915: Check execlist/ring status during hangcheck 2017-07-27 09:38:45 +02:00
intel_hdmi.c drm/i915: Introduce intel_hpd_pin function. 2017-08-11 11:53:47 -07:00
intel_hotplug.c drm/i915: Introduce intel_hpd_pin function. 2017-08-11 11:53:47 -07:00
intel_huc.c drm/i915/huc: Load HuC on Coffee Lake 2017-06-09 11:57:16 -07:00
intel_i2c.c drm/i915: Rework sdvo proxy i2c locking 2017-07-27 10:05:48 +02:00
intel_lpe_audio.c drm/i915: Stop pretending to mask/unmask LPE audio interrupts 2017-05-26 11:51:18 +03:00
intel_lrc.c drm/i915: Flush the execlist ports if idle 2017-07-27 09:38:45 +02:00
intel_lrc.h drm/i915: remove unused function declaration 2017-08-07 18:29:26 +01:00
intel_lspcon.c drm/i915: use drm DP helper to read DPCD desc 2017-05-29 13:37:46 +03:00
intel_lvds.c drm: Nuke drm_atomic_helper_connector_dpms 2017-08-08 14:48:48 +02:00
intel_mocs.c drm/i915/cnl: Cannonlake has same MOCS table than Skylake. 2017-06-07 07:29:51 -07:00
intel_mocs.h
intel_modes.c
intel_opregion.c drm/i915: Pass connector state to intel_panel_set_backlight_acpi 2017-06-12 16:06:10 +02:00
intel_overlay.c drm/i915: More surgically unbreak the modeset vs reset deadlock 2017-08-14 17:03:36 +02:00
intel_panel.c drm/i915: fix backlight invert for non-zero minimum brightness 2017-08-04 15:22:18 +03:00
intel_pipe_crc.c drm/i915: use memdup_user_nul 2017-05-08 09:28:39 +02:00
intel_pm.c drm/i915/gen10: fix WM latency printing 2017-08-10 13:59:28 -07:00
intel_psr.c drm/i915/psr: Preserve SRD_CTL bit 29 on PSR init 2017-08-09 10:48:36 -07:00
intel_renderstate_gen6.c
intel_renderstate_gen7.c
intel_renderstate_gen8.c
intel_renderstate_gen9.c drm/i915/gen9: Send all components in VF state 2017-08-14 12:15:49 +03:00
intel_renderstate.h
intel_ringbuffer.c drm/i915: Enforce that CS packets are qword aligned 2017-07-27 09:38:57 +02:00
intel_ringbuffer.h drm/i915: Look for active requests earlier in the reset path 2017-06-20 21:00:03 +01:00
intel_runtime_pm.c drm/i915/cnl: Removing missing DDI_E bits from CNL. 2017-08-08 13:03:41 -07:00
intel_sdvo_regs.h
intel_sdvo.c Merge airlied/drm-next into drm-intel-next-queued 2017-08-10 18:12:01 +02:00
intel_sideband.c
intel_sprite.c drm/i915: make structure intel_sprite_plane_funcs static 2017-08-11 18:06:19 +02:00
intel_tv.c drm: Nuke drm_atomic_helper_connector_dpms 2017-08-08 14:48:48 +02:00
intel_uc.c drm/i915/guc: Rename GuC irq trigger function 2017-08-12 18:56:47 +01:00
intel_uc.h Linux 4.12-rc5 2017-06-16 13:58:27 +10:00
intel_uncore.c drm/i915/cnl: Add force wake for gen10+. 2017-07-06 13:22:37 -07:00
intel_uncore.h drm/i915: Keep the forcewake timer alive for 1ms past the most recent use 2017-05-26 15:58:21 +01:00
intel_vbt_defs.h
Kconfig drm/i915: select CRC32 2017-06-21 11:13:27 +02:00
Kconfig.debug drm/i915: Add SW_SYNC to our recommend testing Kconfig 2017-08-12 10:30:42 +01:00
Makefile drm/i915/perf: add GLK support 2017-06-14 12:31:58 -07:00