Skip to contentSkip to conversation

drm/i915: initialize ret in i915_gem_evict_something

PATCH In review Matthew Auld 4 participants 9 messages Jan 5, 2017

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

PATCH 1/1 drm/i915: initialize ret in i915_gem_evict_something

If we find a suitable victim node on our first pass, then ret will be uninitialized which could lead to some funny business later.

Fixes 9332f3b1b99a ("drm/i915: Combine loops within i915_gem_evict_something")
Cc Chris Wilson <[email protected]>
---
 drivers/gpu/drm/i915/i915_gem_evict.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_gem_evict.c +1 -1
index 50129ec1caab..19716548c455 100644
@@ -109,7 +109,7 @@ i915_gem_evict_something(struct i915_address_space *vm,
 	}, **phase;
 	struct i915_vma *vma, *next;
 	struct drm_mm_node *node;
-	int ret;
+	int ret = 0;
 
 	lockdep_assert_held(&vm->i915->drm.struct_mutex);
 	trace_i915_gem_evict(vm, min_size, alignment, flags);
Signature · 6 lines
2.7.4

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

If we find a suitable victim node on our first pass, then ret will be uninitialized which could lead to some funny business later.

Fixes 9332f3b1b99a ("drm/i915: Combine loops within i915_gem_evict_something")
Cc Chris Wilson <[email protected]>
---
 drivers/gpu/drm/i915/i915_gem_evict.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_gem_evict.c +0 -0
index 50129ec1caab..19716548c455 100644

drivers/gpu/drm/i915/i915_gem_evict.c i915_gem_evict_something(struct i915_address_space *vm, · line 112

Quoted 5 lines
drivers/gpu/drm/i915/i915_gem_evict.c +1 -1
@@ -109,7 +109,7 @@ i915_gem_evict_something(struct i915_address_space *vm,
 	}, **phase;
 	struct i915_vma *vma, *next;
 	struct drm_mm_node *node;
-	int ret;
+	int ret = 0;

Please don't randomly initialise locals. It is meant to be initialised just prior to the unbind loop. It appears that my patches are out-of-order. :|
-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
Quoted 11 lines · Chris Wilson
Quoted 10 lines · Matthew Auld

If we find a suitable victim node on our first pass, then ret will be uninitialized which could lead to some funny business later.

Fixes 9332f3b1b99a ("drm/i915: Combine loops within i915_gem_evict_something")
Cc Chris Wilson <[email protected]>
---
 drivers/gpu/drm/i915/i915_gem_evict.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 14 lines

drivers/gpu/drm/i915/i915_gem_evict.c i915_gem_evict_something(struct i915_address_space *vm, · line 112

Quoted 10 lines
drivers/gpu/drm/i915/i915_gem_evict.c +1 -1
index 50129ec1caab..19716548c455 100644
@@ -109,7 +109,7 @@ i915_gem_evict_something(struct i915_address_space *vm,
      }, **phase;
      struct i915_vma *vma, *next;
      struct drm_mm_node *node;
-     int ret;
+     int ret = 0;

Please don't randomly initialise locals. It is meant to be initialised just prior to the unbind loop. It appears that my patches are out-of-order. :|

Oh, then I misread the intention of the code, sorry.
_______________________________________________
Intel-gfx mailing list [email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#7 lore raw

✓ Fi.CI.BAT: success for drm/i915: initialize ret in i915_gem_evict_something

In reply to Matthew Auld
== Series Details ==

== Series Details ==

Series: drm/i915: initialize ret in i915_gem_evict_something
URL : https://patchwork.freedesktop.org/series/17552/
State : success

== Summary ==

Series 17552v1 drm/i915: initialize ret in i915_gem_evict_something
https://patchwork.freedesktop.org/api/1.0/series/17552/revisions/1/mbox/

Test kms_force_connector_basic:

        Subgroup prune-stale-modes:
                dmesg-warn -> PASS       (fi-snb-2520m)
fi-bdw-5557u     total:246  pass:231  dwarn:0   dfail:0   fail:1   skip:14 
fi-bsw-n3050     total:246  pass:206  dwarn:0   dfail:0   fail:1   skip:39 
fi-bxt-j4205     total:246  pass:223  dwarn:0   dfail:0   fail:1   skip:22 
fi-bxt-t5700     total:82   pass:69   dwarn:0   dfail:0   fail:0   skip:12 
fi-byt-j1900     total:246  pass:218  dwarn:0   dfail:0   fail:1   skip:27 
fi-byt-n2820     total:246  pass:214  dwarn:0   dfail:0   fail:1   skip:31 
fi-hsw-4770      total:246  pass:226  dwarn:0   dfail:0   fail:1   skip:19 
fi-hsw-4770r     total:246  pass:226  dwarn:0   dfail:0   fail:1   skip:19 
fi-ivb-3520m     total:246  pass:224  dwarn:0   dfail:0   fail:1   skip:21 
fi-kbl-7500u     total:246  pass:224  dwarn:0   dfail:0   fail:1   skip:21 
fi-skl-6260u     total:246  pass:232  dwarn:0   dfail:0   fail:1   skip:13 
fi-skl-6700hq    total:246  pass:226  dwarn:0   dfail:0   fail:0   skip:20 
fi-skl-6700k     total:246  pass:221  dwarn:3   dfail:0   fail:1   skip:21 
fi-skl-6770hq    total:246  pass:232  dwarn:0   dfail:0   fail:1   skip:13 
fi-snb-2520m     total:246  pass:214  dwarn:0   dfail:0   fail:1   skip:31 
fi-snb-2600      total:246  pass:213  dwarn:0   dfail:0   fail:1   skip:32 

6a304f1f2e7446fe71bf7845c34dcdc73436c547 drm-tip: 2017y-01m-05d-11h-52m-09s UTC integration manifest 7d234c9 drm/i915: initialize ret in i915_gem_evict_something

== Logs ==

For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_3437/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#3 lore raw

PATCH 1/1 drm/i915: Clear ret before unbinding in i915_gem_evict_something()

In reply to Matthew Auld

Missed when rebasing patches, I failed to set ret to zero before starting the unbind loop (which depends upon ret being zero).

Fixes 9332f3b1b99a ("drm/i915: Combine loops within i915_gem_evict_something")
Cc Matthew Auld <[email protected]>
---
 drivers/gpu/drm/i915/i915_gem_evict.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/i915/i915_gem_evict.c +1 -0
index 50129ec1caab..026ebc5a452a 100644
@@ -209,6 +209,7 @@ i915_gem_evict_something(struct i915_address_space *vm,
 	}
 
 	/* Unbinding will emit any required flushes */
+	ret = 0;
 	while (!list_empty(&eviction_list)) {
 		vma = list_first_entry(&eviction_list,
 				       struct i915_vma,
Signature · 6 lines
2.11.0

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

Re: [PATCH] drm/i915: Clear ret before unbinding in i915_gem_evict_something()

Quoted 7 lines · Chris Wilson

Missed when rebasing patches, I failed to set ret to zero before starting the unbind loop (which depends upon ret being zero).

Fixes 9332f3b1b99a ("drm/i915: Combine loops within i915_gem_evict_something")
Cc Matthew Auld <[email protected]>

Cc: <[email protected]> # v4.9+
-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
Reviewed-by
#5 lore raw

Re: [PATCH] drm/i915: Clear ret before unbinding in i915_gem_evict_something()

Quoted 9 lines · Chris Wilson
Quoted 7 lines · Chris Wilson

Missed when rebasing patches, I failed to set ret to zero before starting the unbind loop (which depends upon ret being zero).

Fixes 9332f3b1b99a ("drm/i915: Combine loops within i915_gem_evict_something")
Cc Matthew Auld <[email protected]>
Cc <[email protected]> # v4.9+

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

#6 lore raw

Re: [PATCH] drm/i915: Clear ret before unbinding in i915_gem_evict_something()

Quoted 11 lines · Matthew Auld
Quoted 9 lines · Chris Wilson
Quoted 7 lines · Chris Wilson

Missed when rebasing patches, I failed to set ret to zero before starting the unbind loop (which depends upon ret being zero).

Fixes 9332f3b1b99a ("drm/i915: Combine loops within i915_gem_evict_something")
Cc Matthew Auld <[email protected]>
Cc <[email protected]> # v4.9+

Thanks for spotting my mistake, pushed before it starts to cause problems in the wild.
-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
#8 lore raw

✗ Fi.CI.BAT: warning for drm/i915: initialize ret in i915_gem_evict_something (rev2)

In reply to Matthew Auld
== Series Details ==

== Series Details ==

Series: drm/i915: initialize ret in i915_gem_evict_something (rev2)
URL : https://patchwork.freedesktop.org/series/17552/
State : warning

== Summary ==

Series 17552v2 drm/i915: initialize ret in i915_gem_evict_something
https://patchwork.freedesktop.org/api/1.0/series/17552/revisions/2/mbox/

Test kms_force_connector_basic:

        Subgroup force-edid:
                pass       -> DMESG-WARN (fi-snb-2520m)
        Subgroup prune-stale-modes:
                dmesg-warn -> PASS       (fi-snb-2520m)
fi-bdw-5557u     total:246  pass:231  dwarn:0   dfail:0   fail:1   skip:14 
fi-bsw-n3050     total:246  pass:206  dwarn:0   dfail:0   fail:1   skip:39 
fi-bxt-j4205     total:246  pass:223  dwarn:0   dfail:0   fail:1   skip:22 
fi-bxt-t5700     total:82   pass:69   dwarn:0   dfail:0   fail:0   skip:12 
fi-byt-j1900     total:246  pass:218  dwarn:0   dfail:0   fail:1   skip:27 
fi-byt-n2820     total:246  pass:214  dwarn:0   dfail:0   fail:1   skip:31 
fi-hsw-4770      total:246  pass:226  dwarn:0   dfail:0   fail:1   skip:19 
fi-hsw-4770r     total:246  pass:226  dwarn:0   dfail:0   fail:1   skip:19 
fi-ivb-3520m     total:246  pass:224  dwarn:0   dfail:0   fail:1   skip:21 
fi-ivb-3770      total:246  pass:224  dwarn:0   dfail:0   fail:1   skip:21 
fi-kbl-7500u     total:246  pass:224  dwarn:0   dfail:0   fail:1   skip:21 
fi-skl-6260u     total:246  pass:232  dwarn:0   dfail:0   fail:1   skip:13 
fi-skl-6700hq    total:246  pass:226  dwarn:0   dfail:0   fail:0   skip:20 
fi-skl-6700k     total:246  pass:221  dwarn:3   dfail:0   fail:1   skip:21 
fi-skl-6770hq    total:246  pass:232  dwarn:0   dfail:0   fail:1   skip:13 
fi-snb-2520m     total:246  pass:213  dwarn:1   dfail:0   fail:1   skip:31 
fi-snb-2600      total:246  pass:213  dwarn:0   dfail:0   fail:1   skip:32 

6a304f1f2e7446fe71bf7845c34dcdc73436c547 drm-tip: 2017y-01m-05d-11h-52m-09s UTC integration manifest b45bcf3 drm/i915: Clear ret before unbinding in i915_gem_evict_something()

== Logs ==

For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_3440/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx