Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Poosa, Karthik" <karthik.poosa@intel.com>
To: Riana Tauro <riana.tauro@intel.com>, <intel-xe@lists.freedesktop.org>
Cc: <anshuman.gupta@intel.com>, <umesh.nerlige.ramappa@intel.com>,
	<sk.anirban@intel.com>, <soham.purkait@intel.com>
Subject: Re: drm/xe/xe_pmu: Validate gt in event supported
Date: Mon, 30 Jun 2025 21:03:45 +0530	[thread overview]
Message-ID: <c895113f-d502-46f3-8be2-7e5edec731e1@intel.com> (raw)
In-Reply-To: <20250630093741.2435281-1-riana.tauro@intel.com>

[-- Attachment #1: Type: text/plain, Size: 1146 bytes --]


On 30-06-2025 15:07, Riana Tauro wrote:
> Validate gt instead of checking gt_id is lesser
> than max gts per tile
>
> Signed-off-by: Riana Tauro<riana.tauro@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);

Looks like xe_device_get_gt() would return primary_gt handle, instead of NULL, if gt_id > 
XE_MAX_GT_PER_TILE. gt would be always valid then !

> +
> +	if (!gt)
>   		return false;
>   
>   	return id < sizeof(pmu->supported_events) * BITS_PER_BYTE &&

[-- Attachment #2: Type: text/html, Size: 1825 bytes --]

  reply	other threads:[~2025-06-30 15:34 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-30  9:37 [PATCH] drm/xe/xe_pmu: Validate gt in event supported Riana Tauro
2025-06-30 15:33 ` Poosa, Karthik [this message]
2025-06-30 16:32   ` Riana Tauro
2025-06-30 22:28 ` [PATCH] " Lucas De Marchi
2025-07-01  5:08   ` Riana Tauro
2025-07-01 20:31   ` Matt Roper
2025-07-01 21:09     ` Lucas De Marchi
2025-07-01 21:19       ` Matt Roper
2025-07-02  4:54         ` Riana Tauro
2025-06-30 23:49 ` ✓ CI.KUnit: success for " Patchwork
2025-07-01  0:42 ` ✓ Xe.CI.BAT: " Patchwork
2025-07-02 11:00 ` ✓ Xe.CI.Full: " Patchwork
2025-07-02 23:16   ` Matt Roper

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=c895113f-d502-46f3-8be2-7e5edec731e1@intel.com \
    --to=karthik.poosa@intel.com \
    --cc=anshuman.gupta@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=riana.tauro@intel.com \
    --cc=sk.anirban@intel.com \
    --cc=soham.purkait@intel.com \
    --cc=umesh.nerlige.ramappa@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