diff mbox

drm/i915: Fix context object leak for legacy contexts

Message ID 1416911965-800-1-git-send-email-thomas.daniel@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Thomas Daniel Nov. 25, 2014, 10:39 a.m. UTC
Dynamic context pinning for LRCs introduced a leak in legacy mode.
Reinstate context unreference in i915_gem_free_request for legacy contexts.

Leak reported by i-g-t/drv_module_reload fixed by this patch.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=86507
Signed-off-by: Thomas Daniel <thomas.daniel@intel.com>
---
 drivers/gpu/drm/i915/i915_gem.c |   10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

Comments

John Harrison Nov. 25, 2014, 10:49 a.m. UTC | #1
Looks good to me.

Reviewed-by: John Harrison<John.C.Harrison@Intel.com>


On 25/11/2014 10:39, Thomas Daniel wrote:
> Dynamic context pinning for LRCs introduced a leak in legacy mode.
> Reinstate context unreference in i915_gem_free_request for legacy contexts.
>
> Leak reported by i-g-t/drv_module_reload fixed by this patch.
>
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=86507
> Signed-off-by: Thomas Daniel <thomas.daniel@intel.com>
> ---
>   drivers/gpu/drm/i915/i915_gem.c |   10 ++++++----
>   1 file changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
> index 614bc2b..c630d49 100644
> --- a/drivers/gpu/drm/i915/i915_gem.c
> +++ b/drivers/gpu/drm/i915/i915_gem.c
> @@ -2574,11 +2574,13 @@ static void i915_gem_free_request(struct drm_i915_gem_request *request)
>   	list_del(&request->list);
>   	i915_gem_request_remove_from_client(request);
>   
> -	if (i915.enable_execlists && ctx) {
> -		struct intel_engine_cs *ring = request->ring;
> +	if (ctx) {
> +		if (i915.enable_execlists) {
> +			struct intel_engine_cs *ring = request->ring;
>   
> -		if (ctx != ring->default_context)
> -			intel_lr_context_unpin(ring, ctx);
> +			if (ctx != ring->default_context)
> +				intel_lr_context_unpin(ring, ctx);
> +		}
>   		i915_gem_context_unreference(ctx);
>   	}
>   	kfree(request);
Shuang He Nov. 25, 2014, 5:05 p.m. UTC | #2
Tested-By: PRC QA PRTS (Patch Regression Test System Contact: shuang.he@intel.com)
-------------------------------------Summary-------------------------------------
Platform          Delta          drm-intel-nightly          Series Applied
PNV                                  367/367              367/367
ILK                 -13              375/375              362/375
SNB                                  450/450              450/450
IVB                 -2              503/503              501/503
BYT                                  289/289              289/289
HSW                 -4              567/567              563/567
BDW                                  417/417              417/417
-------------------------------------Detailed-------------------------------------
Platform  Test                                drm-intel-nightly          Series Applied
 ILK  igt_gem_reset_stats_close-pending-fork-render      TIMEOUT(15, M37M26)PASS(1, M26)      TIMEOUT(1, M26)
 ILK  igt_kms_3d      DMESG_WARN(2, M26)PASS(3, M37M26)      DMESG_WARN(1, M26)
*ILK  igt_kms_flip_flip-vs-dpms-off-vs-modeset      DMESG_WARN(1, M26)PASS(2, M37M26)      NSPT(1, M26)
 ILK  igt_kms_flip_nonexisting-fb      DMESG_WARN(3, M26)PASS(3, M37M26)      DMESG_WARN(1, M26)
*ILK  igt_kms_pipe_crc_basic_bad-nb-words-1      PASS(2, M37M26)      DMESG_WARN(1, M26)
*ILK  igt_kms_pipe_crc_basic_bad-pipe      PASS(2, M37M26)      DMESG_WARN(1, M26)
 ILK  igt_kms_setmode_invalid-clone-exclusive-crtc      DMESG_WARN(1, M26)PASS(2, M37M26)      DMESG_WARN(1, M26)
*ILK  igt_kms_flip_rcs-flip-vs-panning-interruptible      DMESG_WARN(1, M26)PASS(2, M37M26)      NSPT(1, M26)
*ILK  igt_kms_flip_rcs-wf_vblank-vs-dpms-interruptible      DMESG_WARN(1, M26)PASS(1, M37)      NSPT(1, M26)
 ILK  igt_kms_flip_rcs-wf_vblank-vs-modeset      DMESG_WARN(1, M26)PASS(2, M37M26)      DMESG_WARN(1, M26)
*ILK  igt_kms_flip_bcs-flip-vs-modeset-interruptible      PASS(4, M37M26)      DMESG_WARN(1, M26)
*ILK  igt_kms_flip_rcs-flip-vs-modeset-interruptible      PASS(4, M37M26)      DMESG_WARN(1, M26)
 ILK  igt_kms_flip_vblank-vs-hang      TIMEOUT(14, M37M26)PASS(1, M26)      TIMEOUT(1, M26)
 IVB  igt_gem_bad_reloc_negative-reloc      NSPT(16, M34M21M4)PASS(1, M21)      NSPT(1, M21)
 IVB  igt_gem_bad_reloc_negative-reloc-lut      NSPT(3, M21M34M4)PASS(17, M21M34M4)      NSPT(1, M21)
 HSW  igt_gem_bad_reloc_negative-reloc-lut      NSPT(26, M40M20M19)PASS(1, M20)      NSPT(1, M19)
*HSW  igt_kms_fence_pin_leak      PASS(3, M20M19)      DMESG_WARN(1, M19)
*HSW  igt_kms_rotation_crc_primary-rotation      PASS(25, M20M40M19)      DMESG_WARN(1, M19)
*HSW  igt_pm_rc6_residency_rc6-accuracy      PASS(27, M20M40M19)      FAIL(1, M19)
Note: You need to pay more attention to line start with '*'
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 614bc2b..c630d49 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -2574,11 +2574,13 @@  static void i915_gem_free_request(struct drm_i915_gem_request *request)
 	list_del(&request->list);
 	i915_gem_request_remove_from_client(request);
 
-	if (i915.enable_execlists && ctx) {
-		struct intel_engine_cs *ring = request->ring;
+	if (ctx) {
+		if (i915.enable_execlists) {
+			struct intel_engine_cs *ring = request->ring;
 
-		if (ctx != ring->default_context)
-			intel_lr_context_unpin(ring, ctx);
+			if (ctx != ring->default_context)
+				intel_lr_context_unpin(ring, ctx);
+		}
 		i915_gem_context_unreference(ctx);
 	}
 	kfree(request);