[PATCH 2/4] drm/i915: Use a request signal pin using capture
Thomas Hellström
thomas.hellstrom at linux.intel.com
Wed Oct 20 12:50:14 UTC 2021
Block the request from signaling under us while capturing associated
buffer memory.
While doing so, it also becomes very apparent that the capture code
sits in the dma_fence signaling critical path, so change the GFP
mode accordingly to avoid deadlocks. That kills the lockdep splat
that was introduced with the signal pin usage.
Signed-off-by: Thomas Hellström <thomas.hellstrom at linux.intel.com>
---
drivers/gpu/drm/i915/i915_gpu_error.c | 22 ++++++++++++++++++----
1 file changed, 18 insertions(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/i915/i915_gpu_error.c b/drivers/gpu/drm/i915/i915_gpu_error.c
index 2a2d7643b551..b10cdbafedfb 100644
--- a/drivers/gpu/drm/i915/i915_gpu_error.c
+++ b/drivers/gpu/drm/i915/i915_gpu_error.c
@@ -49,7 +49,7 @@
#include "i915_memcpy.h"
#include "i915_scatterlist.h"
-#define ALLOW_FAIL (GFP_KERNEL | __GFP_RETRY_MAYFAIL | __GFP_NOWARN)
+#define ALLOW_FAIL (GFP_NOWAIT | __GFP_RETRY_MAYFAIL | __GFP_NOWARN)
#define ATOMIC_MAYFAIL (GFP_ATOMIC | __GFP_NOWARN)
static void __sg_set_buf(struct scatterlist *sg,
@@ -1462,6 +1462,7 @@ capture_engine(struct intel_engine_cs *engine,
struct intel_context *ce;
struct i915_request *rq = NULL;
unsigned long flags;
+ bool cookie;
ee = intel_engine_coredump_alloc(engine, GFP_KERNEL);
if (!ee)
@@ -1485,18 +1486,31 @@ capture_engine(struct intel_engine_cs *engine,
flags);
}
}
+
+ if (rq && !i915_request_signal_pin(rq, &cookie)) {
+ rq = NULL;
+ goto no_request_capture;
+ }
+
if (rq)
capture = intel_engine_coredump_add_request(ee, rq,
ATOMIC_MAYFAIL);
if (!capture) {
-no_request_capture:
- kfree(ee);
- return NULL;
+ if (rq)
+ i915_request_signal_unpin(rq, cookie);
+ goto no_request_capture;
}
intel_engine_coredump_add_vma(ee, capture, compress);
+ GEM_BUG_ON(rq && i915_request_signaled(rq));
+ i915_request_signal_unpin(rq, cookie);
+
return ee;
+
+no_request_capture:
+ kfree(ee);
+ return NULL;
}
static void
--
2.31.1
More information about the Intel-gfx-trybot
mailing list