Re: [PATCH v2] i915/selftest/igt_mmap: let mmap tests run in kthread

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Mikolaj,

On Tue, Mar 04, 2025 at 09:43:26AM +0100, Mikolaj Wasiak wrote:
> 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@xxxxxxxxx>
> Reviewed-by: Eugene Kobyak <eugene.kobyak@xxxxxxxxx>
> ---
> 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);

I still think this is somehow a brutal approach, but for a
selftest that is going to die soon it shouldn't be a big issue.

I'm going to take this in:

Reviewed-by: Andi Shyti <andi.shyti@xxxxxxxxxxxxxxx>

Thanks,
Andi

> +		unuse_mm = true;
> +	}
> +
> +	ret = i915_live_subtests(tests, i915);
> +
> +	if (unuse_mm)
> +		kthread_unuse_mm(current->active_mm);
> +
> +	return ret;
>  }
> -- 
> 2.43.0



[Index of Archives]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux