From: Matt Roper <matthew.d.roper@intel.com>
To: intel-xe@lists.freedesktop.org
Cc: matthew.d.roper@intel.com, Riana Tauro <riana.tauro@intel.com>
Subject: [PATCH v4 1/7] drm/xe/pmu: Fix GT sanity check in event_supported()
Date: Tue, 1 Jul 2025 13:13:22 -0700 [thread overview]
Message-ID: <20250701201320.2514369-10-matthew.d.roper@intel.com> (raw)
In-Reply-To: <20250701201320.2514369-9-matthew.d.roper@intel.com>
event_supported() tries to ensure that the GT ID passed is valid by
comparing against XE_MAX_GT_PER_TILE. However this does not account
for cases where a GT ID is within the proper range, but still references
a non-existent / fused-off GT (e.g., GT ID = 1 on a PVC platform with
only a single tile). Switch the check to an actual GT lookup
so that EINVAL will be returned properly for all non-existent GTs.
Cc: Riana Tauro <riana.tauro@intel.com>
Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
---
drivers/gpu/drm/xe/xe_pmu.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/xe/xe_pmu.c b/drivers/gpu/drm/xe/xe_pmu.c
index 69df0e3520a5..cab51d826345 100644
--- a/drivers/gpu/drm/xe/xe_pmu.c
+++ b/drivers/gpu/drm/xe/xe_pmu.c
@@ -157,10 +157,13 @@ static bool event_gt_forcewake(struct perf_event *event)
return true;
}
-static bool event_supported(struct xe_pmu *pmu, unsigned int gt,
+static bool event_supported(struct xe_pmu *pmu, unsigned int gt_id,
unsigned int id)
{
- if (gt >= XE_MAX_GT_PER_TILE)
+ struct xe_device *xe = container_of(pmu, typeof(*xe), pmu);
+ struct xe_gt *gt = xe_device_get_gt(xe, gt_id);
+
+ if (!gt)
return false;
return id < sizeof(pmu->supported_events) * BITS_PER_BYTE &&
--
2.49.0
next prev parent reply other threads:[~2025-07-01 20:13 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-01 20:13 [PATCH v4 0/7] Future-proof for multi-tile + multi-GT cases Matt Roper
2025-07-01 20:13 ` Matt Roper [this message]
2025-07-01 20:13 ` [PATCH v4 2/7] drm/xe: Export xe_step_name for kunit tests Matt Roper
2025-07-01 20:13 ` [PATCH v4 3/7] drm/xe: Track maximum GTs per tile on a per-platform basis Matt Roper
2025-07-01 20:13 ` [PATCH v4 4/7] drm/xe/tests/pci: Ensure all platforms have a valid GT/tile count Matt Roper
2025-07-01 20:13 ` [PATCH v4 5/7] drm/xe: Assign GT IDs properly on multi-tile + multi-GT platforms Matt Roper
2025-07-01 20:13 ` [PATCH v4 6/7] drm/xe: Don't compare GT ID to GT count when determining valid GTs Matt Roper
2025-07-01 20:13 ` [PATCH v4 7/7] drm/xe/xe_query: Use separate iterator while filling GT list Matt Roper
2025-07-01 20:18 ` ✗ CI.checkpatch: warning for Future-proof for multi-tile + multi-GT cases (rev6) Patchwork
2025-07-01 20:19 ` ✓ CI.KUnit: success " Patchwork
2025-07-02 5:09 ` ✗ CI.checkpatch: warning for Future-proof for multi-tile + multi-GT cases (rev7) Patchwork
2025-07-02 5:10 ` ✓ CI.KUnit: success " Patchwork
2025-07-02 6:01 ` ✓ Xe.CI.BAT: " Patchwork
2025-07-03 12:47 ` ✗ Xe.CI.Full: failure for Future-proof for multi-tile + multi-GT cases (rev6) Patchwork
2025-07-03 18:27 ` ✗ Xe.CI.Full: failure for Future-proof for multi-tile + multi-GT cases (rev7) 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=20250701201320.2514369-10-matthew.d.roper@intel.com \
--to=matthew.d.roper@intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=riana.tauro@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