From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B568A606A32D for ; Tue, 1 Dec 2026 10:12:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=K7jmQccj Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7AFFB10F755; Tue, 1 Dec 2026 10:12:51 +0000 (UTC) Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.15]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7BE0510E994 for ; Tue, 1 Dec 2026 10:12:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1796119965; x=1827655965; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=/dnPSQdFrVWbHOqBPaGLm1Ea5RKN582o+JV6fQl0mC8=; b=K7jmQccj3cMY9y6AFMwjSdEZQvgGj68jWwyolkwQwdkB1hZOPSoeQxCa YBt2Rcbbq+dDsap2EEchcxQ2CAkMJ4iBDAVlblVBS6oMFAsRy4yGkMzfH cKU1lXOmJ/pd8ludDYwMgH0dJdPT+uOk13WdpQEqubUb4sIKrJUGeAqkw SbmSWktvBLwMMmNzFQ8Q9z/0YDqoRXm0LwBLUnfa0P+SVOi6uIoR7jdr2 IACYgsixeYBm0WvK/i6AjCcqub1aJVGpJqfqpgVgx1vfR+3ONZSpZjtf4 utb8/VRI2w+h8SGxjKvADe6/rKWUkpvYt8miC1XtYM431a9z/MGzHl3MO g==; X-CSE-ConnectionGUID: 4PehWOGJRlSPw2TPVJjhDw== X-CSE-MsgGUID: OwCjD6LjS0OE1DnRCZfojg== X-IronPort-AV: E=McAfee;i="6800,10657,11982"; a="4978961" X-IronPort-AV: E=Sophos;i="6.27,244,1787036400"; d="scan'208";a="4978961" Received: from fmviesa002.fm.intel.com ([10.60.135.142]) by orvoesa107.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Dec 2026 02:12:44 -0800 X-CSE-ConnectionGUID: 3+F8HxDxSp+ccnSMreBxoQ== X-CSE-MsgGUID: e60NJCr+R5qx+q1KXK5Khg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.27,244,1787036400"; d="scan'208";a="13430965" Received: from amilburn-desk.amilburn-desk (HELO [10.245.245.0]) ([10.245.245.0]) by smtpauth.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Dec 2026 02:12:42 -0800 Message-ID: <974f168f-7a45-4196-83de-ea48dffef675@intel.com> Date: Tue, 1 Dec 2026 10:12:40 +0000 X-Archived-By: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] drm/xe/migrate: fix pte_update_cmd_size() for non-4K PAGE_SIZE To: Matthew Brost Cc: intel-xe@lists.freedesktop.org, sashiko-bot@kernel.org, =?UTF-8?Q?Thomas_Hellstr=C3=B6m?= , Jan Maslak References: <20261130-migrate-sram-pt-size-v1-1-ab3ff81590b1@intel.com> Content-Language: en-GB From: Matthew Auld In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-BeenThere: intel-xe@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel Xe graphics driver List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Intel-xe" X-Spam-Status: No, score=-17.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 On 30/11/2026 17:05, Matthew Brost wrote: > 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 >> Cc: Matthew Brost > > 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. Right, think I see it. > > Anyways: > Reviewed-by: Matthew Brost Thanks. > >> Cc: Jan Maslak >> Cc: stable@vger.kernel.org # v6.19+ >> Signed-off-by: Matthew Auld >> --- >> 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 >>