All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Mallesh Koujalagi" <mallesh.koujalagi@intel.com>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v8 6/6] drm/xe/ras: Add debugfs entry to inject punit error
Date: Fri, 12 Jun 2026 08:23:40 +0000	[thread overview]
Message-ID: <20260612082341.1B78C1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260612080722.26726-14-mallesh.koujalagi@intel.com>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Medium] Unconditional registration of the `inject_punit_error` debugfs file exposes PF-only hardware operations to Virtual Functions (VFs) and ignores sysctrl capability checks.
- [Low] Missing forward declaration of `struct dentry` in `xe_ras.h` when `CONFIG_DRM_XE_DEBUG` is disabled.
--

commit 185b28acb4e5add829b3fd14f6a6416e4d2a9fe3
Author: Mallesh Koujalagi <mallesh.koujalagi@intel.com>

drm/xe/ras: Add debugfs entry to inject punit error
    
Add a write-only debugfs file 'inject_punit_error' under the DRI device
root that allows triggering punit_error_handler() manually for testing.
Writing 1 to the file invokes the handler, which suppresses spurious
Surprise Link Down AER events on slots and declares the
device wedged for a cold reset recovery.

> diff --git a/drivers/gpu/drm/xe/xe_ras.c b/drivers/gpu/drm/xe/xe_ras.c
> index 15c2fa0d323a6..281ef4dce2188 100644
> --- a/drivers/gpu/drm/xe/xe_ras.c
> +++ b/drivers/gpu/drm/xe/xe_ras.c
[ ... ]
> +void xe_ras_debugfs_register(struct xe_device *xe, struct dentry *root)
> +{
> +	debugfs_create_file("inject_punit_error", 0200, root, xe,
> +			    &inject_punit_error_fops);

[Severity: Medium]
Could this expose PF-only hardware operations to Virtual Functions (VFs)?

Writing to this debugfs file executes punit_error_handler(), which
manipulates the physical AER configuration on the Upstream Switch Port (USP)
via PCI config space and triggers a PCIe cold reset. According to SR-IOV
constraints, VFs must not access PF-only hardware resources like physical
PCIe bridge configurations.

Additionally, this doesn't check if the device actually supports sysctrl
before allowing the error injection. Should this function include an early
return guard like if (IS_SRIOV_VF(xe) || !xe->info.has_sysctrl) before
creating the file?

> +}
> +#endif /* CONFIG_DRM_XE_DEBUG */
[ ... ]
> diff --git a/drivers/gpu/drm/xe/xe_ras.h b/drivers/gpu/drm/xe/xe_ras.h
> index 8d106c708ff19..c9f84ef238c42 100644
> --- a/drivers/gpu/drm/xe/xe_ras.h
> +++ b/drivers/gpu/drm/xe/xe_ras.h
> @@ -16,4 +16,11 @@ void xe_ras_counter_threshold_crossed(struct xe_device *xe,
>  void xe_ras_init(struct xe_device *xe);
>  enum xe_ras_recovery_action xe_ras_process_errors(struct xe_device *xe);
>  
> +#ifdef CONFIG_DRM_XE_DEBUG
> +struct dentry;
> +void xe_ras_debugfs_register(struct xe_device *xe, struct dentry *root);
> +#else
> +static inline void xe_ras_debugfs_register(struct xe_device *xe, struct dentry *root) {}

[Severity: Low]
Does this cause a compiler warning when CONFIG_DRM_XE_DEBUG is disabled?

The forward declaration of struct dentry is inside the #ifdef block, but the
#else block uses struct dentry * in the parameter list of the static inline
function. In C, this scopes the struct declaration to the function prototype
itself if it wasn't previously declared.

Should the struct dentry; forward declaration be moved outside the #ifdef
block to ensure it is visible to the inline stub?

> +#endif
> +
>  #endif

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260612080722.26726-8-mallesh.koujalagi@intel.com?part=6

  reply	other threads:[~2026-06-12  8:23 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-12  8:07 [PATCH v8 0/6] Introduce cold reset recovery method Mallesh Koujalagi
2026-06-12  8:07 ` [PATCH v8 1/6] Introduce Xe Uncorrectable Error Handling Mallesh Koujalagi
2026-06-12  8:24   ` sashiko-bot
2026-06-12  8:07 ` [PATCH v8 2/6] drm: Add DRM_WEDGE_RECOVERY_COLD_RESET recovery method Mallesh Koujalagi
2026-06-12  8:07 ` [PATCH v8 3/6] drm/doc: Document " Mallesh Koujalagi
2026-06-12  8:07 ` [PATCH v8 4/6] drm/xe: Handle PUNIT errors by requesting cold-reset recovery Mallesh Koujalagi
2026-06-12  8:27   ` sashiko-bot
2026-06-12  8:07 ` [PATCH v8 5/6] drm/xe: Suppress Surprise Link Down on device Mallesh Koujalagi
2026-06-12  8:21   ` sashiko-bot
2026-06-15  8:06   ` Tauro, Riana
2026-06-18 13:24   ` Raag Jadav
2026-06-12  8:07 ` [PATCH v8 6/6] drm/xe/ras: Add debugfs entry to inject punit error Mallesh Koujalagi
2026-06-12  8:23   ` sashiko-bot [this message]
2026-06-12  8:16 ` ✗ CI.checkpatch: warning for Introduce cold reset recovery method (rev8) Patchwork
2026-06-12  8:18 ` ✓ CI.KUnit: success " Patchwork
2026-06-12  9:03 ` ✓ Xe.CI.BAT: " Patchwork
2026-06-13  1:18 ` ✓ 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=20260612082341.1B78C1F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=mallesh.koujalagi@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.