From: "Thomas Hellström" <thomas.hellstrom@linux.intel.com>
To: Matthew Brost <matthew.brost@intel.com>
Cc: intel-xe@lists.freedesktop.org
Subject: Re: [CI] drm: Ensure ioctls are drained before device unplug
Date: Tue, 21 Apr 2026 14:56:43 +0200 [thread overview]
Message-ID: <60f1def43bb1f5a4fc738e2dcc915e3f5be72134.camel@linux.intel.com> (raw)
In-Reply-To: <aecuhmp/Yi8vjT1q@gsse-cloud1.jf.intel.com>
On Tue, 2026-04-21 at 01:00 -0700, Matthew Brost wrote:
> 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>
Thanks for reviewing, Matt.
Although I think for some Ioctls that can wait extensively for GPU,
like fence waits and exec, we actually need to exit dev when waiting,
otherwise that waiting would block the unplug rather than let the
unplug through to kill the running jobs and terminate the wait.
So requires some careful thinking. Might be best if we set an IOTCTL
flag to indicate that we want this behaviour.
Thomas
>
> > ---
> > 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
> >
prev parent reply other threads:[~2026-04-21 12:56 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 ` [CI] " Matthew Brost
2026-04-21 12:56 ` Thomas Hellström [this message]
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=60f1def43bb1f5a4fc738e2dcc915e3f5be72134.camel@linux.intel.com \
--to=thomas.hellstrom@linux.intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=matthew.brost@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