Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Matthew Brost <matthew.brost@intel.com>
To: Matthew Auld <matthew.auld@intel.com>
Cc: intel-xe@lists.freedesktop.org, sashiko-bot@kernel.org,
	"Thomas Hellström" <thomas.hellstrom@linux.intel.com>,
	"Jan Maslak" <jan.maslak@intel.com>
Subject: Re: [PATCH] drm/xe/migrate: fix pte_update_cmd_size() for non-4K PAGE_SIZE
Date: Mon, 30 Nov 2026 09:05:13 -0800	[thread overview]
Message-ID: <aw2syX7S0ZbevUYC@gsse-cloud1.jf.intel.com> (raw)
In-Reply-To: <20261130-migrate-sram-pt-size-v1-1-ab3ff81590b1@intel.com>

On Mon, Nov 30, 2026 at 10:45:28AM +0000, Matthew Auld wrote:
> Fix the bb sizing in pte_update_cmd_size() to match what we emit in
> build_pt_update_batch_sram() on non-4K PAGE_SIZE hosts. For example,
> with 64K PAGE_SIZE we round down the number of GPU PTEs per SDI to
> be naturally aligned to 16, but that means we don't get the full
> MAX_PTE_PER_SDI (510) per packet, so we might need more SDI packets than
> we sized for in the bb.
> 
> Reported-by: sashiko-bot@kernel.org
> Closes: https://sashiko.dev/#/message/sashiko-outbox-237412%40kernel.org
> Fixes: 55991d854f65 ("drm/xe: Fix build_pt_update_batch_sram for non-4K PAGE_SIZE")
> Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
> Cc: Matthew Brost <matthew.brost@intel.com>

Just noticed this: looking emit_pte() - that function looks completely
busted for 64k pages but that is a different code path than what is
getting fixed here.

Anyways:
Reviewed-by: Matthew Brost <matthew.brost@intel.com>

> Cc: Jan Maslak <jan.maslak@intel.com>
> Cc: stable@vger.kernel.org # v6.19+
> Signed-off-by: Matthew Auld <matthew.auld@intel.com>
> ---
>  drivers/gpu/drm/xe/xe_migrate.c | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/xe/xe_migrate.c b/drivers/gpu/drm/xe/xe_migrate.c
> index 68a8107c2cb4..178750f49464 100644
> --- a/drivers/gpu/drm/xe/xe_migrate.c
> +++ b/drivers/gpu/drm/xe/xe_migrate.c
> @@ -2185,21 +2185,23 @@ void xe_migrate_wait(struct xe_migrate *m)
>  
>  static u32 pte_update_cmd_size(u64 size)
>  {
> -	u32 num_dword;
> +	u32 max_pte_per_sdi = ALIGN_DOWN(MAX_PTE_PER_SDI,
> +					 PAGE_SIZE / XE_PAGE_SIZE);
>  	u64 entries = DIV_U64_ROUND_UP(size, XE_PAGE_SIZE);
> +	u32 num_dword;
>  
>  	XE_WARN_ON(size > MAX_PREEMPTDISABLE_TRANSFER);
>  
>  	/*
>  	 * MI_STORE_DATA_IMM command is used to update page table. Each
> -	 * instruction can update maximumly MAX_PTE_PER_SDI pte entries. To
> -	 * update n (n <= MAX_PTE_PER_SDI) pte entries, we need:
> +	 * instruction can update at most max_pte_per_sdi pte entries. To
> +	 * update n (n <= max_pte_per_sdi) pte entries, we need:
>  	 *
>  	 * - 1 dword for the MI_STORE_DATA_IMM command header (opcode etc)
>  	 * - 2 dword for the page table's physical location
>  	 * - 2*n dword for value of pte to fill (each pte entry is 2 dwords)
>  	 */
> -	num_dword = (1 + 2) * DIV_U64_ROUND_UP(entries, MAX_PTE_PER_SDI);
> +	num_dword = (1 + 2) * DIV_U64_ROUND_UP(entries, max_pte_per_sdi);
>  	num_dword += entries * 2;
>  
>  	return num_dword;
> 
> ---
> base-commit: 0b5346358f32a8db281b9cb68e953dda79c9c1b0
> change-id: 20261127-migrate-sram-pt-size-81c96ec96306
> 

      parent reply	other threads:[~2026-11-30 17:05 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-30 10:45 [PATCH] drm/xe/migrate: fix pte_update_cmd_size() for non-4K PAGE_SIZE Matthew Auld
2026-11-30 11:27 ` ✓ CI.KUnit: success for " Patchwork
2026-11-30 12:03 ` ✓ Xe.CI.BAT: " Patchwork
2026-11-30 16:36 ` ✓ Xe.CI.FULL: " Patchwork
2026-11-30 17:05 ` Matthew Brost [this message]

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=aw2syX7S0ZbevUYC@gsse-cloud1.jf.intel.com \
    --to=matthew.brost@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=jan.maslak@intel.com \
    --cc=matthew.auld@intel.com \
    --cc=sashiko-bot@kernel.org \
    --cc=thomas.hellstrom@linux.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