All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Thomas Hellström" <thomas.hellstrom@linux.intel.com>
To: Matthew Auld <matthew.auld@intel.com>, intel-xe@lists.freedesktop.org
Cc: Matthew Brost <matthew.brost@intel.com>,
	Rodrigo vivi	 <rodrigo.vivi@intel.com>,
	Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Subject: Re: [PATCH v4 3/3] drm/xe: Block exec and rebind worker while evicting for suspend / hibernate
Date: Thu, 04 Sep 2025 18:21:04 +0200	[thread overview]
Message-ID: <a987dced05d29398c774b0e93b3318c340f2fb30.camel@linux.intel.com> (raw)
In-Reply-To: <0fe6e8c7-f45f-43d2-982e-41ef003cfcc5@intel.com>

On Thu, 2025-09-04 at 17:20 +0100, Matthew Auld wrote:
> On 04/09/2025 17:07, Thomas Hellström wrote:
> > When the xe pm_notifier evicts for suspend / hibernate, there might
> > be
> > racing tasks trying to re-validate again. This can lead to suspend
> > taking
> > excessive time or get stuck in a live-lock. This behaviour becomes
> > much worse with the fix that actually makes re-validation bring
> > back
> > bos to VRAM rather than letting them remain in TT.
> > 
> > Prevent that by having exec and the rebind worker waiting for a
> > completion
> > that is set to block by the pm_notifier before suspend and is
> > signaled
> > by the pm_notifier after resume / wakeup.
> > 
> > It's probably still possible to craft malicious applications that
> > block
> > suspending. More work is pending to fix that.
> > 
> > v3:
> > - Avoid wait_for_completion() in the kernel worker since it could
> >    potentially cause work item flushes from freezable processes to
> >    wait forever. Instead terminate the rebind workers if needed and
> >    re-launch at resume. (Matt Auld)
> > v4:
> > - Fix some bad naming and leftover debug printouts.
> > - Fix kerneldoc.
> > - Use drmm_mutex_init() for the xe->rebind_resume_lock (Matt Auld).
> > - Rework the interface of xe_vm_rebind_resume_worker (Matt Auld).
> > 
> > Link: https://gitlab.freedesktop.org/drm/xe/kernel/-/issues/4288
> > Fixes: c6a4d46ec1d7 ("drm/xe: evict user memory in PM notifier")
> > Cc: Matthew Auld <matthew.auld@intel.com>
> > Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
> > Cc: <stable@vger.kernel.org> # v6.16+
> > Signed-off-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
> 
> Reviewed-by: Matthew Auld <matthew.auld@intel.com>
> 
Thanks a lot Matthew!

/Thomas


  reply	other threads:[~2025-09-04 16:21 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-04 16:07 [PATCH v4 0/3] drm/xe: Fixes around eviction and suspend Thomas Hellström
2025-09-04 16:07 ` [PATCH v4 1/3] drm/xe: Attempt to bring bos back to VRAM after eviction Thomas Hellström
2025-09-04 16:07 ` [PATCH v4 2/3] drm/xe: Allow the pm notifier to continue on failure Thomas Hellström
2025-09-04 16:07 ` [PATCH v4 3/3] drm/xe: Block exec and rebind worker while evicting for suspend / hibernate Thomas Hellström
2025-09-04 16:20   ` Matthew Auld
2025-09-04 16:21     ` Thomas Hellström [this message]
2025-09-04 17:09 ` ✓ CI.KUnit: success for drm/xe: Fixes around eviction and suspend (rev4) Patchwork
2025-09-04 17:56 ` ✓ Xe.CI.BAT: " Patchwork
2025-09-05  9:49 ` ✓ Xe.CI.Full: " 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=a987dced05d29398c774b0e93b3318c340f2fb30.camel@linux.intel.com \
    --to=thomas.hellstrom@linux.intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=matthew.auld@intel.com \
    --cc=matthew.brost@intel.com \
    --cc=rodrigo.vivi@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.