intel-xe.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Matthew Brost <matthew.brost@intel.com>
To: Sanjay Yadav <sanjay.kumar.yadav@intel.com>
Cc: <intel-xe@lists.freedesktop.org>,
	Stuart Summers <stuart.summers@intel.com>
Subject: Re: [PATCH] drm/xe: Don't wedge shared engine on stale faults from torn-down VMs
Date: Fri, 11 Sep 2026 13:45:13 -0700	[thread overview]
Message-ID: <aqRoWdaMm1VH1OW0@gsse-cloud1.jf.intel.com> (raw)
In-Reply-To: <20260911192300.1561972-2-sanjay.kumar.yadav@intel.com>

On Sat, Sep 12, 2026 at 12:53:01AM +0530, Sanjay Yadav wrote:
> A recoverable page fault generated by a process's completed migrate/BCS
> work can arrive after that process's VM has been closed and its ASID
> removed (abnormal exit while GPU work was in flight).
> xe_pagefault_service() returned an error for such faults, which is
> reported to the GuC/HW as an unsuccessful response. Repeated
> unsuccessful responses eventually escalate to an engine memory CAT
> error. Because the migrate/BCS engine is shared, that CAT error
> wedges it for unrelated processes, which then hang on their own
> copies.

Yikes. Do you have a reproducer for this? I wouldn't expect this
behavior from the hardware, as it appears to violate the expected
process isolation contract.

> 
> Detect stale faults whose owning VM is closed or whose ASID no longer
> maps to a fault-capable VM, and drain them instead of replying
> unsuccessful.
> 
> Cc: Matthew Brost <matthew.brost@intel.com>
> Cc: Stuart Summers <stuart.summers@intel.com>

Fixes, CC stable if this is an issue.

> Assisted-by: GitHub Copilot:claude-opus-4.8
> Signed-off-by: Sanjay Yadav <sanjay.kumar.yadav@intel.com>
> ---
>  drivers/gpu/drm/xe/xe_pagefault.c | 22 +++++++++++++++++++---
>  1 file changed, 19 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/xe/xe_pagefault.c b/drivers/gpu/drm/xe/xe_pagefault.c
> index c82b8bc8bc70..2827652ab8a3 100644
> --- a/drivers/gpu/drm/xe/xe_pagefault.c
> +++ b/drivers/gpu/drm/xe/xe_pagefault.c
> @@ -238,8 +238,10 @@ static struct xe_vm *xe_pagefault_asid_to_vm(struct xe_device *xe, u32 asid)
>  	vm = xa_load(&xe->usm.asid_to_vm, asid);
>  	if (vm && xe_vm_in_fault_mode(vm))
>  		xe_vm_get(vm);
> -	else
> +	else if (vm)
>  		vm = ERR_PTR(-EINVAL);
> +	else
> +		vm = ERR_PTR(-ENOENT);
>  	up_read(&xe->usm.lock);
>  
>  	return vm;
> @@ -260,13 +262,27 @@ static int xe_pagefault_service(struct xe_pagefault *pf)
>  		return -EFAULT;
>  
>  	vm = xe_pagefault_asid_to_vm(xe, asid);
> -	if (IS_ERR(vm))
> +	if (IS_ERR(vm)) {
> +		if (PTR_ERR(vm) == -ENOENT) {
> +			drm_info(&xe->drm,
> +				 "xe_pf_debug: drain stale fault (no VM) asid=%u addr=0x%llx\n",
> +				 asid, pf->consumer.page_addr);
> +			xe_pagefault_set_start_addr(pf, pf->consumer.page_addr);
> +			xe_pagefault_set_end_addr(pf, pf->consumer.page_addr);
> +			return 0;

Won't the page walker hotspin on faults until the executing queue is
descheduled from the hardware if we successfully acknowledge them? That
doesn't seem ideal.

Matt

> +		}
>  		return PTR_ERR(vm);
> +	}
>  
>  	down_read(&vm->lock);
>  
>  	if (xe_vm_is_closed(vm)) {
> -		err = -ENOENT;
> +		drm_info(&xe->drm,
> +			 "xe_pf_debug: drain stale fault (closed VM) asid=%u addr=0x%llx\n",
> +			 asid, pf->consumer.page_addr);
> +		xe_pagefault_set_start_addr(pf, pf->consumer.page_addr);
> +		xe_pagefault_set_end_addr(pf, pf->consumer.page_addr);
> +		err = 0;
>  		goto unlock_vm;
>  	}
>  
> -- 
> 2.52.0
> 

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

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-11 19:23 [PATCH] drm/xe: Don't wedge shared engine on stale faults from torn-down VMs Sanjay Yadav
2026-09-11 19:39 ` sashiko-bot
2026-09-11 19:51 ` ✓ CI.KUnit: success for " Patchwork
2026-09-11 20:43 ` ✓ Xe.CI.BAT: " Patchwork
2026-09-11 20:45 ` Matthew Brost [this message]
2026-09-14 10:35   ` [PATCH] " Yadav, Sanjay Kumar
2026-09-12  5:42 ` ✓ Xe.CI.FULL: success for " 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=aqRoWdaMm1VH1OW0@gsse-cloud1.jf.intel.com \
    --to=matthew.brost@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=sanjay.kumar.yadav@intel.com \
    --cc=stuart.summers@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;
as well as URLs for NNTP newsgroup(s).