From: Rodrigo Vivi <rodrigo.vivi@intel.com>
To: Gustavo Sousa <gustavo.sousa@intel.com>
Cc: <intel-xe@lists.freedesktop.org>,
Jonathan Cavitt <jonathan.cavitt@intel.com>
Subject: Re: [PATCH v2 2/2] drm/xe: Use for_each_gt to define gt_count
Date: Thu, 14 Aug 2025 16:01:05 -0400 [thread overview]
Message-ID: <aJ5AgVoVBitGGt3C@intel.com> (raw)
In-Reply-To: <20250728-gt_count-improvements-v2-2-78841ce8a81c@intel.com>
On Mon, Jul 28, 2025 at 03:29:06PM -0300, Gustavo Sousa wrote:
> We are currently bumping gt_count as we define GTs for each tile. While
> that works with our current code, there are reasons to improve that:
>
> * That section of the code is dedicated to define each tile's set of GTs
> and their respective info. The gt_count can be seen as a device level
> property. While it is fair to bump it as we define each GT, we can
> also focus on the GT themselves and count after we are done with the
> definitions.
>
> * More *importantly*, gt_count should reflect the number of GTs that we
> would get when looping over them with for_each_gt(). Bumping gt_count
> the way we are currently doing makes that value not really connected
> to for_each_gt(). This could bite us in the future if in the loop gets
> extra checks that are not accounted for in each existing "gt_count++".
>
> As such, let's use for_each_gt() and extract the calculation of gt_count
> into a separate block, just after we define the set of GTs for each
> tile.
>
> Reviewed-by: Jonathan Cavitt <jonathan.cavitt@intel.com>
> Signed-off-by: Gustavo Sousa <gustavo.sousa@intel.com>
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
> ---
> drivers/gpu/drm/xe/xe_pci.c | 9 +++++++--
> 1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/xe/xe_pci.c b/drivers/gpu/drm/xe/xe_pci.c
> index 0d7073a04bb2..12de65756599 100644
> --- a/drivers/gpu/drm/xe/xe_pci.c
> +++ b/drivers/gpu/drm/xe/xe_pci.c
> @@ -734,7 +734,6 @@ static int xe_info_init(struct xe_device *xe,
> gt->info.id = tile->id * xe->info.max_gt_per_tile;
> gt->info.has_indirect_ring_state = graphics_desc->has_indirect_ring_state;
> gt->info.engine_mask = graphics_desc->hw_engine_mask;
> - xe->info.gt_count++;
>
> err = xe_tile_alloc_vram(tile);
> if (err)
> @@ -759,9 +758,15 @@ static int xe_info_init(struct xe_device *xe,
> gt->info.id = tile->id * xe->info.max_gt_per_tile + 1;
> gt->info.has_indirect_ring_state = media_desc->has_indirect_ring_state;
> gt->info.engine_mask = media_desc->hw_engine_mask;
> - xe->info.gt_count++;
> }
>
> + /*
> + * Now that we have tiles and GTs defined, let's loop over valid GTs
> + * in order to define gt_count.
> + */
> + for_each_gt(gt, xe, id)
> + xe->info.gt_count++;
> +
> return 0;
> }
>
>
> --
> 2.50.1
>
next prev parent reply other threads:[~2025-08-14 20:01 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-28 18:29 [PATCH v2 0/2] Tile and GT counting improvements Gustavo Sousa
2025-07-28 18:29 ` [PATCH v2 1/2] drm/xe: Probe for tile count during device info initialization Gustavo Sousa
2025-07-28 18:33 ` Cavitt, Jonathan
2025-08-14 20:01 ` Rodrigo Vivi
2025-07-28 18:29 ` [PATCH v2 2/2] drm/xe: Use for_each_gt to define gt_count Gustavo Sousa
2025-08-14 20:01 ` Rodrigo Vivi [this message]
2025-07-28 18:54 ` ✓ CI.KUnit: success for Tile and GT counting improvements (rev2) Patchwork
2025-07-28 19:33 ` ✗ Xe.CI.BAT: failure " Patchwork
2025-07-28 22:26 ` ✗ Xe.CI.Full: " 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=aJ5AgVoVBitGGt3C@intel.com \
--to=rodrigo.vivi@intel.com \
--cc=gustavo.sousa@intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=jonathan.cavitt@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 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.