From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 93FAB606A322 for ; Fri, 4 Dec 2026 15:09:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=UIKwPRV9 Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5364311307D; Fri, 4 Dec 2026 15:09:17 +0000 (UTC) Received: from tor.source.kernel.org (tor.source.kernel.org [172.105.4.254]) by gabe.freedesktop.org (Postfix) with ESMTPS id 235E210EBF7 for ; Fri, 4 Dec 2026 15:09:11 +0000 (UTC) Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by tor.source.kernel.org (Postfix) with ESMTP id 4E82760D42; Fri, 4 Dec 2026 15:09:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EC71E1F000C2; Fri, 4 Dec 2026 15:09:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796396950; bh=W5MvY7ZDqmYjlwrlOWZ/PW2ZgyS/XBf2lTBbPwAF0Gc=; h=From:Subject:Reply-To:To:In-Reply-To:References:Date; b=UIKwPRV9byoKZnFedOD5fMuGRiX7cFMNxDOTb8TQdbMS/7SGXmNlscKJYMySqgJ0k ZZiBDxvVC6wd6BzV071XiRAn0455gOhU3Rxgb3QMvAmVWU1Izgee1JoOtnHT0Uq8f3 w7VMXAi1d2VAlzB27PGQTsu/WwSGT6khbHhlV9L6c4j1fWbqD2Y5VWtg6aX5nWwO4z 3T0BNVpXDQLn1F0CyhJYWvzClY97eFc7HkOCMDsvggOmKhv8yvGweM/Y3QdHUIbT+E ENTzkIKgiEQAN8iAUKo1WscVr8Psn7zBbXtmm5DGZmuBysosQBnCs4alZM/Up0jYma tgnmsZKjVKK6w== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [RFC 01/11] drm/xe/pf: Allow VF access to GuC timestamp registers To: "Satyanarayana K V P" , intel-xe@lists.freedesktop.org In-Reply-To: <20261204144712.3520695-14-satyanarayana.k.v.p@intel.com> References: <20261204144712.3520695-13-satyanarayana.k.v.p@intel.com> <20261204144712.3520695-14-satyanarayana.k.v.p@intel.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Fri, 04 Dec 2026 15:09:09 +0000 X-BeenThere: intel-xe@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel Xe graphics driver List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: sashiko-reviews@lists.linux.dev Sender: "Intel-xe" X-Spam-Status: No, score=-11.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 X-Archived-By: 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 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/dr= m/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[] =3D { > 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) */ > }; > =20 > static const struct xe_reg *pick_runtime_regs(struct xe_device *xe, unsi= gned 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] =3D new_lo pf_service_runtime_query() read values[LO] (new_lo) read values[HI] (old_hi) <-- data race values[HI] =3D 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 >=3D 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. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261204144712.3520= 695-13-satyanarayana.k.v.p@intel.com?part=3D1