All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Nareshkumar Gollakoti" <naresh.kumar.g@intel.com>
Cc: intel-xe@lists.freedesktop.org
Subject: Re: [PATCH 6/6] drm/xe: capture L3 node status registers in devcoredump
Date: Thu, 13 Aug 2026 14:37:01 +0000	[thread overview]
Message-ID: <20260813143702.50E831F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260813133037.2912699-7-naresh.kumar.g@intel.com>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] Capturing MCR registers in the devcoredump snapshot triggers a kernel assertion failure (BUG/WARN) when executed in an SR-IOV Virtual Function (VF) environment.
- [Medium] MCR registers are incorrectly defined as regular `XE_REG` instead of `XE_REG_MCR`, bypassing the subsystem's compile-time type safety.
--

--- Patch [6]: [PATCH 6/6] drm/xe: capture L3 node status registers in devcoredump ---
commit a45fb5f7ed9065191b925af139e27c7fca72cb39
Author: Nareshkumar Gollakoti <naresh.kumar.g@intel.com>

drm/xe: capture L3 node status registers in devcoredump

This commit adds L3_NODE_IDLE and L3STAT_LBCF_GFX register definitions
and includes them in the devcoredump node status section. It also
extends the register descriptor to mark MCR registers, allowing the
snapshot code to read them using xe_gt_mcr_unicast_read_any().

> diff --git a/drivers/gpu/drm/xe/regs/xe_gt_regs.h b/drivers/gpu/drm/xe/regs/xe_gt_regs.h
> index 8c55d766a5a63..fdd0817919617 100644
> --- a/drivers/gpu/drm/xe/regs/xe_gt_regs.h
> +++ b/drivers/gpu/drm/xe/regs/xe_gt_regs.h
> @@ -430,6 +430,9 @@
>  #define   L3_ESC_MASK				REG_BIT(0)
>  #define   L3_ESC(value)				REG_FIELD_PREP(L3_ESC_MASK, value)
>  
> +#define L3_NODE_IDLE				XE_REG(0xb0b0)
> +#define L3STAT_LBCF_GFX				XE_REG(0xb128)
> +

[Severity: Medium]
Should these registers be defined using XE_REG_MCR instead of XE_REG?

Defining them with XE_REG bypasses the compile-time type safety intended
for multicast/replicated registers.

>  #define XEHP_L3NODEARBCFG			XE_REG_MCR(0xb0b4)
>  #define   XEHP_LNESPARE				REG_BIT(19)

[ ... ]

> diff --git a/drivers/gpu/drm/xe/xe_devcoredump.c b/drivers/gpu/drm/xe/xe_devcoredump.c
> index 6cc4e3969417e..ab8cd7d589646 100644
> --- a/drivers/gpu/drm/xe/xe_devcoredump.c
> +++ b/drivers/gpu/drm/xe/xe_devcoredump.c

[ ... ]

> @@ -83,6 +84,8 @@ struct xe_reg_desc {
>  	struct xe_reg reg;
>  	/** @name: Name of the register */
>  	const char *name;
> +	/** @mcr: mcr type registers */
> +	bool mcr;
>  };

[Severity: Medium]
Does adding this boolean flag subvert the existing type safety architecture?

The struct xe_reg already contains an mcr bitfield which is automatically
populated when registers are correctly defined with XE_REG_MCR. Adding a
separate flag forces the code to manually cast the address back into an MCR
register at runtime, losing the intended compiler type checks.

[ ... ]

> @@ -156,7 +164,12 @@ xe_capture_reg_desc_list(struct xe_gt *gt,
>  
>  	for (i = 0; i < count; i++) {
>  		dst[i].reg = src[i].reg;
> -		dst[i].value = xe_mmio_read32(&gt->mmio, src[i].reg);
> +		if (src[i].mcr)
> +			dst[i].value = xe_gt_mcr_unicast_read_any(gt,
> +								  XE_REG_MCR
> +								  (src[i].reg.addr));
> +		else
> +			dst[i].value = xe_mmio_read32(&gt->mmio, src[i].reg);
>  		dst[i].name = src[i].name;
>  	}
>  }

[Severity: High]
Can this path trigger a kernel assertion failure in an SR-IOV Virtual Function
environment?

Looking at xe_gt_mcr_unicast_read_any, it contains an explicit guard against
execution in a VF:

xe_gt_mcr_unicast_read_any(struct xe_gt *gt, struct xe_reg_mcr reg_mcr)
{
    ...
    xe_gt_assert(gt, !IS_SRIOV_VF(gt_to_xe(gt)));
    ...
}

Because devcoredumps can be triggered by unprivileged VF workloads causing a
GPU hang, executing this read could lead to unauthorized attempts to access
privileged steering registers, potentially causing MMIO timeouts and undefined
driver behavior.

[ ... ]

> @@ -266,6 +279,19 @@ static struct xe_dbg_reg_snapshot *xe_gam_pf_report_capture(struct xe_gt *gt)
>  	return xe_dbg_reg_snapshot_capture(gt, &reg_list);
>  }
>  
> +static struct xe_dbg_reg_snapshot *xe_node_status_capture(struct xe_gt *gt)
> +{
> +	struct xe_reg_desc_list reg_list;
> +
> +	if (!xe_dbg_reg_snapshot_is_supported(gt_to_xe(gt)))
> +		return NULL;
> +
> +	reg_list.regs = xe3p_l3_node_reglist;
> +	reg_list.num_regs = ARRAY_SIZE(xe3p_l3_node_reglist);
> +
> +	return xe_dbg_reg_snapshot_capture(gt, &reg_list);
> +}

[Severity: High]
Should this capture function include an early return guard for VFs?

Since capturing MCR registers is a PF-only operation, omitting an
IS_SRIOV_VF check here allows the snapshot code to unconditionally attempt
MCR reads, leading to the assertion failure mentioned above.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260813133037.2912699-1-naresh.kumar.g@intel.com?part=6

  reply	other threads:[~2026-08-13 14:37 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-13 13:30 [PATCH 0/6] drm/xe: Capture additional HW register state in devcoredump Nareshkumar Gollakoti
2026-08-13 13:30 ` [PATCH 1/6] drm/xe/devcoredump: Capture GT fuse registers " Nareshkumar Gollakoti
2026-08-13 13:52   ` sashiko-bot
2026-08-13 13:30 ` [PATCH 2/6] drm/xe/devcoredump: Add GuC register snapshot to devcoredump Nareshkumar Gollakoti
2026-08-13 14:04   ` sashiko-bot
2026-08-13 13:30 ` [PATCH 3/6] drm/xe/guc: Print register addresses in capture snapshot output Nareshkumar Gollakoti
2026-08-13 14:11   ` sashiko-bot
2026-08-13 13:30 ` [PATCH 4/6] drm/xe: dump GAM page fault report registers in devcoredump Nareshkumar Gollakoti
2026-08-13 13:30 ` [PATCH 5/6] drm/xe/guc: add TDL gfx registers to capture list Nareshkumar Gollakoti
2026-08-13 14:25   ` sashiko-bot
2026-08-13 13:30 ` [PATCH 6/6] drm/xe: capture L3 node status registers in devcoredump Nareshkumar Gollakoti
2026-08-13 14:37   ` sashiko-bot [this message]
2026-08-13 13:39 ` ✓ CI.KUnit: success for drm/xe: Capture additional HW register state " Patchwork
2026-08-13 14:27 ` ✓ Xe.CI.BAT: " Patchwork
2026-08-13 15:58 ` ✗ Xe.CI.FULL: failure " 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=20260813143702.50E831F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=naresh.kumar.g@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.