From: Matthew Brost <matthew.brost@intel.com>
To: "Thomas Hellström" <thomas.hellstrom@linux.intel.com>
Cc: <intel-xe@lists.freedesktop.org>
Subject: Re: [CI] drm: Ensure ioctls are drained before device unplug
Date: Tue, 21 Apr 2026 01:00:06 -0700 [thread overview]
Message-ID: <aecuhmp/Yi8vjT1q@gsse-cloud1.jf.intel.com> (raw)
In-Reply-To: <20260414091552.6153-1-thomas.hellstrom@linux.intel.com>
On Tue, Apr 14, 2026 at 11:15:52AM +0200, Thomas Hellström wrote:
> There is a check that blocks ioctls after device unplug,
> but we have no check that running ioctls have actually
> completed at unplug time. (And for some IOCTLs like
> fence waits, that actually makes sense).
> However, implement ioctl draining to have CI check for
> lockdep issues.
>
> Signed-off-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
CI patch, but this seems entirely correct—unless there’s some black
magic or hand-wavy behavior involved for not protecting IOCTLs against
unplug.
So…
Reviewed-by: Matthew Brost <matthew.brost@intel.com>
> ---
> drivers/gpu/drm/drm_ioctl.c | 11 +++++++----
> 1 file changed, 7 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_ioctl.c b/drivers/gpu/drm/drm_ioctl.c
> index ff193155129e..c87a925f0fe4 100644
> --- a/drivers/gpu/drm/drm_ioctl.c
> +++ b/drivers/gpu/drm/drm_ioctl.c
> @@ -789,19 +789,22 @@ long drm_ioctl_kernel(struct file *file, drm_ioctl_t *func, void *kdata,
> {
> struct drm_file *file_priv = file->private_data;
> struct drm_device *dev = file_priv->minor->dev;
> - int ret;
> + int ret, idx;
>
> /* Update drm_file owner if fd was passed along. */
> drm_file_update_pid(file_priv);
>
> - if (drm_dev_is_unplugged(dev))
> + if (!drm_dev_enter(dev, &idx))
> return -ENODEV;
>
> ret = drm_ioctl_permit(flags, file_priv);
> if (unlikely(ret))
> - return ret;
> + goto out;
>
> - return func(dev, kdata, file_priv);
> + ret = func(dev, kdata, file_priv);
> + out:
> + drm_dev_exit(idx);
> + return ret;
> }
> EXPORT_SYMBOL(drm_ioctl_kernel);
>
> --
> 2.53.0
>
next prev parent reply other threads:[~2026-04-21 8:00 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-14 9:15 [CI] drm: Ensure ioctls are drained before device unplug Thomas Hellström
2026-04-14 9:25 ` ✓ CI.KUnit: success for " Patchwork
2026-04-14 11:16 ` ✓ Xe.CI.BAT: " Patchwork
2026-04-14 12:24 ` ✗ Xe.CI.FULL: failure " Patchwork
2026-04-21 8:00 ` Matthew Brost [this message]
2026-04-21 12:56 ` [CI] " Thomas Hellström
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=aecuhmp/Yi8vjT1q@gsse-cloud1.jf.intel.com \
--to=matthew.brost@intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=thomas.hellstrom@linux.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