From: sashiko-bot@kernel.org
To: "Satyanarayana K V P" <satyanarayana.k.v.p@intel.com>,
intel-xe@lists.freedesktop.org
Subject: Re: [RFC 01/11] drm/xe/pf: Allow VF access to GuC timestamp registers
Date: Fri, 04 Dec 2026 15:09:09 +0000 [thread overview]
Message-ID: <sashiko-outbox-250062@kernel.org> (raw)
In-Reply-To: <20261204144712.3520695-14-satyanarayana.k.v.p@intel.com>
Thank you for your contribution! Sashiko AI review found 4 potential
issues to consider:
- [Medium] drm/xe: PF runtime cache returns frozen GuC timestamp to VFs
- [Low] drm/xe: torn 64-bit GuC timestamp read in read_many()
- [Low] drm/xe: lockless race on runtime.values in do_gt_restart()
- [Low] drm/xe: only ver_35_runtime_regs updated for GuC timestamp
--
commit 02a897024d2effcd581c20d41a369145f81023c5
Author: Satyanarayana K V P <satyanarayana.k.v.p@intel.com>
drm/xe/pf: Allow VF access to GuC timestamp registers
This commit adds GUC_PMTIMESTAMP_LO and GUC_PMTIMESTAMP_HI to
ver_35_runtime_regs[] in the PF SR-IOV runtime service so VFs can query
them for GuC log snapshots.
> diff --git a/drivers/gpu/drm/xe/xe_gt_sriov_pf_service.c b/drivers/gpu/drm/xe/xe_gt_sriov_pf_service.c
> index fba2d5e1e94c8..29249e6f7d41d 100644
> --- a/drivers/gpu/drm/xe/xe_gt_sriov_pf_service.c
> +++ b/drivers/gpu/drm/xe/xe_gt_sriov_pf_service.c
> @@ -115,6 +115,8 @@ static const struct xe_reg ver_35_runtime_regs[] = {
> XE3P_XPC_GT_COMPUTE_DSS_3, /* _MMIO(0x9160) */
> SERVICE_COPY_ENABLE, /* _MMIO(0x9170) */
> RESOURCE_COPY_ENABLE, /* _MMIO(0x9174) */
> + GUC_PMTIMESTAMP_LO, /* _MMIO(0xc3e8) */
> + GUC_PMTIMESTAMP_HI, /* _MMIO(0xc3ec) */
> };
>
> static const struct xe_reg *pick_runtime_regs(struct xe_device *xe, unsigned int *count)
[Severity: Medium]
Will caching GUC_PMTIMESTAMP_LO and GUC_PMTIMESTAMP_HI in
ver_35_runtime_regs[] return a frozen timestamp to VFs instead of the live
GuC timestamp?
The PF runtime register service is a static cache for immutable registers,
not a live MMIO allowlist. pf_prepare_runtime_info() reads these registers
only during PF GT init or reset/resume, and VFs fetch the cached values
once at probe via xe_gt_sriov_vf_query_runtime().
Because GUC_PMTIMESTAMP_LO and GUC_PMTIMESTAMP_HI do not set
XE_REG_OPTION_VF, every xe_mmio_read64_2x32() in
xe_guc_log_snapshot_capture() routes through xe_gt_sriov_vf_read32() and
returns that stale timestamp, breaking correlation with snapshot->ktime.
To provide a live timestamp, these registers would need XE_REG_OPTION_VF
(if hardware permits direct VF reads) or an on-demand query instead of
static caching.
[Severity: Low]
Can read_many() cache a torn 64-bit value for GUC_PMTIMESTAMP_LO and
GUC_PMTIMESTAMP_HI?
pf_prepare_runtime_info() populates runtime.values[] via read_many(), which
issues two plain consecutive xe_mmio_read32() calls without the upper-dword
rollover check used by xe_mmio_read64_2x32().
If the lower 32-bit counter wraps between the two reads during PF GT init
or reset, the PF caches a timestamp off by 2^32 ticks. VF
xe_mmio_read64_2x32() then silently accepts it because both upper-dword
reads return the same cached value.
[Severity: Low]
Does adding a changing 64-bit counter to runtime.values[] introduce a
lockless data race during PF GT reset or resume?
Previously ver_35_runtime_regs[] only held immutable fuse registers. In
do_gt_restart(), xe_uc_load_hw() re-enables GuC communication before
xe_gt_sriov_pf_init_hw() overwrites runtime.values[] in read_many() without
synchronization:
CPU0 (gt_reset_worker) CPU1 (xe->sriov.wq)
do_gt_restart()
xe_uc_load_hw()
xe_guc_enable_communication()
xe_gt_sriov_pf_init_hw()
...
read_many()
values[LO] = new_lo
pf_service_runtime_query()
read values[LO] (new_lo)
read values[HI] (old_hi) <-- data race
values[HI] = new_hi
A concurrent VF runtime query (or debugfs read in
xe_gt_sriov_pf_service_print_runtime()) can observe a torn 64-bit timestamp
mixing pre-reset and post-reset halves.
[Severity: Low]
Should GUC_PMTIMESTAMP_LO and GUC_PMTIMESTAMP_HI also be added to the
earlier platform tables in pick_runtime_regs(), or is this change meant
only for GRAPHICS_VER >= 35?
xe_guc_log_snapshot_capture() reads GUC_PMTIMESTAMP_LO on all platforms,
while this patch only updates ver_35_runtime_regs[] and does not mention
that restriction in the commit message. On pre-ver-35 SR-IOV platforms,
VFs miss in vf_lookup_reg(), receive 0 for the timestamp, and trigger
xe_gt_WARN() under CONFIG_DRM_XE_DEBUG.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261204144712.3520695-13-satyanarayana.k.v.p@intel.com?part=1
next prev parent reply other threads:[~2026-12-04 15:09 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-04 14:47 [RFC 00/11] Enable GuC log and debug error state capture for VF Satyanarayana K V P
2026-12-04 14:47 ` [RFC 01/11] drm/xe/pf: Allow VF access to GuC timestamp registers Satyanarayana K V P
2026-12-04 15:09 ` sashiko-bot [this message]
2026-12-04 14:47 ` [RFC 02/11] drm/xe/vf: Enable VF debug logging only on supported GUC versions Satyanarayana K V P
2026-12-04 15:22 ` sashiko-bot
2026-12-04 14:47 ` [RFC 03/11] drm/xe/guc: Add KLV definitions for GuC log and debug state capture Satyanarayana K V P
2026-12-04 15:34 ` sashiko-bot
2026-12-04 14:47 ` [RFC 04/11] drm/xe/pf: Enable VF debug logging only on supported GUC versions Satyanarayana K V P
2026-12-04 15:50 ` sashiko-bot
2026-12-04 14:47 ` [RFC 05/11] drm/xe/pf: Enable VF Guc log and debug state capture Satyanarayana K V P
2026-12-04 16:04 ` sashiko-bot
2026-12-04 14:47 ` [RFC 06/11] drm/xe/vf: Query and allocate VF GuC log and debug capture buffers Satyanarayana K V P
2026-12-04 16:31 ` sashiko-bot
2026-12-04 14:47 ` [RFC 07/11] drm/xe/vf: Register VF GuC log and debug state " Satyanarayana K V P
2026-12-04 17:04 ` sashiko-bot
2026-12-04 14:47 ` [RFC 08/11] drm/xe/vf: Initialize GuC logging buffers during GuC setup Satyanarayana K V P
2026-12-04 17:30 ` sashiko-bot
2026-12-04 14:47 ` [RFC 09/11] drm/xe/guc: Register VF-accessible registers for error capture Satyanarayana K V P
2026-12-04 17:52 ` sashiko-bot
2026-12-04 14:47 ` [RFC 10/11] drm/xe/guc: Handle GuC debug state capture notifications for VF Satyanarayana K V P
2026-12-04 18:13 ` sashiko-bot
2026-12-04 14:47 ` [RFC 11/11] drm/xe/guc: Process VF GuC error state captures Satyanarayana K V P
2026-12-04 18:41 ` sashiko-bot
2026-12-04 14:56 ` ✗ CI.checkpatch: warning for Enable GuC log and debug error state capture for VF Patchwork
2026-12-04 14:58 ` ✓ CI.KUnit: success " Patchwork
2026-12-04 15:34 ` ✗ Xe.CI.BAT: 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=sashiko-outbox-250062@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=intel-xe@lists.freedesktop.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=satyanarayana.k.v.p@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