Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Matthew Auld <matthew.auld@intel.com>
To: Sanjay Yadav <sanjay.kumar.yadav@intel.com>,
	intel-xe@lists.freedesktop.org
Subject: Re: [PATCH v2] drm/xe/migrate: Remove unneeded emit_pte() when copying CCS only
Date: Thu, 4 Sep 2025 17:28:04 +0100	[thread overview]
Message-ID: <1b4c6f27-2939-423f-a1f7-e5683d68e0d2@intel.com> (raw)
In-Reply-To: <20250904161423.2448727-1-sanjay.kumar.yadav@intel.com>

On 04/09/2025 17:14, Sanjay Yadav wrote:
> In xe_migrate_copy(), when copy_only_ccs is true, we only need two
> emit_pte() calls one for the BO and one for the raw CCS storage.
> However, the current implementation issues three emit_pte() calls,
> resulting in an unnecessary PTE programming job.
> 
> This fix removes the redundant emit_pte() call to avoid programming
> the same PTEs twice and reducing overhead during CCS-only migration.
> 
> v2: Preserve correct behavior on DG2, which requires both CCS and
> page copies.
> 
> Signed-off-by: Sanjay Yadav <sanjay.kumar.yadav@intel.com>
> Suggested-by: Matthew Auld <matthew.auld@intel.com>
> ---
>   drivers/gpu/drm/xe/xe_migrate.c | 16 ++++++++++------
>   1 file changed, 10 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/gpu/drm/xe/xe_migrate.c b/drivers/gpu/drm/xe/xe_migrate.c
> index 9643442ef101..a4b0187f856d 100644
> --- a/drivers/gpu/drm/xe/xe_migrate.c
> +++ b/drivers/gpu/drm/xe/xe_migrate.c
> @@ -842,11 +842,15 @@ struct dma_fence *xe_migrate_copy(struct xe_migrate *m,
>   		batch_size += pte_update_size(m, pte_flags, src, &src_it, &src_L0,
>   					      &src_L0_ofs, &src_L0_pt, 0, 0,
>   					      avail_pts);
> -
> -		pte_flags = dst_is_vram ? PTE_UPDATE_FLAG_IS_VRAM : 0;
> -		batch_size += pte_update_size(m, pte_flags, dst, &dst_it, &src_L0,
> -					      &dst_L0_ofs, &dst_L0_pt, 0,
> -					      avail_pts, avail_pts);
> +		if (copy_only_ccs) {
> +			dst_L0_ofs = src_L0_ofs;
> +		} else {
> +			pte_flags = dst_is_vram ? PTE_UPDATE_FLAG_IS_VRAM : 0;
> +			batch_size += pte_update_size(m, pte_flags, dst,
> +							&dst_it, &src_L0,
> +							&dst_L0_ofs, &dst_L0_pt,
> +							0, avail_pts, avail_pts);

Nit: I think the formatting/alignment is a little off here. No need to 
resend just for that though. Will fix up locally before pushing, 
assuming CI is now happy.

Reviewed-by: Matthew Auld <matthew.auld@intel.com>

> +		}
>   
>   		if (copy_system_ccs) {
>   			xe_assert(xe, type_device);
> @@ -876,7 +880,7 @@ struct dma_fence *xe_migrate_copy(struct xe_migrate *m,
>   
>   		if (dst_is_vram && xe_migrate_allow_identity(src_L0, &dst_it))
>   			xe_res_next(&dst_it, src_L0);
> -		else
> +		else if (!copy_only_ccs)
>   			emit_pte(m, bb, dst_L0_pt, dst_is_vram, copy_system_ccs,
>   				 &dst_it, src_L0, dst);
>   


  reply	other threads:[~2025-09-04 16:28 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-04 16:14 [PATCH v2] drm/xe/migrate: Remove unneeded emit_pte() when copying CCS only Sanjay Yadav
2025-09-04 16:28 ` Matthew Auld [this message]
2025-09-04 18:03 ` ✓ CI.KUnit: success for drm/xe/migrate: Remove unneeded emit_pte() when copying CCS only (rev2) Patchwork
2025-09-04 18:37 ` ✓ Xe.CI.BAT: " Patchwork
2025-09-05 11:16 ` ✓ 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=1b4c6f27-2939-423f-a1f7-e5683d68e0d2@intel.com \
    --to=matthew.auld@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=sanjay.kumar.yadav@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