diff mbox series

drm/i915/selftests: Flush fput after running selftests

Message ID 20191128084830.3782532-1-chris@chris-wilson.co.uk (mailing list archive)
State New, archived
Headers show
Series drm/i915/selftests: Flush fput after running selftests | expand

Commit Message

Chris Wilson Nov. 28, 2019, 8:48 a.m. UTC
Use an rcu_barrier() to flush any mock files used by the selftests as
the deferred cleanup may be holding resources that we need to cleanup.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/selftests/i915_selftest.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/selftests/i915_selftest.c b/drivers/gpu/drm/i915/selftests/i915_selftest.c
index d3bf9eefb682..e3a8110d79ba 100644
--- a/drivers/gpu/drm/i915/selftests/i915_selftest.c
+++ b/drivers/gpu/drm/i915/selftests/i915_selftest.c
@@ -152,8 +152,10 @@  static int __run_selftests(const char *name,
 			continue;
 
 		cond_resched();
-		if (signal_pending(current))
-			return -EINTR;
+		if (signal_pending(current)) {
+			err = -EINTR;
+			goto out;
+		}
 
 		pr_info(DRIVER_NAME ": Running %s\n", st->name);
 		if (data)
@@ -171,6 +173,10 @@  static int __run_selftests(const char *name,
 		 st->name, err))
 		err = -1;
 
+out:
+	rcu_barrier(); /* flush deferred fput() */
+	yield();
+	rcu_barrier(); /* and once more for anything freed from the files */
 	return err;
 }