aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2017-02-02 15:47:41 -0500
committerJani Nikula <jani.nikula@intel.com>2017-03-09 03:47:31 -0500
commit5a8cf90d743f2d05433c6109f6c1b9b904b0cdb7 (patch)
tree88d13956452c00f95cbd9778457060dd6ababe45
parentedd06b8353772dca7afcd4640dafa83b521edd55 (diff)
drm/i915: Drain the freed state from the tail of the next commit
If we have any residual freed atomic state from earlier commits, flush the freed list after performing the current modeset. This prevents the freed list from ever-growing if userspace manages to starve the kernel threads (i.e. we are never able to run our free state worker and eventually the system may even oom). Fixes: 6f0f02dc56f1 ("drm/i915: Move atomic state free from out of fence release") Testcase: igt/kms_cursor/legacy/all-pipes-single-bo Reported-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> Cc: Daniel Vetter <daniel.vetter@ffwll.ch> Link: http://patchwork.freedesktop.org/patch/msgid/20170202204741.18231-1-chris@chris-wilson.co.uk Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> (cherry picked from commit ba318c61a9719577b6f451c055f364e4116874b2) Signed-off-by: Jani Nikula <jani.nikula@intel.com>
-rw-r--r--drivers/gpu/drm/i915/intel_display.c34
1 files changed, 21 insertions, 13 deletions
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index b3e0cd133b49..3282b0f4b134 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -14369,6 +14369,24 @@ static void skl_update_crtcs(struct drm_atomic_state *state,
14369 } while (progress); 14369 } while (progress);
14370} 14370}
14371 14371
14372static void intel_atomic_helper_free_state(struct drm_i915_private *dev_priv)
14373{
14374 struct intel_atomic_state *state, *next;
14375 struct llist_node *freed;
14376
14377 freed = llist_del_all(&dev_priv->atomic_helper.free_list);
14378 llist_for_each_entry_safe(state, next, freed, freed)
14379 drm_atomic_state_put(&state->base);
14380}
14381
14382static void intel_atomic_helper_free_state_worker(struct work_struct *work)
14383{
14384 struct drm_i915_private *dev_priv =
14385 container_of(work, typeof(*dev_priv), atomic_helper.free_work);
14386
14387 intel_atomic_helper_free_state(dev_priv);
14388}
14389
14372static void intel_atomic_commit_tail(struct drm_atomic_state *state) 14390static void intel_atomic_commit_tail(struct drm_atomic_state *state)
14373{ 14391{
14374 struct drm_device *dev = state->dev; 14392 struct drm_device *dev = state->dev;
@@ -14535,6 +14553,8 @@ static void intel_atomic_commit_tail(struct drm_atomic_state *state)
14535 * can happen also when the device is completely off. 14553 * can happen also when the device is completely off.
14536 */ 14554 */
14537 intel_uncore_arm_unclaimed_mmio_detection(dev_priv); 14555 intel_uncore_arm_unclaimed_mmio_detection(dev_priv);
14556
14557 intel_atomic_helper_free_state(dev_priv);
14538} 14558}
14539 14559
14540static void intel_atomic_commit_work(struct work_struct *work) 14560static void intel_atomic_commit_work(struct work_struct *work)
@@ -16591,18 +16611,6 @@ fail:
16591 drm_modeset_acquire_fini(&ctx); 16611 drm_modeset_acquire_fini(&ctx);
16592} 16612}
16593 16613
16594static void intel_atomic_helper_free_state(struct work_struct *work)
16595{
16596 struct drm_i915_private *dev_priv =
16597 container_of(work, typeof(*dev_priv), atomic_helper.free_work);
16598 struct intel_atomic_state *state, *next;
16599 struct llist_node *freed;
16600
16601 freed = llist_del_all(&dev_priv->atomic_helper.free_list);
16602 llist_for_each_entry_safe(state, next, freed, freed)
16603 drm_atomic_state_put(&state->base);
16604}
16605
16606int intel_modeset_init(struct drm_device *dev) 16614int intel_modeset_init(struct drm_device *dev)
16607{ 16615{
16608 struct drm_i915_private *dev_priv = to_i915(dev); 16616 struct drm_i915_private *dev_priv = to_i915(dev);
@@ -16623,7 +16631,7 @@ int intel_modeset_init(struct drm_device *dev)
16623 dev->mode_config.funcs = &intel_mode_funcs; 16631 dev->mode_config.funcs = &intel_mode_funcs;
16624 16632
16625 INIT_WORK(&dev_priv->atomic_helper.free_work, 16633 INIT_WORK(&dev_priv->atomic_helper.free_work,
16626 intel_atomic_helper_free_state); 16634 intel_atomic_helper_free_state_worker);
16627 16635
16628 intel_init_quirks(dev); 16636 intel_init_quirks(dev);
16629 16637