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: Thu, 10 Sep 2026 17:31:52 +0000	[thread overview]
Message-ID: <20260910173152.E1BBB1F00893@smtp.kernel.org> (raw)
In-Reply-To: <20260910165855.1124574-2-sk.anirban@intel.com>

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

New issues:
- [Medium] Incorrect forcewake request status extraction due to missing validity mask.

Pre-existing issues:
- [High] Lockless linked list corruption and data race on singleton `devcoredump->snapshot.matched_node`.
--

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

drm/xe/debugfs: Expose per-engine idle status

This commit extends the hw_engines debugfs to iterate over hardware engines
and dump their idle state, including whether the engine pipe is idle or busy,
if C6 entry is allowed, and 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 bb09e70ee44c0..405cc076d8431 100644
> --- a/drivers/gpu/drm/xe/xe_gt_debugfs.c
> +++ b/drivers/gpu/drm/xe/xe_gt_debugfs.c
[ ... ]
> @@ -126,9 +158,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 is a pre-existing issue, but does exposing this in the hw_engines
debugfs risk triggering a lockless list corruption or data race?

Multiple concurrent reads to the hw_engines debugfs file will call into
xe_hw_engine_print(), which can eventually call xe_engine_manual_capture():

xe_hw_engine_print()
  ...
  -> xe_engine_manual_capture()
       -> guc_capture_get_prealloc_node()
          list_del() // on cachelist locklessly

xe_engine_manual_capture() also locklessly mutates outlist and overwrites
the shared devcoredump->snapshot.matched_node without synchronization:

    guc_capture_add_node_to_outlist(guc->capture, new);
    devcoredump->snapshot.matched_node = new;

Could this lead to a kernel panic via linked list corruption or
use-after-free if userspace reads this debugfs file concurrently?

>  
> +		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_REQ, val));

[Severity: Medium]
Does this correctly extract the forcewake request status without applying
the required hardware validity mask?

The hardware uses the upper 16 bits of the register as validity indicators
for the lower bits. Ignoring them and directly reading the MSG_IDLE_FW_REQ
field (bits 13:9) might result in reading potentially garbage or stale state.

Should this check the upper 16-bit validity mask (bits 29:25) before
extracting the lower bits for the debugfs output?

> +		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/20260910165855.1124574-2-sk.anirban@intel.com?part=1

  parent reply	other threads:[~2026-09-10 17:31 UTC|newest]

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

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=20260910173152.E1BBB1F00893@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