From: Andi Shyti <andi.shyti@kernel.org>
To: Krzysztof Karas <krzysztof.karas@intel.com>
Cc: intel-gfx@lists.freedesktop.org,
Andi Shyti <andi.shyti@linux.intel.com>,
Sebastian Brzezinka <sebastian.brzezinka@intel.com>,
Krzysztof Niemiec <krzysztof.niemiec@intel.com>,
Janusz Krzysztofik <janusz.krzysztofik@linux.intel.com>
Subject: Re: [PATCH v6 1/2] drm/i915/selftests: Prevent userspace mapping invalidation
Date: Thu, 16 Apr 2026 00:21:10 +0200 [thread overview]
Message-ID: <aeANlr7LDN9GjXn3@zenone.zhora.eu> (raw)
In-Reply-To: <20260415092111.2767839-2-krzysztof.karas@intel.com>
Hi Krzysztof,
...
> @@ -201,6 +238,21 @@ static int __run_selftests(const char *name,
> pr_info(DRIVER_NAME ": Performing %s selftests with st_random_seed=0x%x st_timeout=%u\n",
> name, i915_selftest.random_seed, i915_selftest.timeout_ms);
>
> + /**
> + * If we are running in a kthread on a multi NUMA system and the user passed
> + * a valid PID of a userspace task, then we may borrow its address space
> + * to prepare a safe environment for the mmap selftests.
> + */
> + if (!current->mm && u_pid_nr) {
> + mm = get_mm(u_pid_nr);
> + if (mm) {
> + kthread_use_mm(mm);
> + mmput_async(mm);
> + if (unlikely(!current->mm))
> + pr_warn("Could not set mm as current->mm\n");
> + }
> + }
> +
> /* Tests are listed in order in i915_*_selftests.h */
> for (; count--; st++) {
In this loop you have a few returns and we skip the mm cleanup.
Andi
> if (!st->enabled)
> @@ -226,6 +278,9 @@ static int __run_selftests(const char *name,
> st->name, err))
> err = -1;
>
> + if (mm)
> + kthread_unuse_mm(mm);
> +
> return err;
> }
next prev parent reply other threads:[~2026-04-15 22:21 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-15 9:21 [PATCH v6 0/2] drm/i915/selftests: Use safe userspace memory for mappings Krzysztof Karas
2026-04-15 9:21 ` [PATCH v6 1/2] drm/i915/selftests: Prevent userspace mapping invalidation Krzysztof Karas
2026-04-15 22:21 ` Andi Shyti [this message]
2026-04-15 9:21 ` [PATCH v6 2/2] drm/i915/selftests: Run vma tests only if current->mm is present Krzysztof Karas
2026-04-15 22:23 ` Andi Shyti
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=aeANlr7LDN9GjXn3@zenone.zhora.eu \
--to=andi.shyti@kernel.org \
--cc=andi.shyti@linux.intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=janusz.krzysztofik@linux.intel.com \
--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