All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] i915/selftest/igt_mmap: let mmap tests run in kthread
@ 2025-03-04  8:43 Mikolaj Wasiak
  2025-03-04 11:37 ` ✓ i915.CI.BAT: success for i915/selftest/igt_mmap: let mmap tests run in kthread (rev2) Patchwork
                   ` (6 more replies)
  0 siblings, 7 replies; 13+ messages in thread
From: Mikolaj Wasiak @ 2025-03-04  8:43 UTC (permalink / raw)
  To: intel-gfx; +Cc: Andi Shyti, Krzysztof Karas, chris.p.wilson

When the driver is loaded on the system with numa nodes it might be run in
a kthread, which makes it impossible to use current->mm in the selftest.
This patch allows the selftest to use current->mm by using active_mm.

Signed-off-by: Mikolaj Wasiak <mikolaj.wasiak@intel.com>
Reviewed-by: Eugene Kobyak <eugene.kobyak@intel.com>
---
v1 -> v2: Simplify logic of enabling and disabling active_mm

 drivers/gpu/drm/i915/gem/selftests/i915_gem_mman.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/gem/selftests/i915_gem_mman.c b/drivers/gpu/drm/i915/gem/selftests/i915_gem_mman.c
index 804f74084bd4..9c3f17e51885 100644
--- a/drivers/gpu/drm/i915/gem/selftests/i915_gem_mman.c
+++ b/drivers/gpu/drm/i915/gem/selftests/i915_gem_mman.c
@@ -1837,6 +1837,8 @@ static int igt_mmap_revoke(void *arg)
 
 int i915_gem_mman_live_selftests(struct drm_i915_private *i915)
 {
+	int ret;
+	bool unuse_mm = false;
 	static const struct i915_subtest tests[] = {
 		SUBTEST(igt_partial_tiling),
 		SUBTEST(igt_smoke_tiling),
@@ -1848,5 +1850,15 @@ int i915_gem_mman_live_selftests(struct drm_i915_private *i915)
 		SUBTEST(igt_mmap_gpu),
 	};
 
-	return i915_live_subtests(tests, i915);
+	if (!current->mm) {
+		kthread_use_mm(current->active_mm);
+		unuse_mm = true;
+	}
+
+	ret = i915_live_subtests(tests, i915);
+
+	if (unuse_mm)
+		kthread_unuse_mm(current->active_mm);
+
+	return ret;
 }
-- 
2.43.0


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

end of thread, other threads:[~2025-03-14 15:18 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-04  8:43 [PATCH v2] i915/selftest/igt_mmap: let mmap tests run in kthread Mikolaj Wasiak
2025-03-04 11:37 ` ✓ i915.CI.BAT: success for i915/selftest/igt_mmap: let mmap tests run in kthread (rev2) Patchwork
2025-03-04 15:28 ` ✓ i915.CI.BAT: success for i915/selftest/igt_mmap: let mmap tests run in kthread (rev3) Patchwork
2025-03-05  3:08 ` ✗ i915.CI.Full: failure for i915/selftest/igt_mmap: let mmap tests run in kthread (rev2) Patchwork
2025-03-05  6:35 ` ✗ i915.CI.Full: failure for i915/selftest/igt_mmap: let mmap tests run in kthread (rev3) Patchwork
2025-03-05 16:31 ` [PATCH v2] i915/selftest/igt_mmap: let mmap tests run in kthread Krzysztof Niemiec
2025-03-07  7:44   ` Mikolaj Wasiak
2025-03-07 11:31     ` Chris Wilson
2025-03-07 12:14       ` Mikolaj Wasiak
2025-03-07 13:18       ` Krzysztof Niemiec
2025-03-11 10:37         ` Krzysztof Karas
2025-03-14 14:26 ` Andi Shyti
2025-03-14 15:18 ` Andi Shyti

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.