[PATCH] drm/i915: Warn if i915_drop_caches_set fails to quiesce
Chris Wilson
chris at chris-wilson.co.uk
Thu Feb 11 10:57:30 UTC 2021
Limit the wait to 60s, report a warning and return an error to userspace
if debugfs/i915_drop_caches_set fails to idle the GT. This should make
driver bugs more obvious as both a test failure and warning in dmesg
that includes the engine state leading to the driver bug. Or it will
catch IGT that try to flush excessive amount of works without cancelling
it first.
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
---
drivers/gpu/drm/i915/i915_debugfs.c | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
index 51133b8fabb4..8f8084b7b539 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -856,20 +856,26 @@ i915_drop_caches_get(void *data, u64 *val)
return 0;
}
+
static int
gt_drop_caches(struct intel_gt *gt, u64 val)
{
int ret;
- if (val & DROP_RESET_ACTIVE &&
- wait_for(intel_engines_are_idle(gt), I915_IDLE_ENGINES_TIMEOUT))
- intel_gt_set_wedged(gt);
-
if (val & DROP_RETIRE)
intel_gt_retire_requests(gt);
- if (val & (DROP_IDLE | DROP_ACTIVE)) {
- ret = intel_gt_wait_for_idle(gt, MAX_SCHEDULE_TIMEOUT);
+ if (val & (DROP_IDLE | DROP_ACTIVE | DROP_RESET_ACTIVE)) {
+ long timeout = 60 * HZ;
+
+ if (val & DROP_RESET_ACTIVE)
+ timeout = I915_IDLE_ENGINES_TIMEOUT;
+
+ ret = intel_gt_wait_for_idle(gt, timeout);
+ if (ret == -ETIME && val & DROP_RESET_ACTIVE) {
+ intel_gt_set_wedged(gt);
+ ret = 0;
+ }
if (ret)
return ret;
}
--
2.20.1
More information about the Intel-gfx-trybot
mailing list