From: sashiko-bot@kernel.org
To: "Arvind Yadav" <arvind.yadav@intel.com>
Cc: intel-xe@lists.freedesktop.org, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 13/13] drm/xe: Block BO VM access when device I/O is unavailable
Date: Thu, 27 Aug 2026 10:30:42 +0000 [thread overview]
Message-ID: <20260827103043.70FA71F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260827101801.1247654-14-arvind.yadav@intel.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] The function `xe_bo_vm_access` mixes goto-based error handling with scope-based cleanup helpers, violating kernel cleanup guidelines.
--
commit ab2c90ef1f693fb22833ef442c6ad80ec3443ca6
Author: Arvind Yadav <arvind.yadav@intel.com>
drm/xe: Block BO VM access when device I/O is unavailable
This commit modifies xe_bo_vm_access() to return -EIO when device I/O is
blocked. It uses drm_dev_enter() to protect against concurrent unplug and
protects the block with a userfault SRCU lock.
> diff --git a/drivers/gpu/drm/xe/xe_bo.c b/drivers/gpu/drm/xe/xe_bo.c
> index 1eabece56f6c6..717d318c7072d 100644
> --- a/drivers/gpu/drm/xe/xe_bo.c
> +++ b/drivers/gpu/drm/xe/xe_bo.c
> @@ -2245,9 +2245,25 @@ static int xe_bo_vm_access(struct vm_area_struct *vma, unsigned long addr,
> struct ttm_buffer_object *ttm_bo = vma->vm_private_data;
> struct xe_bo *bo = ttm_to_xe_bo(ttm_bo);
> struct xe_device *xe = xe_bo_device(bo);
> + int idx, srcu_idx, ret = -EIO;
>
> - guard(xe_pm_runtime)(xe);
> - return ttm_bo_vm_access(vma, addr, buf, len, write);
> + srcu_idx = srcu_read_lock(&xe->mem_access.vram_userfault.srcu);
> +
> + if (xe_device_io_blocked(xe) || !drm_dev_enter(&xe->drm, &idx))
> + goto out_srcu;
> +
> + /*
> + * Keep the drm_dev_enter() protection until the runtime PM
> + * reference has been released.
> + */
> + scoped_guard(xe_pm_runtime, xe)
> + ret = ttm_bo_vm_access(vma, addr, buf, len, write);
[Severity: Low]
Does this mix goto-based error handling with scope-based cleanup helpers in
xe_bo_vm_access()?
According to the cleanup guidelines in include/linux/cleanup.h, the usage
of goto and scope-based cleanup helpers should never be mixed in the same
function.
Could this create confusing ownership semantics or risk subtle ordering bugs
on scope exit? To maintain consistency, would it be better to convert all
resources in this function to scope-based cleanup, or stick entirely to
goto-based cleanup?
> +
> + drm_dev_exit(idx);
> +
> +out_srcu:
> + srcu_read_unlock(&xe->mem_access.vram_userfault.srcu, srcu_idx);
> + return ret;
> }
>
> /**
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260827101801.1247654-1-arvind.yadav@intel.com?part=13
next prev parent reply other threads:[~2026-08-27 10:30 UTC|newest]
Thread overview: 28+ 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-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-08-27 10:17 ` [PATCH 03/13] drm/xe: Drop queued page faults when device I/O is blocked Arvind Yadav
2026-08-27 10:17 ` [PATCH 04/13] drm/xe: Stop VM work " Arvind Yadav
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-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-27 10:17 ` [PATCH 11/13] drm/xe/guc: Skip timeout recovery on a wedged device Arvind Yadav
2026-08-27 10:18 ` [PATCH 12/13] drm/xe: Skip PM notifier preparation for wedged devices Arvind Yadav
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 [this message]
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
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=20260827103043.70FA71F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=arvind.yadav@intel.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-xe@lists.freedesktop.org \
--cc=sashiko-reviews@lists.linux.dev \
/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