Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Sk Anirban" <sk.anirban@intel.com>
Cc: intel-xe@lists.freedesktop.org
Subject: Re: [PATCH v3] drm/xe/debugfs: Expose per-engine idle status
Date: Tue, 08 Sep 2026 06:29:52 +0000	[thread overview]
Message-ID: <20260908062953.24D2E1F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260908060103.999079-2-sk.anirban@intel.com>

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

New issues:
- [Medium] Debugfs output misinterprets fw_req status by ignoring validity mask bits in MSG_IDLE registers.

Pre-existing issues:
- [High] Concurrent execution of `hw_engines` debugfs read corrupts the global device coredump state `devcoredump->snapshot.matched_node`.
--

commit d11426316eb2739da991f6532a22c6e266b48954
Author: Sk Anirban <sk.anirban@intel.com>

drm/xe/debugfs: Expose per-engine idle status
    
Extend the existing "hw_engines" debugfs to iterate over all hardware
engines and dump their idle state: whether the engine pipe is idle or
busy, whether C6 entry is allowed, and (where available) the forcewake
request status.

> diff --git a/drivers/gpu/drm/xe/xe_gt_debugfs.c b/drivers/gpu/drm/xe/xe_gt_debugfs.c
> index 361a70234d1f1..27ee20b03d4ae 100644
> --- a/drivers/gpu/drm/xe/xe_gt_debugfs.c
> +++ b/drivers/gpu/drm/xe/xe_gt_debugfs.c
[ ... ]
> @@ -124,9 +156,27 @@ static int hw_engines(struct xe_gt *gt, struct drm_printer *p)
>  	if (!xe_force_wake_ref_has_domain(fw_ref.domains, XE_FORCEWAKE_ALL))
>  		return -ETIMEDOUT;
>  
> -	for_each_hw_engine(hwe, gt, id)
> +	for_each_hw_engine(hwe, gt, id) {
> +		struct xe_reg reg = msg_idle_reg[id].reg;
> +		u32 val;
> +
>  		xe_hw_engine_print(hwe, p);

[Severity: High]
This isn't a bug introduced by this patch, but can this debugfs read corrupt
the global device coredump state?

When hw_engines() calls xe_hw_engine_print(), it captures an engine
snapshot via xe_engine_manual_capture(). This unconditionally assigns
devcoredump->snapshot.matched_node = new globally without taking the
&devcoredump->lock.

Afterward, it calls xe_hw_engine_snapshot_free(), which explicitly frees
devcoredump->snapshot.matched_node and nullifies it. If a legitimate GPU
hang triggers xe_devcoredump() concurrently, could its matched_node be
overwritten or freed out from under it?

> +		val = xe_mmio_read32(&gt->mmio, reg);
> +
> +		if (msg_idle_reg[id].has_fw)
> +			drm_printf(p, "\tpipe %s, C6 %s, fw_req 0x%02x\n",
> +				   val & MSG_IDLE_INDICATION ? "idle" : "busy",
> +				   val & MSG_IDLE_C6_ALLOWED ? "allowed" : "not allowed",
> +				   REG_FIELD_GET(MSG_IDLE_FW_STATUS, val));

[Severity: Medium]
Does this field extraction read stale data by ignoring the validity mask?

The MSG_IDLE registers extract the forcewake status bits [13:9] using
REG_FIELD_GET(MSG_IDLE_FW_STATUS, val). However, the hardware design uses
bits [29:25] (val >> 16) as a validity mask for these status bits.

Without validating the status against its corresponding mask bit, could the
output reflect stale or invalid data left over in the register?

> +		else
> +			drm_printf(p, "\tpipe %s, C6 %s\n",
> +				   val & MSG_IDLE_INDICATION ? "idle" : "busy",
> +				   val & MSG_IDLE_C6_ALLOWED ? "allowed" : "not allowed");
> +
> +		drm_puts(p, "\n");
> +	}
> +
>  	return 0;
>  }

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260908060103.999079-2-sk.anirban@intel.com?part=1

  parent reply	other threads:[~2026-09-08  6:29 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-08  6:01 [PATCH v3] drm/xe/debugfs: Expose per-engine idle status Sk Anirban
2026-09-08  6:19 ` ✓ CI.KUnit: success for drm/xe/debugfs: Expose per-engine idle status (rev4) Patchwork
2026-09-08  6:29 ` sashiko-bot [this message]
2026-09-08  6:57 ` ✓ Xe.CI.BAT: " Patchwork
2026-09-08  8:20 ` ✓ Xe.CI.FULL: " Patchwork
2026-09-08  9:37 ` Patchwork
2026-09-10  1:08 ` [PATCH v3] drm/xe/debugfs: Expose per-engine idle status Belgaumkar, Vinay
2026-09-10  4:59   ` Anirban, Sk
  -- strict thread matches above, loose matches on Subject: below --
2026-09-10 16:58 Sk Anirban
2026-09-10 17:31 ` sashiko-bot

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=20260908062953.24D2E1F00A3A@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=sk.anirban@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