On 09/10/2015 09:47, Chris Wilson wrote:
On Fri, Oct 09, 2015 at 10:32:11AM +0200, Daniel Vetter wrote:
On Thu, Oct 08, 2015 at 07:31:36PM +0100, Tomas Elf wrote:
In the past vmas have sometimes turned out to be NULL when capturing buffer
objects during error state capture. To avoid NULL pointer exceptions throw a
WARNING and exit early and be prepared for the error state not being fully
accurate following this point.
Signed-off-by: Tomas Elf <tomas.elf@xxxxxxxxx>
---
drivers/gpu/drm/i915/i915_gpu_error.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/i915/i915_gpu_error.c b/drivers/gpu/drm/i915/i915_gpu_error.c
index cc75ca4..ae24971 100644
--- a/drivers/gpu/drm/i915/i915_gpu_error.c
+++ b/drivers/gpu/drm/i915/i915_gpu_error.c
@@ -691,9 +691,17 @@ unwind:
static void capture_bo(struct drm_i915_error_buffer *err,
struct i915_vma *vma)
{
- struct drm_i915_gem_object *obj = vma->obj;
+ struct drm_i915_gem_object *obj;
int i;
+ if (WARN_ON(!vma))
+ return;
If we rcu-protect the vma lists and vmas themselves then this can't
happen.
+
+ if (WARN_ON(!vma->obj))
+ return;
Again we probably need to rcu-protect this, and more important we need to
make sure the compiler doesn't do crap. So
obj = rcu_derefence(vma->obj)
if (!obj)
return;
Sweet! Let's go with that solution.
The other issue is that we don't actually want capture_bo() but capture_vma().
Sure, but capturing BOs instead of VMAs is not going to crash anything
and is therefore slightly outside of the scope of my current work. It
would certainly be an improvement to make that change, though.
Thanks,
Tomas
-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/intel-gfx