Re: [PATCH v2] drm/i915/selftests: Drop struct_mutex around lowlevel pggtt allocation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 03/07/2018 14:53, Chris Wilson wrote:
For a ppgtt that we are constructing, there is no struct_mutex
dependence so skip it. In the process, also ping the scheduler
frequently to try and avoid the NMI watchdog.

v2: gen6 requires struct_mutex to clean up (currently)

Suggested-by: Tvrtko Ursulin <tvrtko.ursulin@xxxxxxxxx>
References: https://bugs.freedesktop.org/show_bug.cgi?id=107094
Signed-off-by: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx>
Cc: Tvrtko Ursulin <tvrtko.ursulin@xxxxxxxxx>
---
  drivers/gpu/drm/i915/selftests/i915_gem_gtt.c | 15 ++++++++-------
  1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c b/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c
index a28ee0cc6a63..4393b6d992e0 100644
--- a/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c
+++ b/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c
@@ -142,12 +142,9 @@ static int igt_ppgtt_alloc(void *arg)
  	if (!USES_PPGTT(dev_priv))
  		return 0;
- mutex_lock(&dev_priv->drm.struct_mutex);
  	ppgtt = __hw_ppgtt_create(dev_priv);
-	if (IS_ERR(ppgtt)) {
-		err = PTR_ERR(ppgtt);
-		goto err_unlock;
-	}
+	if (IS_ERR(ppgtt))
+		return PTR_ERR(ppgtt);
if (!ppgtt->vm.allocate_va_range)
  		goto err_ppgtt_cleanup;
@@ -166,6 +163,8 @@ static int igt_ppgtt_alloc(void *arg)
  			goto err_ppgtt_cleanup;
  		}
+ cond_resched();
+
  		ppgtt->vm.clear_range(&ppgtt->vm, 0, size);
  	}
@@ -183,13 +182,15 @@ static int igt_ppgtt_alloc(void *arg)
  			}
  			goto err_ppgtt_cleanup;
  		}
+
+		cond_resched();
  	}
err_ppgtt_cleanup:
+	mutex_lock(&dev_priv->drm.struct_mutex);
  	ppgtt->vm.cleanup(&ppgtt->vm);
-	kfree(ppgtt);
-err_unlock:
  	mutex_unlock(&dev_priv->drm.struct_mutex);
+	kfree(ppgtt);
  	return err;
  }

Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@xxxxxxxxx>

Regards,

Tvrtko
_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux