Skip to contentSkip to conversation

drm/i915: Fix for reserved space WARN_ON when ring begin fails

PATCH In review [email protected] 3 participants 4 messages Jan 13, 2016

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/i915: Fix for reserved space WARN_ON when ring begin fails

From: John Harrison <[email protected]>

The reserved space code was not cleaning up properly in the case where the intel_ring_begin() call failed. This led to WARN_ONs firing about a double reserve call when running the gem_reset_stats IGT test.

---
 drivers/gpu/drm/i915/intel_lrc.c        | 8 +++++++-
 drivers/gpu/drm/i915/intel_ringbuffer.c | 8 +++++++-
 2 files changed, 14 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_lrc.c +7 -1
index 06180dc..7dcc299 100644
@@ -835,6 +835,8 @@ int intel_logical_ring_begin(struct drm_i915_gem_request *req, int num_dwords)
 
 int intel_logical_ring_reserve_space(struct drm_i915_gem_request *request)
 {
+	int ret;
+
 	/*
 	 * The first call merely notes the reserve request and is common for
 	 * all back ends. The subsequent localised _begin() call actually
@@ -845,7 +847,11 @@ int intel_logical_ring_reserve_space(struct drm_i915_gem_request *request)
 	 */
 	intel_ring_reserved_space_reserve(request->ringbuf, MIN_SPACE_FOR_ADD_REQUEST);
 
-	return intel_logical_ring_begin(request, 0);
+	ret = intel_logical_ring_begin(request, 0);
+	if (ret)
+		intel_ring_reserved_space_cancel(request->ringbuf);
+
+	return ret;
 }
 
 /**
drivers/gpu/drm/i915/intel_ringbuffer.c +7 -1
index c9b081f..f1d3a4a 100644
@@ -2296,6 +2296,8 @@ int intel_ring_alloc_request_extras(struct drm_i915_gem_request *request)
 
 int intel_ring_reserve_space(struct drm_i915_gem_request *request)
 {
+	int ret;
+
 	/*
 	 * The first call merely notes the reserve request and is common for
 	 * all back ends. The subsequent localised _begin() call actually
@@ -2306,7 +2308,11 @@ int intel_ring_reserve_space(struct drm_i915_gem_request *request)
 	 */
 	intel_ring_reserved_space_reserve(request->ringbuf, MIN_SPACE_FOR_ADD_REQUEST);
 
-	return intel_ring_begin(request, 0);
+	ret = intel_ring_begin(request, 0);
+	if (ret)
+		intel_ring_reserved_space_cancel(request->ringbuf);
+
+	return ret;
 }
 
 void intel_ring_reserved_space_reserve(struct intel_ringbuffer *ringbuf, int size)
Signature · 6 lines
1.9.1

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw
Quoted 5 lines · On Wed, Jan 13, 2016 at 12:52:40PM +0000, [email protected] wrote:

From: John Harrison <[email protected]>

The reserved space code was not cleaning up properly in the case where the intel_ring_begin() call failed. This led to WARN_ONs firing about a double reserve call when running the gem_reset_stats IGT test.

*reserve_space() failure leads to a i915_gem_request_cancel() which calls intel_ring_reserved_space_cancel().
-Chris

Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#2 lore raw
Quoted 10 lines · Chris Wilson
Quoted 5 lines · On Wed, Jan 13, 2016 at 12:52:40PM +0000, [email protected] wrote:

From: John Harrison <[email protected]>

The reserved space code was not cleaning up properly in the case where the intel_ring_begin() call failed. This led to WARN_ONs firing about a double reserve call when running the gem_reset_stats IGT test.

*reserve_space() failure leads to a i915_gem_request_cancel() which calls intel_ring_reserved_space_cancel().
-Chris

Hmm, this is very true. Evidently something weird is going on in my tree. Ignore this patch!

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#3 lore raw

✗ failure: Fi.CI.BAT

In reply to [email protected]
== Summary ==

== Summary ==

Built on 4d09810b01441f9124c072a866f608b748f92f6c drm-intel-nightly: 2016y-01m-13d-12h-32m-08s UTC integration manifest

Test gem_basic:

        Subgroup create-close:
                pass       -> DMESG-WARN (skl-i5k-2)
Test gem_cpu_reloc:
        Subgroup basic:
                pass       -> DMESG-FAIL (skl-i5k-2)
Test gem_ctx_param_basic:
        Subgroup basic:
                pass       -> DMESG-WARN (skl-i5k-2)
        Subgroup invalid-param-set:
                pass       -> DMESG-WARN (skl-i5k-2)
        Subgroup non-root-set-no-zeromap:
                pass       -> DMESG-WARN (skl-i5k-2)
        Subgroup root-set-no-zeromap-disabled:
                pass       -> DMESG-WARN (skl-i5k-2)
Test gem_mmap:
        Subgroup basic:
                pass       -> DMESG-WARN (skl-i5k-2)
Test gem_mmap_gtt:
        Subgroup basic-read:
                pass       -> DMESG-WARN (skl-i5k-2)
        Subgroup basic-write:
                pass       -> DMESG-WARN (skl-i5k-2)
Test gem_storedw_loop:
        Subgroup basic-render:
                pass       -> DMESG-WARN (skl-i5k-2) UNSTABLE
                pass       -> DMESG-WARN (bdw-nuci7)
                pass       -> DMESG-WARN (bdw-ultra)
Test kms_addfb_basic:
        Subgroup addfb25-modifier-no-flag:
                pass       -> DMESG-WARN (skl-i5k-2)
        Subgroup addfb25-x-tiled-mismatch:
                pass       -> DMESG-WARN (skl-i5k-2)
        Subgroup addfb25-yf-tiled:
                pass       -> DMESG-WARN (skl-i5k-2)
        Subgroup bad-pitch-1024:
                pass       -> DMESG-WARN (skl-i5k-2)
        Subgroup bad-pitch-63:
                pass       -> DMESG-WARN (skl-i5k-2)
        Subgroup bad-pitch-999:
                pass       -> DMESG-WARN (skl-i5k-2)
        Subgroup clobberred-modifier:
                pass       -> DMESG-WARN (skl-i5k-2)
        Subgroup too-high:
                pass       -> DMESG-WARN (skl-i5k-2)
        Subgroup too-wide:
                pass       -> DMESG-WARN (skl-i5k-2)
        Subgroup unused-offsets:
                pass       -> DMESG-WARN (skl-i5k-2)
Test kms_flip:
        Subgroup basic-plain-flip:
                pass       -> DMESG-FAIL (skl-i5k-2)
Test kms_pipe_crc_basic:
        Subgroup nonblocking-crc-pipe-a-frame-sequence:
                pass       -> DMESG-FAIL (skl-i5k-2)
        Subgroup read-crc-pipe-b:
                pass       -> DMESG-WARN (ilk-hp8440p)
        Subgroup read-crc-pipe-b-frame-sequence:
                pass       -> DMESG-FAIL (skl-i5k-2)
Test prime_self_import:
        Subgroup basic-with_two_bos:
                pass       -> DMESG-WARN (skl-i5k-2)
bdw-nuci7        total:138  pass:128  dwarn:1   dfail:0   fail:0   skip:9  
bdw-ultra        total:138  pass:131  dwarn:1   dfail:0   fail:0   skip:6  
bsw-nuc-2        total:141  pass:115  dwarn:2   dfail:0   fail:0   skip:24 
hsw-brixbox      total:141  pass:134  dwarn:0   dfail:0   fail:0   skip:7  
hsw-gt2          total:141  pass:137  dwarn:0   dfail:0   fail:0   skip:4  
ilk-hp8440p      total:141  pass:99   dwarn:5   dfail:0   fail:0   skip:37 
ivb-t430s        total:135  pass:122  dwarn:3   dfail:4   fail:0   skip:6  
skl-i5k-2        total:141  pass:107  dwarn:21  dfail:4   fail:0   skip:8  
skl-i7k-2        total:141  pass:131  dwarn:2   dfail:0   fail:0   skip:8  
snb-dellxps      total:141  pass:122  dwarn:5   dfail:0   fail:0   skip:14 
snb-x220t        total:141  pass:122  dwarn:5   dfail:0   fail:1   skip:13 

Results at /archive/results/CI_IGT_test/Patchwork_1165/

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx