Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Ghimiray, Himal Prasad" <himal.prasad.ghimiray@intel.com>
To: Matthew Brost <matthew.brost@intel.com>,
	<intel-xe@lists.freedesktop.org>
Subject: Re: [PATCH] drm/xe: Invalidate media_gt TLBs
Date: Mon, 19 Aug 2024 16:49:31 +0530	[thread overview]
Message-ID: <ec7a7f35-ec49-4824-b888-2d28617ba20c@intel.com> (raw)
In-Reply-To: <20240817210451.278887-1-matthew.brost@intel.com>



On 18-08-2024 02:34, Matthew Brost wrote:
> Testing on LNL has shown media TLBs need to be invalidated via the GuC,
> update xe_vm_invalidate_vma appropriately.
> 
> Fixes: 3330361543fc ("drm/xe/lnl: Add LNL platform definition")
> Signed-off-by: Matthew Brost <matthew.brost@intel.com>
> ---
>   drivers/gpu/drm/xe/xe_vm.c | 42 +++++++++++++++++++++++++++-----------
>   1 file changed, 30 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/gpu/drm/xe/xe_vm.c b/drivers/gpu/drm/xe/xe_vm.c
> index 6dd76f77b504..ac98973a90cc 100644
> --- a/drivers/gpu/drm/xe/xe_vm.c
> +++ b/drivers/gpu/drm/xe/xe_vm.c
> @@ -3184,8 +3184,10 @@ int xe_vm_invalidate_vma(struct xe_vma *vma)
>   {
>   	struct xe_device *xe = xe_vma_vm(vma)->xe;
>   	struct xe_tile *tile;
> -	struct xe_gt_tlb_invalidation_fence fence[XE_MAX_TILES_PER_DEVICE];
> -	u32 tile_needs_invalidate = 0;
> +	struct xe_gt *gt;
> +	struct xe_gt_tlb_invalidation_fence
> +		fence[XE_MAX_TILES_PER_DEVICE * XE_MAX_GT_PER_TILE];


XE_MAX_TILES_PER_DEVICE * XE_MAX_GT_PER_TILE is not really needed.
Current driver code is with assumption that multi tile and multi gt (on 
same tile) are mutually exclusive.

But I see no harm with this and patch LGTM.
Reviewed-by: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>


> +	u32 gt_needs_invalidate = 0;
>   	u8 id;
>   	int ret = 0;
>   
> @@ -3211,29 +3213,45 @@ int xe_vm_invalidate_vma(struct xe_vma *vma)
>   	}
>   
>   	for_each_tile(tile, xe, id) {
> +		u32 fence_id = id * XE_MAX_TILES_PER_DEVICE;
> +
>   		if (xe_pt_zap_ptes(tile, vma)) {
>   			xe_device_wmb(xe);
>   			xe_gt_tlb_invalidation_fence_init(tile->primary_gt,
> -							  &fence[id], true);
> +							  &fence[fence_id],
> +							  true);
>   
> -			/*
> -			 * FIXME: We potentially need to invalidate multiple
> -			 * GTs within the tile
> -			 */
>   			ret = xe_gt_tlb_invalidation_vma(tile->primary_gt,
> -							 &fence[id], vma);
> +							 &fence[fence_id], vma);
> +			if (ret < 0) {
> +				xe_gt_tlb_invalidation_fence_fini(&fence[fence_id]);
> +				goto wait;
> +			}
> +
> +			gt_needs_invalidate |= BIT(fence_id);
> +
> +			if (!tile->media_gt)
> +				continue;
> +
> +			++fence_id;
> +			xe_gt_tlb_invalidation_fence_init(tile->media_gt,
> +							  &fence[fence_id],
> +							  true);
> +
> +			ret = xe_gt_tlb_invalidation_vma(tile->media_gt,
> +							 &fence[fence_id], vma);
>   			if (ret < 0) {
> -				xe_gt_tlb_invalidation_fence_fini(&fence[id]);
> +				xe_gt_tlb_invalidation_fence_fini(&fence[fence_id]);
>   				goto wait;
>   			}
>   
> -			tile_needs_invalidate |= BIT(id);
> +			gt_needs_invalidate |= BIT(fence_id);
>   		}
>   	}
>   
>   wait:
> -	for_each_tile(tile, xe, id)
> -		if (tile_needs_invalidate & BIT(id))
> +	for_each_gt(gt, xe, id)
> +		if (gt_needs_invalidate & BIT(id))
>   			xe_gt_tlb_invalidation_fence_wait(&fence[id]);
>   
>   	vma->tile_invalidated = vma->tile_mask;

  parent reply	other threads:[~2024-08-19 11:19 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-17 21:04 [PATCH] drm/xe: Invalidate media_gt TLBs Matthew Brost
2024-08-17 21:09 ` ✓ CI.Patch_applied: success for " Patchwork
2024-08-17 21:09 ` ✓ CI.checkpatch: " Patchwork
2024-08-17 21:10 ` ✓ CI.KUnit: " Patchwork
2024-08-17 21:22 ` ✓ CI.Build: " Patchwork
2024-08-17 21:24 ` ✓ CI.Hooks: " Patchwork
2024-08-17 21:26 ` ✓ CI.checksparse: " Patchwork
2024-08-17 22:08 ` ✓ CI.BAT: " Patchwork
2024-08-17 23:12 ` ✗ CI.FULL: failure " Patchwork
2024-08-19 11:19 ` Ghimiray, Himal Prasad [this message]
  -- strict thread matches above, loose matches on Subject: below --
2024-08-20 15:57 [PATCH] " Matthew Brost

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=ec7a7f35-ec49-4824-b888-2d28617ba20c@intel.com \
    --to=himal.prasad.ghimiray@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=matthew.brost@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