Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Thomas Hellström" <thomas.hellstrom@linux.intel.com>
To: Arvind Yadav <arvind.yadav@intel.com>,
	intel-xe@lists.freedesktop.org,  dri-devel@lists.freedesktop.org
Cc: matthew.brost@intel.com, himal.prasad.ghimiray@intel.com,
	 rodrigo.vivi@intel.com
Subject: Re: [PATCH 00/13] drm/xe: Isolate wedged devices from hardware access
Date: Thu, 10 Sep 2026 12:45:24 +0200	[thread overview]
Message-ID: <5c1b30dcb4342bd0ee43815434f8df4912709b8a.camel@linux.intel.com> (raw)
In-Reply-To: <20260827101801.1247654-1-arvind.yadav@intel.com>

On Thu, 2026-08-27 at 15:47 +0530, Arvind Yadav wrote:
> A permanently wedged device can still access hardware through pending
> work,
> existing VRAM mappings and background driver paths. This can cause
> unwanted
> DMA or MMIO access while userspace is preparing device recovery.
> 
> This series separates temporary PCI error recovery from permanent
> wedging and
> introduces a common device-I/O-blocked state.
> 
> After a permanent wedge, the driver:
> - stops queued VM, SVM and GuC work.
> - shuts down the display.
> - invalidates existing CPU mappings to VRAM.
> - maps later CPU faults to a per-BO dummy page.
> - stops interrupts and clears PCI bus mastering.
> - rejects new VRAM allocations.
> - notifies userspace only after isolation completes.
> - drops queued page faults and stops VM, SVM and GuC work.
> 
> System suspend waits for wedge isolation to complete before skipping
> the
> normal suspend path. The worker cannot reach synchronize_srcu() until
> all
> GTs have been declared wedged and their pending fences have been
> signalled.
> 
> The device remains isolated until userspace performs the advertised
> recovery,
> such as driver rebind or bus reset.
> 
> The series also fixes IRQ uninstall so requested handlers are freed
> after
> interrupts have already been suspended.
> 
> Arvind Yadav (13):
>   drm/xe/irq: Always free requested IRQs on uninstall
>   drm/xe: Separate AER reset state from device wedging
>   drm/xe: Drop queued page faults when device I/O is blocked
>   drm/xe: Stop VM work when device I/O is blocked
>   drm/xe: Send wedged notification from a worker
>   drm/xe: Reuse one dummy page per BO after wedge
>   drm/xe: Invalidate existing VRAM mappings on wedge
>   drm/xe/irq: Serialize IRQ suspend and resume
>   drm/xe: Isolate a wedged device before notifying userspace
>   drm/xe/ttm: Reject VRAM allocations on wedged devices
>   drm/xe/guc: Skip timeout recovery on a wedged device
>   drm/xe: Skip PM notifier preparation for wedged devices
>   drm/xe: Block BO VM access when device I/O is unavailable
> 
>  drivers/gpu/drm/xe/display/xe_display.c |  18 +++-
>  drivers/gpu/drm/xe/xe_bo.c              | 101 +++++++++++++++++++-
>  drivers/gpu/drm/xe/xe_bo.h              |   1 +
>  drivers/gpu/drm/xe/xe_bo_types.h        |   4 +
>  drivers/gpu/drm/xe/xe_device.c          | 118 ++++++++++++++++++++--
> --
>  drivers/gpu/drm/xe/xe_device.h          |  12 +++
>  drivers/gpu/drm/xe/xe_device_types.h    |  26 ++++++
>  drivers/gpu/drm/xe/xe_guc_ct.c          |   4 +-
>  drivers/gpu/drm/xe/xe_guc_pc.c          |  10 +-
>  drivers/gpu/drm/xe/xe_guc_rc.c          |   4 +-
>  drivers/gpu/drm/xe/xe_guc_submit.c      |  13 ++-
>  drivers/gpu/drm/xe/xe_guc_tlb_inval.c   |   8 +-
>  drivers/gpu/drm/xe/xe_irq.c             |  32 +++++--
>  drivers/gpu/drm/xe/xe_pagefault.c       |  40 ++++++++
>  drivers/gpu/drm/xe/xe_pci.c             |  23 ++++-
>  drivers/gpu/drm/xe/xe_pci_error.c       |  22 ++---
>  drivers/gpu/drm/xe/xe_pm.c              |  27 ++++++
>  drivers/gpu/drm/xe/xe_sriov_pf.c        |   2 +-
>  drivers/gpu/drm/xe/xe_svm.c             |  21 ++++-
>  drivers/gpu/drm/xe/xe_ttm_vram_mgr.c    |   4 +
>  drivers/gpu/drm/xe/xe_vm.c              |  16 ++++
>  21 files changed, 446 insertions(+), 60 deletions(-)

Hi, Arvind.

I think this series lacks context to some extent. Much of the code is
also inheritly racy [1]. because current hardware accesses aren't
drained before reset or wedging. What I think is needed here is a
design detailing

1) What type of user-space accesses and workqueues are completely
blocked (for example sharing the newly introduced vram_userfault.srcu)
This can perhaps also be combined with the drm SRCU since I figure
there might be multiple places where we ensure hardware is present
using drm_dev_enter / drm_dev_exit and also want to check whether it's
wedged or not.

See an example in
https://gitlab.freedesktop.org/thomash/kernel/-/commits/wedge?ref_type=heads
(Note that this is just an example, not fully adapted to the intentions
in this series).

2) How is user-space supposed to respond to a recoverable PCIe reset?
Currently? If a change is planned, In the future? Is it the case that
currently we flag "In reset" and then force the user to close its drm
connection and re-discover a recovered device? Is this about to change
and hence the distinction between PCIe reset and permanent wedging?

It looks like AMD might have an rwsem that just blocks callers over a
reset and perhaps notifies them that, for example VRAM is lost. In any
case, in addition to locking out new callers we need to drain old
callers:

[1]
Thread A                   Thread B

is_io_allowed()
			    disable_io()

access_hardware()	    reset()

Bang!

Thanks,
Thomas

      parent reply	other threads:[~2026-09-10 10:45 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-27 10:17 [PATCH 00/13] drm/xe: Isolate wedged devices from hardware access Arvind Yadav
2026-08-27 10:17 ` [PATCH 01/13] drm/xe/irq: Always free requested IRQs on uninstall Arvind Yadav
2026-08-27 10:39   ` Ghimiray, Himal Prasad
2026-08-31 20:30     ` Rodrigo Vivi
2026-09-01  9:32       ` Yadav, Arvind
2026-09-10  9:50   ` Thomas Hellström
2026-08-27 10:17 ` [PATCH 02/13] drm/xe: Separate AER reset state from device wedging Arvind Yadav
2026-08-27 10:36   ` sashiko-bot
2026-08-27 21:55   ` Andi Shyti
2026-08-28  3:32     ` Yadav, Arvind
2026-08-28 11:36   ` [PATCH 2/13] " Raag Jadav
2026-09-10 10:07   ` [PATCH 02/13] " Thomas Hellström
2026-08-27 10:17 ` [PATCH 03/13] drm/xe: Drop queued page faults when device I/O is blocked Arvind Yadav
2026-08-31 20:43   ` Rodrigo Vivi
2026-09-02  4:49     ` Yadav, Arvind
2026-09-02  5:30       ` Matthew Brost
2026-09-02  5:33         ` Matthew Brost
2026-08-27 10:17 ` [PATCH 04/13] drm/xe: Stop VM work " Arvind Yadav
2026-08-31 20:55   ` Rodrigo Vivi
2026-09-01  9:11     ` Yadav, Arvind
2026-09-02  5:40       ` Matthew Brost
2026-08-27 10:17 ` [PATCH 05/13] drm/xe: Send wedged notification from a worker Arvind Yadav
2026-08-27 22:12   ` Andi Shyti
2026-08-28  3:39     ` Yadav, Arvind
2026-08-27 10:17 ` [PATCH 06/13] drm/xe: Reuse one dummy page per BO after wedge Arvind Yadav
2026-08-27 10:30   ` sashiko-bot
2026-08-27 10:17 ` [PATCH 07/13] drm/xe: Invalidate existing VRAM mappings on wedge Arvind Yadav
2026-08-27 10:17 ` [PATCH 08/13] drm/xe/irq: Serialize IRQ suspend and resume Arvind Yadav
2026-08-31 21:06   ` Rodrigo Vivi
2026-09-01  9:07     ` Yadav, Arvind
2026-08-27 10:17 ` [PATCH 09/13] drm/xe: Isolate a wedged device before notifying userspace Arvind Yadav
2026-08-27 10:35   ` sashiko-bot
2026-08-27 10:17 ` [PATCH 10/13] drm/xe/ttm: Reject VRAM allocations on wedged devices Arvind Yadav
2026-08-31 21:03   ` Rodrigo Vivi
2026-09-01  8:19     ` Yadav, Arvind
2026-08-27 10:17 ` [PATCH 11/13] drm/xe/guc: Skip timeout recovery on a wedged device Arvind Yadav
2026-08-31 21:01   ` Rodrigo Vivi
2026-08-27 10:18 ` [PATCH 12/13] drm/xe: Skip PM notifier preparation for wedged devices Arvind Yadav
2026-08-31 21:00   ` Rodrigo Vivi
2026-09-01  7:03     ` Yadav, Arvind
2026-09-02 19:21       ` Rodrigo Vivi
2026-08-27 10:18 ` [PATCH 13/13] drm/xe: Block BO VM access when device I/O is unavailable Arvind Yadav
2026-08-27 10:30   ` sashiko-bot
2026-08-27 10:24 ` ✗ CI.checkpatch: warning for drm/xe: Isolate wedged devices from hardware access Patchwork
2026-08-27 10:26 ` ✓ CI.KUnit: success " Patchwork
2026-08-27 11:03 ` ✓ Xe.CI.BAT: " Patchwork
2026-08-27 12:16 ` ✓ Xe.CI.FULL: " Patchwork
2026-09-10 10:45 ` 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=5c1b30dcb4342bd0ee43815434f8df4912709b8a.camel@linux.intel.com \
    --to=thomas.hellstrom@linux.intel.com \
    --cc=arvind.yadav@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=himal.prasad.ghimiray@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox