Skip to contentSkip to conversation

drm/i915: bail in alloc_pdp when !FULL_48BIT_PPGTT

PATCH In review Matthew Auld 3 participants 3 messages Apr 26, 2016

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

PATCH 1/1 drm/i915: bail in alloc_pdp when !FULL_48BIT_PPGTT

If we are not in FULL_48BIT_PPGTT mode then we really shouldn't continue on with our allocations, given that the call to free_pdp would bail early without freeing everything, thus leaking memory.

v2:
(Joonas Lahtinen)
- tidy up with goto teardown path
v3:
(Joonas Lahtinen)
- use more appropriate goto label name

---
 drivers/gpu/drm/i915/i915_gem_gtt.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)
drivers/gpu/drm/i915/i915_gem_gtt.c +8 -5
index 0d666b3..3ace3d0 100644
@@ -567,13 +567,16 @@ static struct
 i915_page_directory_pointer *alloc_pdp(struct drm_device *dev)
 {
 	struct i915_page_directory_pointer *pdp;
-	int ret = -ENOMEM;
+	int ret = -EINVAL;
 
-	WARN_ON(!USES_FULL_48BIT_PPGTT(dev));
+	if (WARN_ON(!USES_FULL_48BIT_PPGTT(dev)))
+		goto fail;
 
 	pdp = kzalloc(sizeof(*pdp), GFP_KERNEL);
-	if (!pdp)
-		return ERR_PTR(-ENOMEM);
+	if (!pdp) {
+		ret = -ENOMEM;
+		goto fail;
+	}
 
 	ret = __pdp_init(dev, pdp);
 	if (ret)
@@ -589,7 +592,7 @@ fail_page_m:
 	__pdp_fini(pdp);
 fail_bitmap:
 	kfree(pdp);
-
+fail:
 	return ERR_PTR(ret);
 }
 
Signature · 6 lines
2.4.11

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw
Quoted 3 lines · Matthew Auld

If we are not in FULL_48BIT_PPGTT mode then we really shouldn't continue on with our allocations, given that the call to free_pdp would bail early without freeing everything, thus leaking memory.

Why? Why are you second guessing the caller who asked for a i915_page_directory struct to be allocated? Is there any reason for a warn here?
-Chris

Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#2 lore raw

✗ Fi.CI.BAT: failure for drm/i915: bail in alloc_pdp when !FULL_48BIT_PPGTT

In reply to Matthew Auld
== Series Details ==

== Series Details ==

Series: drm/i915: bail in alloc_pdp when !FULL_48BIT_PPGTT
URL : https://patchwork.freedesktop.org/series/6312/
State : failure

== Summary ==

Series 6312v1 drm/i915: bail in alloc_pdp when !FULL_48BIT_PPGTT
http://patchwork.freedesktop.org/api/1.0/series/6312/revisions/1/mbox/

Test kms_flip:

        Subgroup basic-flip-vs-wf_vblank:
                pass       -> FAIL       (hsw-gt2)
Test kms_pipe_crc_basic:
        Subgroup read-crc-pipe-b-frame-sequence:
                skip       -> PASS       (bdw-nuci7)
bdw-nuci7        total:200  pass:188  dwarn:0   dfail:0   fail:0   skip:12 
bsw-nuc-2        total:199  pass:158  dwarn:0   dfail:0   fail:0   skip:41 
byt-nuc          total:199  pass:158  dwarn:0   dfail:0   fail:0   skip:41 
hsw-brixbox      total:200  pass:174  dwarn:0   dfail:0   fail:0   skip:26 
hsw-gt2          total:200  pass:178  dwarn:0   dfail:0   fail:1   skip:21 
ilk-hp8440p      total:200  pass:139  dwarn:0   dfail:0   fail:0   skip:61 
ivb-t430s        total:200  pass:169  dwarn:0   dfail:0   fail:0   skip:31 
skl-i7k-2        total:200  pass:173  dwarn:0   dfail:0   fail:0   skip:27 
skl-nuci5        total:200  pass:189  dwarn:0   dfail:0   fail:0   skip:11 
snb-dellxps      total:200  pass:158  dwarn:0   dfail:0   fail:0   skip:42 
snb-x220t        total:200  pass:158  dwarn:0   dfail:0   fail:1   skip:41 

bdw-ultra failed to connect after reboot

Results at /archive/results/CI_IGT_test/Patchwork_2067/

f814551aa7232ed36d71244dd148b48660b53a78 drm-intel-nightly: 2016y-04m-25d-11h-36m-27s UTC integration manifest 1661280 drm/i915: bail in alloc_pdp when !FULL_48BIT_PPGTT

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