From: Greg Kroah-Hartman Date: Wed, 12 Apr 2017 12:49:40 +0000 (+0200) Subject: 4.10-stable patches X-Git-Tag: v4.10.11~25 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=63786e0ea6d95ccbf6e21fb5e0856caf34efb92c;p=thirdparty%2Fkernel%2Fstable-queue.git 4.10-stable patches added patches: drm-i915-avoid-tweaking-evaluation-thresholds-on-baytrail-v3.patch drm-i915-fbdev-stop-repeating-tile-configuration-on-stagnation.patch drm-i915-fix-forcewake-active-domain-tracking.patch drm-i915-gen9-increase-pcode-request-timeout-to-50ms.patch drm-i915-move-updating-color-management-to-before-vblank-evasion.patch drm-i915-nuke-debug-messages-from-the-pipe-update-critical-section.patch drm-i915-squelch-any-ktime-jiffie-rounding-errors-for-wait-ioctl.patch drm-i915-store-a-permanent-error-in-obj-mm.pages.patch --- diff --git a/queue-4.10/drm-i915-avoid-tweaking-evaluation-thresholds-on-baytrail-v3.patch b/queue-4.10/drm-i915-avoid-tweaking-evaluation-thresholds-on-baytrail-v3.patch new file mode 100644 index 00000000000..e5a5165acee --- /dev/null +++ b/queue-4.10/drm-i915-avoid-tweaking-evaluation-thresholds-on-baytrail-v3.patch @@ -0,0 +1,95 @@ +From 34dc8993eef63681b062871413a9484008a2a78f Mon Sep 17 00:00:00 2001 +From: Mika Kuoppala +Date: Wed, 15 Feb 2017 15:52:59 +0200 +Subject: drm/i915: Avoid tweaking evaluation thresholds on Baytrail v3 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Mika Kuoppala + +commit 34dc8993eef63681b062871413a9484008a2a78f upstream. + +Certain Baytrails, namely the 4 cpu core variants, have been +plaqued by spurious system hangs, mostly occurring with light loads. + +Multiple bisects by various people point to a commit which changes the +reclocking strategy for Baytrail to follow its bigger brethen: +commit 8fb55197e64d ("drm/i915: Agressive downclocking on Baytrail") + +There is also a review comment attached to this commit from Deepak S +on avoiding punit access on Cherryview and thus it was excluded on +common reclocking path. By taking the same approach and omitting +the punit access by not tweaking the thresholds when the hardware +has been asked to move into different frequency, considerable gains +in stability have been observed. + +With J1900 box, light render/video load would end up in system hang +in usually less than 12 hours. With this patch applied, the cumulative +uptime has now been 34 days without issues. To provoke system hang, +light loads on both render and bsd engines in parallel have been used: +glxgears >/dev/null 2>/dev/null & +mpv --vo=vaapi --hwdec=vaapi --loop=inf vid.mp4 + +So far, author has not witnessed system hang with above load +and this patch applied. Reports from the tenacious people at +kernel bugzilla are also promising. + +Considering that the punit access frequency with this patch is +considerably less, there is a possibility that this will push +the, still unknown, root cause past the triggering point on most loads. + +But as we now can reliably reproduce the hang independently, +we can reduce the pain that users are having and use a +static thresholds until a root cause is found. + +v3: don't break debugfs and simplification (Chris Wilson) + +References: https://bugzilla.kernel.org/show_bug.cgi?id=109051 +Cc: Chris Wilson +Cc: Ville Syrjälä +Cc: Len Brown +Cc: Daniel Vetter +Cc: Jani Nikula +Cc: fritsch@xbmc.org +Cc: miku@iki.fi +Cc: Ezequiel Garcia +CC: Michal Feix +Cc: Hans de Goede +Cc: Deepak S +Cc: Jarkko Nikula +Acked-by: Daniel Vetter +Acked-by: Chris Wilson +Signed-off-by: Mika Kuoppala +Link: http://patchwork.freedesktop.org/patch/msgid/1487166779-26945-1-git-send-email-mika.kuoppala@intel.com +(cherry picked from commit 6067a27d1f0184596d51decbac1c1fdc4acb012f) +Signed-off-by: Jani Nikula +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/gpu/drm/i915/intel_pm.c | 7 +++++++ + 1 file changed, 7 insertions(+) + +--- a/drivers/gpu/drm/i915/intel_pm.c ++++ b/drivers/gpu/drm/i915/intel_pm.c +@@ -4876,6 +4876,12 @@ static void gen6_set_rps_thresholds(stru + break; + } + ++ /* When byt can survive without system hang with dynamic ++ * sw freq adjustments, this restriction can be lifted. ++ */ ++ if (IS_VALLEYVIEW(dev_priv)) ++ goto skip_hw_write; ++ + I915_WRITE(GEN6_RP_UP_EI, + GT_INTERVAL_FROM_US(dev_priv, ei_up)); + I915_WRITE(GEN6_RP_UP_THRESHOLD, +@@ -4896,6 +4902,7 @@ static void gen6_set_rps_thresholds(stru + GEN6_RP_UP_BUSY_AVG | + GEN6_RP_DOWN_IDLE_AVG); + ++skip_hw_write: + dev_priv->rps.power = new_power; + dev_priv->rps.up_threshold = threshold_up; + dev_priv->rps.down_threshold = threshold_down; diff --git a/queue-4.10/drm-i915-fbdev-stop-repeating-tile-configuration-on-stagnation.patch b/queue-4.10/drm-i915-fbdev-stop-repeating-tile-configuration-on-stagnation.patch new file mode 100644 index 00000000000..4b3aaac6eea --- /dev/null +++ b/queue-4.10/drm-i915-fbdev-stop-repeating-tile-configuration-on-stagnation.patch @@ -0,0 +1,79 @@ +From b717a0392530ae8da0da041abe5c3a6098b55660 Mon Sep 17 00:00:00 2001 +From: Chris Wilson +Date: Fri, 24 Feb 2017 11:43:06 +0000 +Subject: drm/i915/fbdev: Stop repeating tile configuration on stagnation + +From: Chris Wilson + +commit b717a0392530ae8da0da041abe5c3a6098b55660 upstream. + +If we cease making progress in finding matching outputs for a tiled +configuration, stop looping over the remaining unconfigured outputs. + +v2: Use conn_seq (instead of pass) to only apply tile configuration on +first pass. + +Fixes: b0ee9e7fa5b4 ("drm/fb: add support for tiled monitor configurations. (v2)") +Signed-off-by: Chris Wilson +Cc: Tomasz Lis +Cc: Dave Airlie +Cc: Daniel Vetter +Cc: Jani Nikula +Cc: Sean Paul +Reviewed-by: Tomasz Lis +Link: http://patchwork.freedesktop.org/patch/msgid/20170224114306.4400-1-chris@chris-wilson.co.uk +(cherry picked from commit 754a76591b12c88f57ad8b4ca533a5c9566a1922) +Signed-off-by: Jani Nikula +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/gpu/drm/i915/intel_fbdev.c | 10 ++++------ + 1 file changed, 4 insertions(+), 6 deletions(-) + +--- a/drivers/gpu/drm/i915/intel_fbdev.c ++++ b/drivers/gpu/drm/i915/intel_fbdev.c +@@ -357,14 +357,13 @@ static bool intel_fb_initial_config(stru + bool *enabled, int width, int height) + { + struct drm_i915_private *dev_priv = to_i915(fb_helper->dev); +- unsigned long conn_configured, mask; ++ unsigned long conn_configured, conn_seq, mask; + unsigned int count = min(fb_helper->connector_count, BITS_PER_LONG); + int i, j; + bool *save_enabled; + bool fallback = true; + int num_connectors_enabled = 0; + int num_connectors_detected = 0; +- int pass = 0; + + save_enabled = kcalloc(count, sizeof(bool), GFP_KERNEL); + if (!save_enabled) +@@ -374,6 +373,7 @@ static bool intel_fb_initial_config(stru + mask = BIT(count) - 1; + conn_configured = 0; + retry: ++ conn_seq = conn_configured; + for (i = 0; i < count; i++) { + struct drm_fb_helper_connector *fb_conn; + struct drm_connector *connector; +@@ -387,7 +387,7 @@ retry: + if (conn_configured & BIT(i)) + continue; + +- if (pass == 0 && !connector->has_tile) ++ if (conn_seq == 0 && !connector->has_tile) + continue; + + if (connector->status == connector_status_connected) +@@ -498,10 +498,8 @@ retry: + conn_configured |= BIT(i); + } + +- if ((conn_configured & mask) != mask) { +- pass++; ++ if ((conn_configured & mask) != mask && conn_configured != conn_seq) + goto retry; +- } + + /* + * If the BIOS didn't enable everything it could, fall back to have the diff --git a/queue-4.10/drm-i915-fix-forcewake-active-domain-tracking.patch b/queue-4.10/drm-i915-fix-forcewake-active-domain-tracking.patch new file mode 100644 index 00000000000..457e47ae483 --- /dev/null +++ b/queue-4.10/drm-i915-fix-forcewake-active-domain-tracking.patch @@ -0,0 +1,94 @@ +From 6aef660370a9c246956ba6d01eebd8063c4214cb Mon Sep 17 00:00:00 2001 +From: Tvrtko Ursulin +Date: Fri, 10 Mar 2017 09:32:49 +0000 +Subject: drm/i915: Fix forcewake active domain tracking + +From: Tvrtko Ursulin + +commit 6aef660370a9c246956ba6d01eebd8063c4214cb upstream. + +In commit 003342a50021 ("drm/i915: Keep track of active +forcewake domains in a bitmask") I forgot to adjust the +newly introduce fw_domains_active state across reset. + +This caused the assert_forcewakes_inactive to trigger +during suspend and resume if there were user held +forcewakes. + +v2: Bitmask checks are required since vfuncs are not + always present. + +v3: Move bitmask tracking to get/put vfunc for simplicity. + (Chris Wilson) + +Signed-off-by: Tvrtko Ursulin +Fixes: 003342a50021 ("drm/i915: Keep track of active forcewake domains in a bitmask") +Testcase: igt/drv_suspend/forcewake +Cc: Tvrtko Ursulin +Cc: "Paneri, Praveen" +Cc: Chris Wilson +Cc: Daniel Vetter +Cc: Jani Nikula +Cc: intel-gfx@lists.freedesktop.org +Reviewed-by: Chris Wilson +Link: http://patchwork.freedesktop.org/patch/msgid/20170310093249.4484-1-tvrtko.ursulin@linux.intel.com +(cherry picked from commit b8473050805f35add97f3ff57570d55a01808df5) +Signed-off-by: Jani Nikula +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/gpu/drm/i915/intel_uncore.c | 13 ++++++------- + 1 file changed, 6 insertions(+), 7 deletions(-) + +--- a/drivers/gpu/drm/i915/intel_uncore.c ++++ b/drivers/gpu/drm/i915/intel_uncore.c +@@ -119,6 +119,8 @@ fw_domains_get(struct drm_i915_private * + + for_each_fw_domain_masked(d, fw_domains, dev_priv) + fw_domain_wait_ack(d); ++ ++ dev_priv->uncore.fw_domains_active |= fw_domains; + } + + static void +@@ -130,6 +132,8 @@ fw_domains_put(struct drm_i915_private * + fw_domain_put(d); + fw_domain_posting_read(d); + } ++ ++ dev_priv->uncore.fw_domains_active &= ~fw_domains; + } + + static void +@@ -240,10 +244,8 @@ intel_uncore_fw_release_timer(struct hrt + if (WARN_ON(domain->wake_count == 0)) + domain->wake_count++; + +- if (--domain->wake_count == 0) { ++ if (--domain->wake_count == 0) + dev_priv->uncore.funcs.force_wake_put(dev_priv, domain->mask); +- dev_priv->uncore.fw_domains_active &= ~domain->mask; +- } + + spin_unlock_irqrestore(&dev_priv->uncore.lock, irqflags); + +@@ -455,10 +457,8 @@ static void __intel_uncore_forcewake_get + fw_domains &= ~domain->mask; + } + +- if (fw_domains) { ++ if (fw_domains) + dev_priv->uncore.funcs.force_wake_get(dev_priv, fw_domains); +- dev_priv->uncore.fw_domains_active |= fw_domains; +- } + } + + /** +@@ -962,7 +962,6 @@ static noinline void ___force_wake_auto( + fw_domain_arm_timer(domain); + + dev_priv->uncore.funcs.force_wake_get(dev_priv, fw_domains); +- dev_priv->uncore.fw_domains_active |= fw_domains; + } + + static inline void __force_wake_auto(struct drm_i915_private *dev_priv, diff --git a/queue-4.10/drm-i915-gen9-increase-pcode-request-timeout-to-50ms.patch b/queue-4.10/drm-i915-gen9-increase-pcode-request-timeout-to-50ms.patch new file mode 100644 index 00000000000..55a8038089e --- /dev/null +++ b/queue-4.10/drm-i915-gen9-increase-pcode-request-timeout-to-50ms.patch @@ -0,0 +1,76 @@ +From d253371c4c2f5fc2d884ef25f64decd7549aff5a Mon Sep 17 00:00:00 2001 +From: Imre Deak +Date: Fri, 24 Feb 2017 16:32:10 +0200 +Subject: drm/i915/gen9: Increase PCODE request timeout to 50ms +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Imre Deak + +commit d253371c4c2f5fc2d884ef25f64decd7549aff5a upstream. + +After +commit 2c7d0602c815277f7cb7c932b091288710d8aba7 +Author: Imre Deak +Date: Mon Dec 5 18:27:37 2016 +0200 + + drm/i915/gen9: Fix PCODE polling during CDCLK change notification + +there is still one report of the CDCLK-change request timing out on a +KBL machine, see the Reference link. On that machine the maximum time +the request took to succeed was 34ms, so increase the timeout to 50ms. + +v2: +- Change timeout from 100 to 50 ms to maintain the current 50 ms limit + for atomic waits in the driver. (Chris, Tvrtko) + +Reference: https://bugs.freedesktop.org/show_bug.cgi?id=99345 +Cc: Ville Syrjälä +Cc: Chris Wilson +Cc: Tvrtko Ursulin +Signed-off-by: Imre Deak +Acked-by: Chris Wilson +Link: http://patchwork.freedesktop.org/patch/msgid/1487946730-17162-1-git-send-email-imre.deak@intel.com +(cherry picked from commit 0129936ddda26afd5d9d207c4e86b2425952579f) +Signed-off-by: Jani Nikula +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/gpu/drm/i915/intel_pm.c | 11 ++++++----- + 1 file changed, 6 insertions(+), 5 deletions(-) + +--- a/drivers/gpu/drm/i915/intel_pm.c ++++ b/drivers/gpu/drm/i915/intel_pm.c +@@ -7895,10 +7895,10 @@ static bool skl_pcode_try_request(struct + * @timeout_base_ms: timeout for polling with preemption enabled + * + * Keep resending the @request to @mbox until PCODE acknowledges it, PCODE +- * reports an error or an overall timeout of @timeout_base_ms+10 ms expires. ++ * reports an error or an overall timeout of @timeout_base_ms+50 ms expires. + * The request is acknowledged once the PCODE reply dword equals @reply after + * applying @reply_mask. Polling is first attempted with preemption enabled +- * for @timeout_base_ms and if this times out for another 10 ms with ++ * for @timeout_base_ms and if this times out for another 50 ms with + * preemption disabled. + * + * Returns 0 on success, %-ETIMEDOUT in case of a timeout, <0 in case of some +@@ -7934,14 +7934,15 @@ int skl_pcode_request(struct drm_i915_pr + * worst case) _and_ PCODE was busy for some reason even after a + * (queued) request and @timeout_base_ms delay. As a workaround retry + * the poll with preemption disabled to maximize the number of +- * requests. Increase the timeout from @timeout_base_ms to 10ms to ++ * requests. Increase the timeout from @timeout_base_ms to 50ms to + * account for interrupts that could reduce the number of these +- * requests. ++ * requests, and for any quirks of the PCODE firmware that delays ++ * the request completion. + */ + DRM_DEBUG_KMS("PCODE timeout, retrying with preemption disabled\n"); + WARN_ON_ONCE(timeout_base_ms > 3); + preempt_disable(); +- ret = wait_for_atomic(COND, 10); ++ ret = wait_for_atomic(COND, 50); + preempt_enable(); + + out: diff --git a/queue-4.10/drm-i915-move-updating-color-management-to-before-vblank-evasion.patch b/queue-4.10/drm-i915-move-updating-color-management-to-before-vblank-evasion.patch new file mode 100644 index 00000000000..bb1db38b9bd --- /dev/null +++ b/queue-4.10/drm-i915-move-updating-color-management-to-before-vblank-evasion.patch @@ -0,0 +1,57 @@ +From 38230243ef316ac696956d75dc78a22e3aa789b9 Mon Sep 17 00:00:00 2001 +From: Maarten Lankhorst +Date: Tue, 28 Feb 2017 15:28:47 +0100 +Subject: drm/i915: Move updating color management to before vblank evasion +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Maarten Lankhorst + +commit 38230243ef316ac696956d75dc78a22e3aa789b9 upstream. + +This cannot be done reliably during vblank evasasion +since the color management registers are not double buffered. + +The original commit that moved it always during vblank evasion was +wrong, so revert it to before vblank evasion again. + +Signed-off-by: Maarten Lankhorst +Fixes: 20a34e78f0d7 ("drm/i915: Update color management during vblank evasion.") +Link: http://patchwork.freedesktop.org/patch/msgid/1488292128-14540-1-git-send-email-maarten.lankhorst@linux.intel.com +Reviewed-by: Ville Syrjälä +(cherry picked from commit 567f0792a6ad11c0c2620944b8eeb777359fb85a) +Signed-off-by: Jani Nikula +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/gpu/drm/i915/intel_display.c | 12 +++++++----- + 1 file changed, 7 insertions(+), 5 deletions(-) + +--- a/drivers/gpu/drm/i915/intel_display.c ++++ b/drivers/gpu/drm/i915/intel_display.c +@@ -14895,17 +14895,19 @@ static void intel_begin_crtc_commit(stru + to_intel_atomic_state(old_crtc_state->state); + bool modeset = needs_modeset(crtc->state); + ++ if (!modeset && ++ (intel_cstate->base.color_mgmt_changed || ++ intel_cstate->update_pipe)) { ++ intel_color_set_csc(crtc->state); ++ intel_color_load_luts(crtc->state); ++ } ++ + /* Perform vblank evasion around commit operation */ + intel_pipe_update_start(intel_crtc); + + if (modeset) + goto out; + +- if (crtc->state->color_mgmt_changed || to_intel_crtc_state(crtc->state)->update_pipe) { +- intel_color_set_csc(crtc->state); +- intel_color_load_luts(crtc->state); +- } +- + if (intel_cstate->update_pipe) + intel_update_pipe_config(intel_crtc, old_intel_cstate); + else if (INTEL_GEN(dev_priv) >= 9) diff --git a/queue-4.10/drm-i915-nuke-debug-messages-from-the-pipe-update-critical-section.patch b/queue-4.10/drm-i915-nuke-debug-messages-from-the-pipe-update-critical-section.patch new file mode 100644 index 00000000000..71c52a6d12d --- /dev/null +++ b/queue-4.10/drm-i915-nuke-debug-messages-from-the-pipe-update-critical-section.patch @@ -0,0 +1,73 @@ +From edd06b8353772dca7afcd4640dafa83b521edd55 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Ville=20Syrj=C3=A4l=C3=A4?= +Date: Tue, 7 Mar 2017 22:54:19 +0200 +Subject: drm/i915: Nuke debug messages from the pipe update critical section +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Ville Syrjälä + +commit edd06b8353772dca7afcd4640dafa83b521edd55 upstream. + +printks are slow so we should not be doing them from the vblank evade +critical section. These could explain why we sometimes seem to +blow past our 100 usec deadline. + +The problem has been there ever since commit bfd16b2a23dc ("drm/i915: +Make updating pipe without modeset atomic.") but it may not have +been readily visible until commit e1edbd44e23b ("drm/i915: Complain +if we take too long under vblank evasion.") increased our chances +of noticing it. + +Cc: Maarten Lankhorst +Fixes: bfd16b2a23dc ("drm/i915: Make updating pipe without modeset atomic.") +Signed-off-by: Ville Syrjälä +Link: http://patchwork.freedesktop.org/patch/msgid/20170307205419.19447-1-ville.syrjala@linux.intel.com +Reviewed-by: Maarten Lankhorst +(cherry picked from commit c3f8ad57a01a31397e5a0349a226a32f35ddc19c) +Signed-off-by: Jani Nikula +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/gpu/drm/i915/intel_display.c | 12 +----------- + 1 file changed, 1 insertion(+), 11 deletions(-) + +--- a/drivers/gpu/drm/i915/intel_display.c ++++ b/drivers/gpu/drm/i915/intel_display.c +@@ -3677,10 +3677,6 @@ static void intel_update_pipe_config(str + /* drm_atomic_helper_update_legacy_modeset_state might not be called. */ + crtc->base.mode = crtc->base.state->mode; + +- DRM_DEBUG_KMS("Updating pipe size %ix%i -> %ix%i\n", +- old_crtc_state->pipe_src_w, old_crtc_state->pipe_src_h, +- pipe_config->pipe_src_w, pipe_config->pipe_src_h); +- + /* + * Update pipe size and adjust fitter if needed: the reason for this is + * that in compute_mode_changes we check the native mode (not the pfit +@@ -4805,23 +4801,17 @@ static void skylake_pfit_enable(struct i + struct intel_crtc_scaler_state *scaler_state = + &crtc->config->scaler_state; + +- DRM_DEBUG_KMS("for crtc_state = %p\n", crtc->config); +- + if (crtc->config->pch_pfit.enabled) { + int id; + +- if (WARN_ON(crtc->config->scaler_state.scaler_id < 0)) { +- DRM_ERROR("Requesting pfit without getting a scaler first\n"); ++ if (WARN_ON(crtc->config->scaler_state.scaler_id < 0)) + return; +- } + + id = scaler_state->scaler_id; + I915_WRITE(SKL_PS_CTRL(pipe, id), PS_SCALER_EN | + PS_FILTER_MEDIUM | scaler_state->scalers[id].mode); + I915_WRITE(SKL_PS_WIN_POS(pipe, id), crtc->config->pch_pfit.pos); + I915_WRITE(SKL_PS_WIN_SZ(pipe, id), crtc->config->pch_pfit.size); +- +- DRM_DEBUG_KMS("for crtc_state = %p scaler_id = %d\n", crtc->config, id); + } + } + diff --git a/queue-4.10/drm-i915-squelch-any-ktime-jiffie-rounding-errors-for-wait-ioctl.patch b/queue-4.10/drm-i915-squelch-any-ktime-jiffie-rounding-errors-for-wait-ioctl.patch new file mode 100644 index 00000000000..4590576fc41 --- /dev/null +++ b/queue-4.10/drm-i915-squelch-any-ktime-jiffie-rounding-errors-for-wait-ioctl.patch @@ -0,0 +1,50 @@ +From 89cf83d4e065ff9fbd2ddc674489c8058eeca758 Mon Sep 17 00:00:00 2001 +From: Chris Wilson +Date: Thu, 16 Feb 2017 12:54:41 +0000 +Subject: drm/i915: Squelch any ktime/jiffie rounding errors for wait-ioctl + +From: Chris Wilson + +commit 89cf83d4e065ff9fbd2ddc674489c8058eeca758 upstream. + +We wait upon jiffies, but report the time elapsed using a +high-resolution timer. This discrepancy can lead to us timing out the +wait prior to us reporting the elapsed time as complete. + +This restores the squelching lost in commit e95433c73a11 ("drm/i915: +Rearrange i915_wait_request() accounting with callers"). + +Fixes: e95433c73a11 ("drm/i915: Rearrange i915_wait_request() accounting with callers") +Signed-off-by: Chris Wilson +Cc: Matthew Auld +Cc: Joonas Lahtinen +Cc: # v4.10-rc1+ +Link: http://patchwork.freedesktop.org/patch/msgid/20170216125441.30923-1-chris@chris-wilson.co.uk +Reviewed-by: Joonas Lahtinen +(cherry picked from commit c1d2061b28c2aa25ec39b60d9c248e6beebd7315) +Signed-off-by: Jani Nikula +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/gpu/drm/i915/i915_gem.c | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +--- a/drivers/gpu/drm/i915/i915_gem.c ++++ b/drivers/gpu/drm/i915/i915_gem.c +@@ -3003,6 +3003,16 @@ i915_gem_wait_ioctl(struct drm_device *d + args->timeout_ns -= ktime_to_ns(ktime_sub(ktime_get(), start)); + if (args->timeout_ns < 0) + args->timeout_ns = 0; ++ ++ /* ++ * Apparently ktime isn't accurate enough and occasionally has a ++ * bit of mismatch in the jiffies<->nsecs<->ktime loop. So patch ++ * things up to make the test happy. We allow up to 1 jiffy. ++ * ++ * This is a regression from the timespec->ktime conversion. ++ */ ++ if (ret == -ETIME && !nsecs_to_jiffies(args->timeout_ns)) ++ args->timeout_ns = 0; + } + + i915_gem_object_put(obj); diff --git a/queue-4.10/drm-i915-store-a-permanent-error-in-obj-mm.pages.patch b/queue-4.10/drm-i915-store-a-permanent-error-in-obj-mm.pages.patch new file mode 100644 index 00000000000..f0c7fedd19d --- /dev/null +++ b/queue-4.10/drm-i915-store-a-permanent-error-in-obj-mm.pages.patch @@ -0,0 +1,70 @@ +From 0d9dc306e15b59bf50db87ebcb1e2248586d4733 Mon Sep 17 00:00:00 2001 +From: Chris Wilson +Date: Tue, 7 Mar 2017 13:20:31 +0000 +Subject: drm/i915: Store a permanent error in obj->mm.pages + +From: Chris Wilson + +commit 0d9dc306e15b59bf50db87ebcb1e2248586d4733 upstream. + +Once the object has been truncated, it is unrecoverable. To facilitate +detection of this state store the error in obj->mm.pages. + +This is required for the next patch which should be applied to v4.10 +(via stable), so we also need to mark this patch for backporting. In +that regard, let's consider this to be a fix/improvement too. + +v2: Avoid dereferencing the ERR_PTR when freeing the object. + +Fixes: 1233e2db199d ("drm/i915: Move object backing storage manipulation to its own locking") +Signed-off-by: Chris Wilson +Cc: Joonas Lahtinen +Link: http://patchwork.freedesktop.org/patch/msgid/20170307132031.32461-1-chris@chris-wilson.co.uk +Reviewed-by: Joonas Lahtinen +(cherry picked from commit 4e5462ee843c883790e9609cf560d88960ea4227) +Signed-off-by: Jani Nikula +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/gpu/drm/i915/i915_gem.c | 9 ++++++--- + 1 file changed, 6 insertions(+), 3 deletions(-) + +--- a/drivers/gpu/drm/i915/i915_gem.c ++++ b/drivers/gpu/drm/i915/i915_gem.c +@@ -2184,6 +2184,7 @@ i915_gem_object_truncate(struct drm_i915 + */ + shmem_truncate_range(file_inode(obj->base.filp), 0, (loff_t)-1); + obj->mm.madv = __I915_MADV_PURGED; ++ obj->mm.pages = ERR_PTR(-EFAULT); + } + + /* Try to discard unwanted pages */ +@@ -2283,7 +2284,9 @@ void __i915_gem_object_put_pages(struct + + __i915_gem_object_reset_page_iter(obj); + +- obj->ops->put_pages(obj, pages); ++ if (!IS_ERR(pages)) ++ obj->ops->put_pages(obj, pages); ++ + unlock: + mutex_unlock(&obj->mm.lock); + } +@@ -2501,7 +2504,7 @@ int __i915_gem_object_get_pages(struct d + if (err) + return err; + +- if (unlikely(!obj->mm.pages)) { ++ if (unlikely(IS_ERR_OR_NULL(obj->mm.pages))) { + err = ____i915_gem_object_get_pages(obj); + if (err) + goto unlock; +@@ -2579,7 +2582,7 @@ void *i915_gem_object_pin_map(struct drm + + pinned = true; + if (!atomic_inc_not_zero(&obj->mm.pages_pin_count)) { +- if (unlikely(!obj->mm.pages)) { ++ if (unlikely(IS_ERR_OR_NULL(obj->mm.pages))) { + ret = ____i915_gem_object_get_pages(obj); + if (ret) + goto err_unlock; diff --git a/queue-4.10/series b/queue-4.10/series new file mode 100644 index 00000000000..865f79ed2c2 --- /dev/null +++ b/queue-4.10/series @@ -0,0 +1,8 @@ +drm-i915-fix-forcewake-active-domain-tracking.patch +drm-i915-move-updating-color-management-to-before-vblank-evasion.patch +drm-i915-fbdev-stop-repeating-tile-configuration-on-stagnation.patch +drm-i915-squelch-any-ktime-jiffie-rounding-errors-for-wait-ioctl.patch +drm-i915-gen9-increase-pcode-request-timeout-to-50ms.patch +drm-i915-store-a-permanent-error-in-obj-mm.pages.patch +drm-i915-nuke-debug-messages-from-the-pipe-update-critical-section.patch +drm-i915-avoid-tweaking-evaluation-thresholds-on-baytrail-v3.patch diff --git a/queue-4.4/series b/queue-4.4/series new file mode 100644 index 00000000000..920f89c6a48 --- /dev/null +++ b/queue-4.4/series @@ -0,0 +1 @@ +drm-i915-avoid-tweaking-evaluation-thresholds-on-baytrail-v3.patch diff --git a/queue-4.9/series b/queue-4.9/series new file mode 100644 index 00000000000..d1cdfd99721 --- /dev/null +++ b/queue-4.9/series @@ -0,0 +1,3 @@ +drm-i915-gen9-increase-pcode-request-timeout-to-50ms.patch +drm-i915-nuke-debug-messages-from-the-pipe-update-critical-section.patch +drm-i915-avoid-tweaking-evaluation-thresholds-on-baytrail-v3.patch