From: sashiko-bot@kernel.org
To: "Raag Jadav" <raag.jadav@intel.com>, intel-xe@lists.freedesktop.org
Subject: Re: [PATCH v14 8/9] drm/xe: Introduce xe_wedge
Date: Thu, 22 Oct 2026 05:33:22 +0000 [thread overview]
Message-ID: <sashiko-outbox-181032@kernel.org> (raw)
In-Reply-To: <20261022051303.282805-9-raag.jadav@intel.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] drm/xe: xe_wedge_init() registers dev-bound cleanup via drmm instead of devm
--
commit 57c0533228e6ea2dcc2823e52de07399929877cf
Author: Raag Jadav <raag.jadav@intel.com>
drm/xe: Introduce xe_wedge
This commit consolidates the device wedging implementation into a dedicated
xe_wedge component and renames the wedge helper functions to match the
component namespace.
> diff --git a/drivers/gpu/drm/xe/xe_wedge.c b/drivers/gpu/drm/xe/xe_wedge.c
> new file mode 100644
> index 0000000000000..2f35937c5e661
> --- /dev/null
> +++ b/drivers/gpu/drm/xe/xe_wedge.c
> @@ -0,0 +1,262 @@
[ ... ]
> +static void xe_wedge_fini(struct drm_device *drm, void *arg)
> +{
> + struct xe_device *xe = arg;
> +
> + disable_work_sync(&xe->wedged.work);
> +
> + if (atomic_read(&xe->wedged.flag))
> + xe_pm_runtime_put(xe);
> +}
> +
> +/**
> + * xe_wedge_init() - Initialize wedge
> + * @xe: xe device instance
> + *
> + * Returns: 0 on success, negative error code otherwise.
> + */
> +int xe_wedge_init(struct xe_device *xe)
> +{
> + INIT_WORK(&xe->wedged.work, wedge_work);
> +
> + xe->wedged.mode = wedge_validate_mode(xe, xe_modparam.wedged_mode) ?
> + XE_DEFAULT_WEDGED_MODE : xe_modparam.wedged_mode;
> + xe_dbg(xe, "wedged_mode: setting mode (%u) %s\n",
> + xe->wedged.mode, wedge_mode_to_string(xe->wedged.mode));
> +
> + return drmm_add_action_or_reset(&xe->drm, xe_wedge_fini, xe);
> +}
[Severity: Medium]
Should xe_wedge_init() in drivers/gpu/drm/xe/xe_wedge.c register
xe_wedge_fini() via devm_add_action_or_reset(xe->drm.dev, ...) rather than
drmm_add_action_or_reset(&xe->drm, ...)?
When the device is wedged via xe_wedge_declare() or
prepare_device_for_reset() in drivers/gpu/drm/xe/xe_pci_error.c,
xe->wedged.flag is set to 1, xe_pm_runtime_get_noresume(xe) increments the
runtime pm usage count on the underlying pci device (xe->drm.dev), and
xe_wedge_declare() schedules xe->wedged.work:
drivers/gpu/drm/xe/xe_pci_error.c:prepare_device_for_reset() {
if (!atomic_xchg(&xe->wedged.flag, 1))
xe_pm_runtime_get_noresume(xe);
}
If any userspace process still holds an open drm file descriptor (or a
dma-buf reference) when the driver is unbound for recovery
(DRM_WEDGE_RECOVERY_REBIND) or when xe_pci_error_slot_reset() runs:
drivers/gpu/drm/xe/xe_pci_error.c:xe_pci_error_slot_reset() {
...
xe_device_clear_in_reset(xe);
pdev->driver->remove(pdev);
devres_release_group(&pdev->dev, xe->devres_group);
if (pdev->driver->probe(pdev, ent))
return PCI_ERS_RESULT_DISCONNECT;
...
}
the open drm file keeps a reference on xe->drm, so drm_managed_release() and
xe_wedge_fini() do not run during driver teardown.
Can this delay disable_work_sync(&xe->wedged.work) past drm_dev_unplug() and
leak the runtime pm reference on pdev->dev across driver unbind or slot
reset, only decrementing pdev->dev.power.usage_count later when the stale
drm file descriptor is closed?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261022051303.282805-1-raag.jadav@intel.com?part=8
next prev parent reply other threads:[~2026-10-22 5:33 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-22 5:12 [PATCH v14 0/9] Introduce xe_wedge Raag Jadav
2026-10-22 5:12 ` [PATCH v14 1/9] drm/xe/gt: Use GT ordered workqueue for wedging Raag Jadav
2026-10-22 5:12 ` [PATCH v14 2/9] drm/xe: Drop xe_device_set_wedged_method() Raag Jadav
2026-10-22 5:12 ` [PATCH v14 3/9] drm/xe/hw_error: Guard csc_hw_error_work() with runtime PM Raag Jadav
2026-10-22 5:12 ` [PATCH v14 4/9] drm/xe: Move xe_device_wedged_fini() registration to xe_device_probe_early() Raag Jadav
2026-10-22 5:12 ` [PATCH v14 5/9] drm/xe: Make xe_device_declare_wedged() IRQ safe Raag Jadav
2026-10-22 5:12 ` [PATCH v14 6/9] drm/xe/pci_error: Flush GT wedge worker before bus reset Raag Jadav
2026-10-22 5:12 ` [PATCH v14 7/9] drm/xe/amc: Guard xe_amc_work() with runtime PM Raag Jadav
2026-10-22 5:12 ` [PATCH v14 8/9] drm/xe: Introduce xe_wedge Raag Jadav
2026-10-22 5:33 ` sashiko-bot [this message]
2026-10-22 5:12 ` [PATCH v14 9/9] drm/xe/ras: Move xe_ras_process_errors() to xe_ras Raag Jadav
2026-10-22 5:27 ` sashiko-bot
2026-10-22 5:20 ` ✗ CI.checkpatch: warning for Introduce xe_wedge (rev13) Patchwork
2026-10-22 5:23 ` ✓ CI.KUnit: success " Patchwork
2026-10-22 5:59 ` ✓ Xe.CI.BAT: " Patchwork
2026-10-22 10:03 ` ✓ Xe.CI.FULL: " Patchwork
2026-10-22 17:45 ` [PATCH v14 0/9] Introduce xe_wedge Matt Roper
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=sashiko-outbox-181032@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=intel-xe@lists.freedesktop.org \
--cc=raag.jadav@intel.com \
--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 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.