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 947DB606A32A for ; Wed, 2 Dec 2026 00:15:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=ldoC5IOo Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5B3EB10FE41; Wed, 2 Dec 2026 00:15:29 +0000 (UTC) Received: from sea.source.kernel.org (sea.source.kernel.org [172.234.252.31]) by gabe.freedesktop.org (Postfix) with ESMTPS id 5964B10FE26; Wed, 2 Dec 2026 00:15:23 +0000 (UTC) Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by sea.source.kernel.org (Postfix) with ESMTP id 18CE9454F6; Wed, 2 Dec 2026 00:15:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D75001F00929; Wed, 2 Dec 2026 00:15:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796170523; bh=76J4nt1EngTgKf0tGf1Jk3T0LdpyLGlgDDrI6VecdsQ=; h=From:Subject:Reply-To:To:In-Reply-To:References:Date; b=ldoC5IOoyjRVx3DzWR+znqB/NbPCxMOGC9akzvg8tIyLTmvWKoaeg9G78pWO8J4Pa o+H9AFDYv3esSXs5rPOnAalC+UaBQCPlPU0IPEwAhnOlcAoCwKiUnGUdYIPHTjk3hw sUW/CecFbXxsy4gyzaY4RsPrpaq81G6HlPSy15gJDdav8szW7zGZ6guEVD5go3acqp RlNWYKbZEjrglbubDzk07zSkCnOD99LRs9sZNHJEP1Fxm7VLkLzUGAwwxSAfJmuXwg lgDWy3HvO/t5My6+Whl8IzAjlW8mwWLWz0SA/q/Hn0rDSpk8rylVs9QzL+3wc6PIjf c3giZ0m3hloFA== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v4 10/33] drm/ttm: Add full out-of-lock preallocation for ttm_pool_alloc() To: "Matthew Brost" , intel-xe@lists.freedesktop.org, dri-devel@lists.freedesktop.org In-Reply-To: <20261201234915.3305331-11-matthew.brost@intel.com> References: <20261201234915.3305331-1-matthew.brost@intel.com> <20261201234915.3305331-11-matthew.brost@intel.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Wed, 02 Dec 2026 00:15:22 +0000 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: , Reply-To: sashiko-reviews@lists.linux.dev Sender: "Intel-xe" X-Spam-Status: No, score=-10.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS 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 X-Archived-By: Thank you for your contribution! Sashiko AI review found 2 potential issues to consider: - [Medium] drm/ttm: per-chunk set_pages_wb() and pool bypass in ttm_pool_prealloc_fini() - [Low] drm/ttm: missing beneficial_reclaim_backoff kernel-doc in ttm_pool_prealloc_fill_full() -- commit ed8d0c466b7167730ef7fb44d5e145529097c69b Author: Matthew Brost drm/ttm: Add full out-of-lock preallocation for ttm_pool_alloc() This commit adds ttm_pool_prealloc_fill_full() and a full mode on struct ttm_pool_prealloc to preallocate an entire ttm_tt backing at mixed orders outside the dma-resv lock. > diff --git a/drivers/gpu/drm/ttm/ttm_pool.c b/drivers/gpu/drm/ttm/ttm_poo= l.c > index 7dcc79458b5ee..2a53d80650899 100644 > --- a/drivers/gpu/drm/ttm/ttm_pool.c > +++ b/drivers/gpu/drm/ttm/ttm_pool.c [ ... ] > +/** > + * ttm_pool_prealloc_fill_full() - Preallocate a whole tt's backing outs= ide any > + * lock > + * @pool: The pool to allocate from. > + * @tt_caching: The requested cpu-caching for the pages allocated. > + * @pp: Prealloc bag to fill; marked @full and tiled with mixed-order ch= unks. > + * @num_pages: Number of 4K pages the tt needs backed. > + * > + * Unlike ttm_pool_prealloc_fill() (which parks a bag of interchangeable > + * beneficial-order defrag chunks), this allocates the ENTIRE backing fo= r a tt > + * of @num_pages pages up front, at whatever mix of orders is available = (pool > + * pages included), so that the subsequent __ttm_pool_alloc() under the = dma-resv > + * lock merely installs the pages without stalling in reclaim/compaction= . The > + * chunk orders mirror the in-line allocator's order walk; each chunk's = order is > + * recorded on the page itself and read back at consume time. > + * > + * May sleep/reclaim freely as it runs unlocked. When > + * @beneficial_reclaim_backoff is set, higher-order chunks are taken wit= hout > + * aggressive reclaim/compaction: the caller relies on a background > + * defragmenter to upgrade to beneficial-order pages in place later, so = there > + * is no need to stall the user context reclaiming for contiguity here. = A short > + * fill is fine: the pool falls back to in-line allocation for the short= fall. > + * DMA-alloc pools are not supported (the bag stays empty). Returns 0 (r= elease > + * with ttm_pool_prealloc_fini()). > + */ > +int ttm_pool_prealloc_fill_full(struct ttm_pool *pool, > + enum ttm_caching tt_caching, > + struct ttm_pool_prealloc *pp, > + unsigned int num_pages, > + bool beneficial_reclaim_backoff) [Severity: Low] The kernel-doc header for ttm_pool_prealloc_fill_full() is missing a @beneficial_reclaim_backoff: parameter entry, which triggers a W=3D1 kernel-doc build warning. [ ... ] > @@ -1128,9 +1310,13 @@ void ttm_pool_prealloc_fini(struct ttm_pool *pool,= struct ttm_pool_prealloc *pp) > { > unsigned int i; > =20 > - for (i =3D pp->used; i < pp->count; ++i) > - ttm_pool_free_page(pool, pp->caching, pp->order, pp->pages[i], > - false); > + for (i =3D pp->used; i < pp->count; ++i) { > + struct page *p =3D pp->pages[i]; > + unsigned int order =3D pp->full ? > + ttm_pool_page_order_nodma(p) : pp->order; > + > + ttm_pool_free_page(pool, pp->caching, order, p, false); > + } [Severity: Medium] Should ttm_pool_prealloc_fini() return unconsumed WC/UC chunks to the TTM pool (or batch their write-back restoration) instead of calling ttm_pool_free_page() per chunk? When ttm_pool_prealloc_fill_full() runs with beneficial_reclaim_backoff on a fragmented system, it can fill pp->pages with up to num_pages order-0 chunks, including pre-cached WC/UC pages taken from the pool via ttm_pool_take_page(). If the caller aborts before consuming the bag (for example, on an interrupted lock wait), ttm_pool_free_page() invokes set_pages_wb() on each chunk individually rather than returning the pages to the pool via ttm_pool_type_give(), draining the pool and issuing up to num_pages synchronous cross-CPU CPA TLB shootdown IPIs on x86. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261201234915.3305= 331-1-matthew.brost@intel.com?part=3D10