All of lore.kernel.org
 help / color / mirror / Atom feed
* [Intel-gfx] [CI] drm/i915: Remove nest annotation from intel_context_unpin
@ 2020-01-03 13:57 Maarten Lankhorst
  2020-01-03 15:00 ` [Intel-gfx] ✗ Fi.CI.BUILD: failure for drm/i915: Remove nest annotation from intel_context_unpin (rev2) Patchwork
  0 siblings, 1 reply; 3+ messages in thread
From: Maarten Lankhorst @ 2020-01-03 13:57 UTC (permalink / raw)
  To: intel-gfx

Lets see what breaks? Round 2?

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
---
 drivers/gpu/drm/i915/gt/intel_context.c       | 28 +++++++++++++------
 drivers/gpu/drm/i915/gt/intel_context_types.h |  1 +
 2 files changed, 20 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/i915/gt/intel_context.c b/drivers/gpu/drm/i915/gt/intel_context.c
index 61c39e943f69..614258e268e4 100644
--- a/drivers/gpu/drm/i915/gt/intel_context.c
+++ b/drivers/gpu/drm/i915/gt/intel_context.c
@@ -48,21 +48,30 @@ int __intel_context_do_pin(struct intel_context *ce)
 {
 	int err;
 
-	if (mutex_lock_interruptible(&ce->pin_mutex))
-		return -EINTR;
-
-	if (likely(!atomic_read(&ce->pin_count))) {
-		intel_wakeref_t wakeref;
+	if (unlikely(!test_bit(CONTEXT_ALLOC_BIT, &ce->flags))) {
+		err = mutex_lock_interruptible(&ce->alloc_mutex);
+		if (err)
+			return err;
 
-		if (unlikely(!test_bit(CONTEXT_ALLOC_BIT, &ce->flags))) {
+		if (!test_bit(CONTEXT_ALLOC_BIT, &ce->flags)) {
 			err = ce->ops->alloc(ce);
 			if (unlikely(err))
 				goto err;
 
+			smp_mb(); /* Make sure allocation is flushed to memory */
+
 			__set_bit(CONTEXT_ALLOC_BIT, &ce->flags);
 		}
+		mutex_unlock(&ce->alloc_mutex);
+	}
+
+	err = mutex_lock_interruptible(&ce->pin_mutex);
+	if (err)
+		return err;
+
+	if (likely(!atomic_read(&ce->pin_count))) {
+		intel_wakeref_t wakeref;
 
-		err = 0;
 		with_intel_runtime_pm(ce->engine->uncore->rpm, wakeref)
 			err = ce->ops->pin(ce);
 		if (err)
@@ -95,14 +104,13 @@ void intel_context_unpin(struct intel_context *ce)
 
 	/* We may be called from inside intel_context_pin() to evict another */
 	intel_context_get(ce);
-	mutex_lock_nested(&ce->pin_mutex, SINGLE_DEPTH_NESTING);
+	mutex_lock(&ce->pin_mutex);
 
 	if (likely(atomic_dec_and_test(&ce->pin_count))) {
 		GEM_TRACE("%s context:%llx retire\n",
 			  ce->engine->name, ce->timeline->fence_context);
 
 		ce->ops->unpin(ce);
-
 		i915_gem_context_put(ce->gem_context);
 		intel_context_active_release(ce);
 	}
@@ -246,6 +254,7 @@ intel_context_init(struct intel_context *ce,
 	INIT_LIST_HEAD(&ce->signals);
 
 	mutex_init(&ce->pin_mutex);
+	mutex_init(&ce->alloc_mutex);
 
 	i915_active_init(&ce->active,
 			 __intel_context_active, __intel_context_retire);
@@ -257,6 +266,7 @@ void intel_context_fini(struct intel_context *ce)
 		intel_timeline_put(ce->timeline);
 	i915_vm_put(ce->vm);
 
+	mutex_destroy(&ce->alloc_mutex);
 	mutex_destroy(&ce->pin_mutex);
 	i915_active_fini(&ce->active);
 }
diff --git a/drivers/gpu/drm/i915/gt/intel_context_types.h b/drivers/gpu/drm/i915/gt/intel_context_types.h
index d1204cc899a3..a987df89caaf 100644
--- a/drivers/gpu/drm/i915/gt/intel_context_types.h
+++ b/drivers/gpu/drm/i915/gt/intel_context_types.h
@@ -65,6 +65,7 @@ struct intel_context {
 
 	atomic_t pin_count;
 	struct mutex pin_mutex; /* guards pinning and associated on-gpuing */
+	struct mutex alloc_mutex; /* guards against concurrent contex allocation */
 
 	/**
 	 * active: Active tracker for the rq activity (inc. external) on this
-- 
2.24.1

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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [Intel-gfx] ✗ Fi.CI.BUILD: failure for drm/i915: Remove nest annotation from intel_context_unpin (rev2)
  2020-01-03 13:57 [Intel-gfx] [CI] drm/i915: Remove nest annotation from intel_context_unpin Maarten Lankhorst
@ 2020-01-03 15:00 ` Patchwork
  0 siblings, 0 replies; 3+ messages in thread
From: Patchwork @ 2020-01-03 15:00 UTC (permalink / raw)
  To: Maarten Lankhorst; +Cc: intel-gfx

== Series Details ==

Series: drm/i915: Remove nest annotation from intel_context_unpin (rev2)
URL   : https://patchwork.freedesktop.org/series/71157/
State : failure

== Summary ==

Applying: drm/i915: Remove nest annotation from intel_context_unpin
Using index info to reconstruct a base tree...
M	drivers/gpu/drm/i915/gt/intel_context.c
M	drivers/gpu/drm/i915/gt/intel_context_types.h
Falling back to patching base and 3-way merge...
Auto-merging drivers/gpu/drm/i915/gt/intel_context_types.h
Auto-merging drivers/gpu/drm/i915/gt/intel_context.c
CONFLICT (content): Merge conflict in drivers/gpu/drm/i915/gt/intel_context.c
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch' to see the failed patch
Patch failed at 0001 drm/i915: Remove nest annotation from intel_context_unpin
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Intel-gfx] [CI] drm/i915: Remove nest annotation from intel_context_unpin
@ 2019-12-19 10:18 Maarten Lankhorst
  0 siblings, 0 replies; 3+ messages in thread
From: Maarten Lankhorst @ 2019-12-19 10:18 UTC (permalink / raw)
  To: intel-gfx

Lets see what breaks?

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
---
 drivers/gpu/drm/i915/gt/intel_context.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/gt/intel_context.c b/drivers/gpu/drm/i915/gt/intel_context.c
index 61c39e943f69..a6c64e762ce3 100644
--- a/drivers/gpu/drm/i915/gt/intel_context.c
+++ b/drivers/gpu/drm/i915/gt/intel_context.c
@@ -95,7 +95,7 @@ void intel_context_unpin(struct intel_context *ce)
 
 	/* We may be called from inside intel_context_pin() to evict another */
 	intel_context_get(ce);
-	mutex_lock_nested(&ce->pin_mutex, SINGLE_DEPTH_NESTING);
+	mutex_lock(&ce->pin_mutex);
 
 	if (likely(atomic_dec_and_test(&ce->pin_count))) {
 		GEM_TRACE("%s context:%llx retire\n",
-- 
2.24.0

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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-01-03 15:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-03 13:57 [Intel-gfx] [CI] drm/i915: Remove nest annotation from intel_context_unpin Maarten Lankhorst
2020-01-03 15:00 ` [Intel-gfx] ✗ Fi.CI.BUILD: failure for drm/i915: Remove nest annotation from intel_context_unpin (rev2) Patchwork
  -- strict thread matches above, loose matches on Subject: below --
2019-12-19 10:18 [Intel-gfx] [CI] drm/i915: Remove nest annotation from intel_context_unpin Maarten Lankhorst

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.