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 v10 2/4] drm: Add DRM_WEDGE_RECOVERY_COLD_RESET recovery method
Date: Mon, 13 Jul 2026 08:53:06 +0000	[thread overview]
Message-ID: <20260713085306.AF33D1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260713083939.251872-8-mallesh.koujalagi@intel.com>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:

New issues:
- [Medium] The patch introduces a new UAPI recovery method `DRM_WEDGE_RECOVERY_COLD_RESET` (`cold-reset`) but fails to document it in the DRM UAPI documentation.

Pre-existing issues:
- [High] The `event_string` buffer used for the `WEDGED=` uevent is fixed at 32 bytes (`WEDGE_STR_LEN`), which is too small to hold multiple recovery methods, leading to silent string truncation and malformed UAPI strings.
--

--- Patch [2]: [PATCH v10 2/4] drm: Add DRM_WEDGE_RECOVERY_COLD_RESET recovery method ---
commit 683268e37f79f71da69dfdeafdea583f1453ed24
Author: Mallesh Koujalagi <mallesh.koujalagi@intel.com>

drm: Add DRM_WEDGE_RECOVERY_COLD_RESET recovery method

Introduce DRM_WEDGE_RECOVERY_COLD_RESET (BIT(4)) recovery method to handle
scenarios requiring device power cycle.

> diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
> index 1ff0bf7cba6aa..94abe7a811a52 100644
> --- a/drivers/gpu/drm/drm_drv.c
> +++ b/drivers/gpu/drm/drm_drv.c
> @@ -537,6 +537,8 @@ static const char *drm_get_wedge_recovery(unsigned int opt)
>  		return "bus-reset";
>  	case DRM_WEDGE_RECOVERY_VENDOR:
>  		return "vendor-specific";
> +	case DRM_WEDGE_RECOVERY_COLD_RESET:
> +		return "cold-reset";

[Severity: High]
This is a pre-existing issue, but does adding a new recovery method increase
the risk of truncating the UAPI event string?

Looking at drm_dev_wedged_event(), the event_string buffer is fixed to 32
bytes (WEDGE_STR_LEN). If a driver sets multiple recovery methods (like rebind,
bus-reset, and cold-reset), their concatenated length plus "WEDGED=" could
easily exceed this limit:

drivers/gpu/drm/drm_drv.c:drm_dev_wedged_event() {
    ...
		len += scnprintf(event_string + len, sizeof(event_string) - len, "%s,", recovery);
	}

	if (recovery)
		/* Get rid of trailing comma */
		event_string[len - 1] = '\0';
    ...
}

When the buffer truncates, won't the trailing comma removal overwrite the last
valid character of the truncated string and result in malformed UAPI strings
being sent to userspace (e.g., "WEDGED=rebind,bus-reset,cold-r")?

[Severity: Medium]
Should this new recovery method also be documented in the UAPI documentation?

The current Recovery section table in Documentation/gpu/drm-uapi.rst lists all
other UAPI recovery methods and their expectations:

    =============== ========================================
    Recovery method Consumer expectations
    =============== ========================================
    none            optional telemetry collection
    rebind          unbind + bind driver
    bus-reset       unbind + bus reset/re-enumeration + bind
    vendor-specific vendor specific recovery method
    unknown         consumer policy
    =============== ========================================

Could "cold-reset" be added here so userspace consumers have official
documentation for implementing their recovery rules?

>  	default:
>  		return NULL;
>  	}

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

  reply	other threads:[~2026-07-13  8:53 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-13  8:39 [PATCH v10 0/4] Introduce cold reset recovery method Mallesh Koujalagi
2026-07-13  8:39 ` [PATCH v10 1/4] drm/xe/xe_ras: Do not Review, compilation only Mallesh Koujalagi
2026-07-13  8:54   ` sashiko-bot
2026-07-13  8:39 ` [PATCH v10 2/4] drm: Add DRM_WEDGE_RECOVERY_COLD_RESET recovery method Mallesh Koujalagi
2026-07-13  8:53   ` sashiko-bot [this message]
2026-07-13  8:39 ` [PATCH v10 3/4] drm/doc: Document " Mallesh Koujalagi
2026-07-13  8:47   ` sashiko-bot
2026-07-13  8:39 ` [PATCH v10 4/4] drm/xe: Handle PUNIT errors by requesting cold-reset recovery Mallesh Koujalagi
2026-07-13  8:54   ` sashiko-bot
2026-07-13  9:14 ` ✓ CI.KUnit: success for Introduce cold reset recovery method (rev10) Patchwork
2026-07-13  9:58 ` ✓ Xe.CI.BAT: " Patchwork
2026-07-13 11:54 ` ✓ 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=20260713085306.AF33D1F000E9@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.