diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2020-01-28 19:34:58 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2020-01-28 20:00:13 +0100 |
commit | 6717f7c32b33c2b13627dce309400abe7ac68392 (patch) | |
tree | e1e337777e5f713f61c868b28f2dbb4db46e51bf /drivers/gpu/drm/i915/gem/selftests | |
parent | drm/i915/trace: i915_request.prio is a signed value (diff) | |
download | linux-6717f7c32b33c2b13627dce309400abe7ac68392.tar.xz linux-6717f7c32b33c2b13627dce309400abe7ac68392.zip |
drm/i915/selftests: Lock the drm_mm as we search
Hold onto the vm->mutex (to lock the drm_mm) to ensure that the rbtree
is stable as we search it for our scratch node.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Matthew Auld <matthew.auld@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200128183458.3860022-1-chris@chris-wilson.co.uk
Diffstat (limited to 'drivers/gpu/drm/i915/gem/selftests')
-rw-r--r-- | drivers/gpu/drm/i915/gem/selftests/i915_gem_context.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/gpu/drm/i915/gem/selftests/i915_gem_context.c b/drivers/gpu/drm/i915/gem/selftests/i915_gem_context.c index 130c4c522686..375d864736f3 100644 --- a/drivers/gpu/drm/i915/gem/selftests/i915_gem_context.c +++ b/drivers/gpu/drm/i915/gem/selftests/i915_gem_context.c @@ -1465,9 +1465,12 @@ out_file: static int check_scratch(struct i915_address_space *vm, u64 offset) { - struct drm_mm_node *node = - __drm_mm_interval_first(&vm->mm, - offset, offset + sizeof(u32) - 1); + struct drm_mm_node *node; + + mutex_lock(&vm->mutex); + node = __drm_mm_interval_first(&vm->mm, + offset, offset + sizeof(u32) - 1); + mutex_unlock(&vm->mutex); if (!node || node->start > offset) return 0; |