Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Janusz Krzysztofik <janusz.krzysztofik@linux.intel.com>
To: Krzysztof Karas <krzysztof.karas@intel.com>,
	 intel-gfx@lists.freedesktop.org
Cc: Andi Shyti <andi.shyti@linux.intel.com>,
	Sebastian Brzezinka	 <sebastian.brzezinka@intel.com>,
	Krzysztof Niemiec <krzysztof.niemiec@intel.com>
Subject: Re: [RFC v3 1/2] drm/i915/selftests: Add userspace PID parameter
Date: Fri, 03 Apr 2026 11:57:30 +0200	[thread overview]
Message-ID: <7707ddbfcbd74aec7d942bab1a5bd4cdbb2fe5ab.camel@linux.intel.com> (raw)
In-Reply-To: <20260403090019.1933036-2-krzysztof.karas@intel.com>

Hi Krzysztof,

On Fri, 2026-04-03 at 09:00 +0000, Krzysztof Karas wrote:
> Currently, memory management tests using VMAs for object mapping
> are not guaranteed to execute in completely safe environment of
> user process in kernel context.
> 
> Since these tests may execute in kworker, for example on
> multi-cell NUMA systems, their process would not get its own
> userspace memory, so it'd borrow mm_struct from a process
> previously handled by the scheduler (current->active_mm).
> The test does not control the lifetime of that process and its
> address space, so on occasion it could borrow memory that is
> being cleaned up or that would be cleaned up during test
> execution.
> 
> Add a new parameter to i915 to let users running these tests
> pass a PID of trusted userspace process to ensure the mappings
> will always be utilized in a stable and predictable environment.
> 
> Signed-off-by: Krzysztof Karas <krzysztof.karas@intel.com>

I would still prefer this combined with a part of next patch that uses the 
user provided PID for acquiring a missing current->mm, and the other part,
the one that skips selected test cases if current->mm is missing, split 
into a separate patch.  That way, both would be self-contained and could 
be reverted independently if needed.  But anyway,

Reviewed-by: Janusz Krzysztofik <janusz.krzysztofik@linux.intel.com>


> ---
>  drivers/gpu/drm/i915/i915_selftest.h           | 1 +
>  drivers/gpu/drm/i915/selftests/i915_selftest.c | 2 ++
>  2 files changed, 3 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/i915_selftest.h b/drivers/gpu/drm/i915/i915_selftest.h
> index 72922028f4ba..e29ca298e7eb 100644
> --- a/drivers/gpu/drm/i915/i915_selftest.h
> +++ b/drivers/gpu/drm/i915/i915_selftest.h
> @@ -35,6 +35,7 @@ struct i915_selftest {
>  	unsigned long timeout_jiffies;
>  	unsigned int timeout_ms;
>  	unsigned int random_seed;
> +	unsigned int userspace_pid;
>  	char *filter;
>  	int mock;
>  	int live;
> diff --git a/drivers/gpu/drm/i915/selftests/i915_selftest.c b/drivers/gpu/drm/i915/selftests/i915_selftest.c
> index 8460f0a70d04..a1ccfde7380a 100644
> --- a/drivers/gpu/drm/i915/selftests/i915_selftest.c
> +++ b/drivers/gpu/drm/i915/selftests/i915_selftest.c
> @@ -507,6 +507,8 @@ void igt_hexdump(const void *buf, size_t len)
>  module_param_named(st_random_seed, i915_selftest.random_seed, uint, 0400);
>  module_param_named(st_timeout, i915_selftest.timeout_ms, uint, 0400);
>  module_param_named(st_filter, i915_selftest.filter, charp, 0400);
> +module_param_named(st_userspace_pid, i915_selftest.userspace_pid, uint, 0400);
> +MODULE_PARM_DESC(st_userspace_pid, "For usage in tests that map userspace memory and require address space with controllable lifetime.");
>  
>  module_param_named_unsafe(mock_selftests, i915_selftest.mock, int, 0400);
>  MODULE_PARM_DESC(mock_selftests, "Run selftests before loading, using mock hardware (0:disabled [default], 1:run tests then load driver, -1:run tests then leave dummy module)");

  reply	other threads:[~2026-04-03  9:57 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-03  9:00 [RFC v3 0/2] drm/i915/selftests: Use safe userspace memory for mappings Krzysztof Karas
2026-04-03  9:00 ` [RFC v3 1/2] drm/i915/selftests: Add userspace PID parameter Krzysztof Karas
2026-04-03  9:57   ` Janusz Krzysztofik [this message]
2026-04-08  7:54     ` Krzysztof Karas
2026-04-03  9:00 ` [RFC v3 2/2] drm/i915/selftests: Prevent userspace mapping invalidation Krzysztof Karas
2026-04-03  9:47   ` Janusz Krzysztofik
2026-04-08  7:52     ` Krzysztof Karas
2026-04-03 11:29   ` Sebastian Brzezinka
2026-04-08  7:48     ` Krzysztof Karas
2026-04-03 11:33 ` ✗ i915.CI.BAT: failure for drm/i915/selftests: Use safe userspace memory for mappings Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7707ddbfcbd74aec7d942bab1a5bd4cdbb2fe5ab.camel@linux.intel.com \
    --to=janusz.krzysztofik@linux.intel.com \
    --cc=andi.shyti@linux.intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=krzysztof.karas@intel.com \
    --cc=krzysztof.niemiec@intel.com \
    --cc=sebastian.brzezinka@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox