drm/i915: Free resources correctly if we cannot map status page during ctx create
Subsystems (2)
PATCH 1/1 drm/i915: Free resources correctly if we cannot map status page during ctx create
We are not freeing memory allocated for ringbuf and ctx if we fail to map status page so release all resources correctly.
--- drivers/gpu/drm/i915/intel_lrc.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_lrc.c +4 -2
@@ -1777,8 +1777,10 @@ int intel_lr_context_deferred_create(struct intel_context *ctx, ring->status_page.gfx_addr =i915_gem_obj_ggtt_offset (ctx_obj); ring->status_page.page_addr =kmap (sg_page (ctx_obj->pages->sgl)); -if (ring->status_page.page_addr ==NULL ) -return -ENOMEM ; +if (ring->status_page.page_addr ==NULL ) { + ret = -ENOMEM ; + goto error; + } ring->status_page.obj = ctx_obj; }
Signature · 6 lines
2.1.2 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 59 lines
-----Original Message-----
From: Intel-gfx [mailto:[email protected]] On Behalf
Of Arun Siluvery
Sent: Monday, November 17, 2014 3:48 PM
Subject: [Intel-gfx] [PATCH] drm/i915: Free resources correctly if we cannot
map status page during ctx create
We are not freeing memory allocated for ringbuf and ctx if we fail to map
status page so release all resources correctly.
---
drivers/gpu/drm/i915/intel_lrc.c | 6 ++++--1 file changed, 4 insertions(+), 2 deletions(-)(quoted diff) +0
-0
b/drivers/gpu/drm/i915/intel_lrc.cindex f3efdbd..a84d24b 100644
---
a/drivers/gpu/drm/i915/intel_lrc.c+++
b/drivers/gpu/drm/i915/intel_lrc.c(quoted diff) +1
-2@@ -1777,8 +1777,10 @@ int intel_lr_context_deferred_create(struct intel_context *ctx, ring->status_page.gfx_addr = i915_gem_obj_ggtt_offset(ctx_obj); ring->status_page.page_addr = kmap(sg_page(ctx_obj->pages->sgl)); - if (ring->status_page.page_addr == NULL) - return -ENOMEM; + if (ring->status_page.page_addr == NULL) {
Review int intel_lr_context_deferred_create(struct
Quoted 10 lines
(quoted diff) +3
-0+ ret = -ENOMEM; + goto error; + } ring->status_page.obj = ctx_obj; }
Hi Arun,
I think your tree is out of date. See this patch:
http://patchwork.freedesktop.org/patch/35828/
Cheers,
Thomas.
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 80 lines · Thomas
Quoted 59 lines
-----Original Message-----
From: Intel-gfx [mailto:[email protected]] On Behalf
Of Arun Siluvery
Sent: Monday, November 17, 2014 3:48 PM
Subject: [Intel-gfx] [PATCH] drm/i915: Free resources correctly if we cannot
map status page during ctx create
We are not freeing memory allocated for ringbuf and ctx if we fail to map
status page so release all resources correctly.
---
drivers/gpu/drm/i915/intel_lrc.c | 6 ++++--1 file changed, 4 insertions(+), 2 deletions(-)(quoted diff) +0
-0
b/drivers/gpu/drm/i915/intel_lrc.cindex f3efdbd..a84d24b 100644
---
a/drivers/gpu/drm/i915/intel_lrc.c+++
b/drivers/gpu/drm/i915/intel_lrc.c(quoted diff) +1
-2@@ -1777,8 +1777,10 @@ int intel_lr_context_deferred_create(struct intel_context *ctx, ring->status_page.gfx_addr = i915_gem_obj_ggtt_offset(ctx_obj); ring->status_page.page_addr = kmap(sg_page(ctx_obj->pages->sgl)); - if (ring->status_page.page_addr == NULL) - return -ENOMEM; + if (ring->status_page.page_addr == NULL) {Review int intel_lr_context_deferred_create(struct
Quoted 10 lines
(quoted diff) +3
-0+ ret = -ENOMEM; + goto error; + } ring->status_page.obj = ctx_obj; }Hi Arun,
I think your tree is out of date. See this patch:
Quoted 9 lines
http://patchwork.freedesktop.org/patch/35828/
Cheers,
Thomas.
You are right, I don't have latest changes.
This patch can be ignored.
regards
Arun
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 13 lines · Arun Siluvery
We are not freeing memory allocated for ringbuf and ctx if we fail to map status page so release all resources correctly.
Signed-off-by Arun Siluvery <[email protected]>--- drivers/gpu/drm/i915/intel_lrc.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)drivers/gpu/drm/i915/intel_lrc.c +0
-0
drivers/gpu/drm/i915/intel_lrc.c int intel_lr_context_deferred_create(struct intel_context *ctx, · line 1783
Quoted 9 lines
drivers/gpu/drm/i915/intel_lrc.c +4
-2@@ -1777,8 +1777,10 @@ int intel_lr_context_deferred_create(struct intel_context *ctx, ring->status_page.gfx_addr =i915_gem_obj_ggtt_offset (ctx_obj); ring->status_page.page_addr =kmap (sg_page (ctx_obj->pages->sgl)); -if (ring->status_page.page_addr ==NULL ) -return -ENOMEM ; +if (ring->status_page.page_addr ==NULL ) { + ret = -ENOMEM ; + goto error; + }
Since this popped up: Do we have an automated igt testcase to exercise this corner-case?
We do have it for legacy (gen6/7) contexts, including exercising the shrinker logic to get rid of misplaced ctx objects to avoid ggtt fragmentation hassles ...
-Daniel
Quoted 10 lines
drivers/gpu/drm/i915/intel_lrc.c +0
-0ring->status_page.obj = ctx_obj; }Signature · 6 lines
2.1.2 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 18 lines · Daniel Vetter
Quoted 17 lines · Arun Siluvery
We are not freeing memory allocated for ringbuf and ctx if we fail to map status page so release all resources correctly.
Signed-off-by Arun Siluvery <[email protected]>--- drivers/gpu/drm/i915/intel_lrc.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)drivers/gpu/drm/i915/intel_lrc.c +0
-1@@ -1777,8 +1777,10 @@ int intel_lr_context_deferred_create(struct intel_context *ctx, ring->status_page.gfx_addr =i915_gem_obj_ggtt_offset (ctx_obj); ring->status_page.page_addr =kmap (sg_page (ctx_obj->pages->sgl)); -if (ring->status_page.page_addr ==NULL )
Quoted 8 lines
drivers/gpu/drm/i915/intel_lrc.c int intel_lr_context_deferred_create(struct intel_context *ctx, · line 1783
Quoted 5 lines
drivers/gpu/drm/i915/intel_lrc.c +4
-1-return -ENOMEM ; +if (ring->status_page.page_addr ==NULL ) { + ret = -ENOMEM ; + goto error; + }Since this popped up: Do we have an automated igt testcase to exercise this corner-case?
How? kmap() never returns NULL.
-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
Quoted 28 lines · Chris Wilson
Quoted 18 lines · Daniel Vetter
Quoted 17 lines · Arun Siluvery
We are not freeing memory allocated for ringbuf and ctx if we fail to map status page so release all resources correctly.
Signed-off-by Arun Siluvery <[email protected]>--- drivers/gpu/drm/i915/intel_lrc.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)drivers/gpu/drm/i915/intel_lrc.c +0
-1@@ -1777,8 +1777,10 @@ int intel_lr_context_deferred_create(struct intel_context *ctx, ring->status_page.gfx_addr =i915_gem_obj_ggtt_offset (ctx_obj); ring->status_page.page_addr =kmap (sg_page (ctx_obj->pages->sgl)); -if (ring->status_page.page_addr ==NULL )Quoted 8 lines
drivers/gpu/drm/i915/intel_lrc.c int intel_lr_context_deferred_create(struct intel_context *ctx, · line 1783
Quoted 5 lines
drivers/gpu/drm/i915/intel_lrc.c +4
-1-return -ENOMEM ; +if (ring->status_page.page_addr ==NULL ) { + ret = -ENOMEM ; + goto error; + }Since this popped up: Do we have an automated igt testcase to exercise this corner-case?
Quoted 1 line
How?
kmap()never returns NULL.
Oh dear.
/me hangs head in shame
I'll do a patch to correct this.
-Daniel
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 1/1 drm/i915: Drop return value from lrc_setup_hardware_status_page
In reply to Chris Wilsonkmap never fails.
--- drivers/gpu/drm/i915/intel_lrc.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-)
drivers/gpu/drm/i915/intel_lrc.c +3 -12
@@ -1706,7 +1706,7 @@ static uint32_t get_lr_context_size(struct intel_engine_cs *ring)return ret; } -static int lrc_setup_hardware_status_page (struct intel_engine_cs *ring, +static void lrc_setup_hardware_status_page (struct intel_engine_cs *ring,struct drm_i915_gem_object *default_ctx_obj) {struct drm_i915_private *dev_priv = ring->dev->dev_private;
@@ -1716,15 +1716,11 @@ static int lrc_setup_hardware_status_page(struct intel_engine_cs *ring, ring->status_page.gfx_addr =i915_gem_obj_ggtt_offset (default_ctx_obj); ring->status_page.page_addr =kmap (sg_page (default_ctx_obj->pages->sgl)); -if (ring->status_page.page_addr ==NULL ) -return -ENOMEM ; ring->status_page.obj = default_ctx_obj;I915_WRITE (RING_HWS_PGA (ring->mmio_base), (u32 )ring->status_page.gfx_addr);POSTING_READ (RING_HWS_PGA (ring->mmio_base)); - -return 0 ; }/**
@@ -1811,13 +1807,8 @@ int intel_lr_context_deferred_create(struct intel_context *ctx, ctx->engine[ring->id].ringbuf = ringbuf; ctx->engine[ring->id].state = ctx_obj; -if (ctx == ring->default_context) { - ret =lrc_setup_hardware_status_page (ring, ctx_obj); -if (ret) { -DRM_ERROR ("Failed to setup hardware status page\n" ); - goto error; - } - } +if (ctx == ring->default_context) +lrc_setup_hardware_status_page (ring, ctx_obj);if (ring->id ==RCS && !ctx->rcs_initialized) {if (ring->init_context) {
Signature · 6 lines
2.1.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH] drm/i915: Drop return value from
-------------------------------------Summary-------------------------------------
Platform: baseline_drm_intel_nightly_pass_rate->patch_applied_pass_rate
BYT: pass/total=290/290->290/290
PNV: pass/total=362/362->362/362
ILK: pass/total=381/381->374/381
IVB: pass/total=522/559->522/559
SNB: pass/total=444/444->444/444
HSW: pass/total=595/595->594/595
BDW: pass/total=436/436->436/436
-------------------------------------Detailed-------------------------------------test_platform: test_suite, test_case, result_with_drm_intel_nightly(count, machine_id...)...->result_with_patch_applied(count, machine_id)...
ILK: Intel_gpu_tools, igt_kms_flip_bcs-wf_vblank-vs-modeset-interruptible, PASS(4, M37M26) -> DMESG_WARN(1, M26)PASS(3, M26)
ILK: Intel_gpu_tools, igt_kms_flip_flip-vs-rmfb-interruptible, PASS(4, M37M26) -> DMESG_WARN(2, M26)PASS(2, M26)
ILK: Intel_gpu_tools, igt_kms_flip_plain-flip, PASS(4, M37M26) -> DMESG_WARN(1, M26)PASS(3, M26)
ILK: Intel_gpu_tools, igt_kms_flip_rcs-wf_vblank-vs-dpms-interruptible, PASS(4, M37M26) -> DMESG_WARN(3, M26)PASS(1, M26)
ILK: Intel_gpu_tools, igt_kms_flip_vblank-vs-hang-interruptible, PASS(4, M37M26) -> DMESG_WARN(3, M26)PASS(1, M26)
ILK: Intel_gpu_tools, igt_kms_flip_wf_vblank-ts-check, PASS(4, M37M26) -> DMESG_WARN(1, M26)PASS(3, M26)
ILK: Intel_gpu_tools, igt_kms_flip_wf_vblank-vs-dpms, DMESG_WARN(1, M26)PASS(3, M6M26) -> DMESG_WARN(2, M26)PASS(2, M26)
HSW: Intel_gpu_tools, igt_gem_reset_stats_close-pending-render, PASS(3, M19M40) -> NO_RESULT(1, M40)PASS(3, M40)
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx