diff mbox series

[2/2] Revert "drm/ttm: Add a flag to allow drivers to skip clear-on-free"

Message ID 20240821095035.29083-2-nirmoy.das@intel.com (mailing list archive)
State New, archived
Headers show
Series [1/2] drm/xe/lnl: Only do gpu sys page clear for non-pooled BOs | expand

Commit Message

Nirmoy Das Aug. 21, 2024, 9:50 a.m. UTC
Remove TTM_TT_FLAG_CLEARED_ON_FREE now that XE stopped using this
flag.

This reverts commit decbfaf06db05fa1f9b33149ebb3c145b44e878f.

Cc: Christian König <christian.koenig@amd.com>
Cc: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
Cc: Matthew Auld <matthew.auld@intel.com>
Cc: Matthew Brost <matthew.brost@intel.com>
Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Signed-off-by: Nirmoy Das <nirmoy.das@intel.com>
---
 drivers/gpu/drm/ttm/ttm_pool.c | 18 +++++++-----------
 include/drm/ttm/ttm_tt.h       |  6 +-----
 2 files changed, 8 insertions(+), 16 deletions(-)

Comments

Thomas Hellström Aug. 27, 2024, 9:42 a.m. UTC | #1
On Wed, 2024-08-21 at 11:50 +0200, Nirmoy Das wrote:
> Remove TTM_TT_FLAG_CLEARED_ON_FREE now that XE stopped using this
> flag.
> 
> This reverts commit decbfaf06db05fa1f9b33149ebb3c145b44e878f.
> 
> Cc: Christian König <christian.koenig@amd.com>
> Cc: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
> Cc: Matthew Auld <matthew.auld@intel.com>
> Cc: Matthew Brost <matthew.brost@intel.com>
> Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
> Signed-off-by: Nirmoy Das <nirmoy.das@intel.com>

Reviewed-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>

> ---
>  drivers/gpu/drm/ttm/ttm_pool.c | 18 +++++++-----------
>  include/drm/ttm/ttm_tt.h       |  6 +-----
>  2 files changed, 8 insertions(+), 16 deletions(-)
> 
> diff --git a/drivers/gpu/drm/ttm/ttm_pool.c
> b/drivers/gpu/drm/ttm/ttm_pool.c
> index 935ab3cfd046..8504dbe19c1a 100644
> --- a/drivers/gpu/drm/ttm/ttm_pool.c
> +++ b/drivers/gpu/drm/ttm/ttm_pool.c
> @@ -222,18 +222,15 @@ static void ttm_pool_unmap(struct ttm_pool
> *pool, dma_addr_t dma_addr,
>  }
>  
>  /* Give pages into a specific pool_type */
> -static void ttm_pool_type_give(struct ttm_pool_type *pt, struct page
> *p,
> -			       bool cleared)
> +static void ttm_pool_type_give(struct ttm_pool_type *pt, struct page
> *p)
>  {
>  	unsigned int i, num_pages = 1 << pt->order;
>  
> -	if (!cleared) {
> -		for (i = 0; i < num_pages; ++i) {
> -			if (PageHighMem(p))
> -				clear_highpage(p + i);
> -			else
> -				clear_page(page_address(p + i));
> -		}
> +	for (i = 0; i < num_pages; ++i) {
> +		if (PageHighMem(p))
> +			clear_highpage(p + i);
> +		else
> +			clear_page(page_address(p + i));
>  	}
>  
>  	spin_lock(&pt->lock);
> @@ -397,7 +394,6 @@ static void ttm_pool_free_range(struct ttm_pool
> *pool, struct ttm_tt *tt,
>  				pgoff_t start_page, pgoff_t
> end_page)
>  {
>  	struct page **pages = &tt->pages[start_page];
> -	bool cleared = tt->page_flags & TTM_TT_FLAG_CLEARED_ON_FREE;
>  	unsigned int order;
>  	pgoff_t i, nr;
>  
> @@ -411,7 +407,7 @@ static void ttm_pool_free_range(struct ttm_pool
> *pool, struct ttm_tt *tt,
>  
>  		pt = ttm_pool_select_type(pool, caching, order);
>  		if (pt)
> -			ttm_pool_type_give(pt, *pages, cleared);
> +			ttm_pool_type_give(pt, *pages);
>  		else
>  			ttm_pool_free_page(pool, caching, order,
> *pages);
>  	}
> diff --git a/include/drm/ttm/ttm_tt.h b/include/drm/ttm/ttm_tt.h
> index cfaf49de2419..2b9d856ff388 100644
> --- a/include/drm/ttm/ttm_tt.h
> +++ b/include/drm/ttm/ttm_tt.h
> @@ -85,9 +85,6 @@ struct ttm_tt {
>  	 * fault handling abuses the DMA api a bit and dma_map_attrs
> can't be
>  	 * used to assure pgprot always matches.
>  	 *
> -	 * TTM_TT_FLAG_CLEARED_ON_FREE: Set this if a drm driver
> handles
> -	 * clearing backing store
> -	 *
>  	 * TTM_TT_FLAG_PRIV_POPULATED: TTM internal only. DO NOT
> USE. This is
>  	 * set by TTM after ttm_tt_populate() has successfully
> returned, and is
>  	 * then unset when TTM calls ttm_tt_unpopulate().
> @@ -97,9 +94,8 @@ struct ttm_tt {
>  #define TTM_TT_FLAG_EXTERNAL		BIT(2)
>  #define TTM_TT_FLAG_EXTERNAL_MAPPABLE	BIT(3)
>  #define TTM_TT_FLAG_DECRYPTED		BIT(4)
> -#define TTM_TT_FLAG_CLEARED_ON_FREE	BIT(5)
>  
> -#define TTM_TT_FLAG_PRIV_POPULATED	BIT(6)
> +#define TTM_TT_FLAG_PRIV_POPULATED	BIT(5)
>  	uint32_t page_flags;
>  	/** @num_pages: Number of pages in the page array. */
>  	uint32_t num_pages;
Lucas De Marchi Aug. 27, 2024, 4:14 p.m. UTC | #2
On Tue, Aug 27, 2024 at 11:42:59AM GMT, Thomas Hellström wrote:
>On Wed, 2024-08-21 at 11:50 +0200, Nirmoy Das wrote:
>> Remove TTM_TT_FLAG_CLEARED_ON_FREE now that XE stopped using this
>> flag.
>>
>> This reverts commit decbfaf06db05fa1f9b33149ebb3c145b44e878f.
>>
>> Cc: Christian König <christian.koenig@amd.com>
>> Cc: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
>> Cc: Matthew Auld <matthew.auld@intel.com>
>> Cc: Matthew Brost <matthew.brost@intel.com>
>> Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
>> Signed-off-by: Nirmoy Das <nirmoy.das@intel.com>
>
>Reviewed-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>

Christian, since that commit being reverted was merged through drm-xe...
ack on reverting it in our branch? It's actually the only branch where
it can be reverted. AFAICS you agreed with the revert in
https://lore.kernel.org/intel-xe/02a383c5-db18-47ef-9118-72effd83a252@amd.com/


thanks
Lucas De Marchi
Christian König Aug. 28, 2024, 6:32 a.m. UTC | #3
Am 27.08.24 um 18:14 schrieb Lucas De Marchi:
> On Tue, Aug 27, 2024 at 11:42:59AM GMT, Thomas Hellström wrote:
>> On Wed, 2024-08-21 at 11:50 +0200, Nirmoy Das wrote:
>>> Remove TTM_TT_FLAG_CLEARED_ON_FREE now that XE stopped using this
>>> flag.
>>>
>>> This reverts commit decbfaf06db05fa1f9b33149ebb3c145b44e878f.
>>>
>>> Cc: Christian König <christian.koenig@amd.com>
>>> Cc: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
>>> Cc: Matthew Auld <matthew.auld@intel.com>
>>> Cc: Matthew Brost <matthew.brost@intel.com>
>>> Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
>>> Signed-off-by: Nirmoy Das <nirmoy.das@intel.com>
>>
>> Reviewed-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
>
> Christian, since that commit being reverted was merged through drm-xe...
> ack on reverting it in our branch? It's actually the only branch where
> it can be reverted. AFAICS you agreed with the revert in
> https://lore.kernel.org/intel-xe/02a383c5-db18-47ef-9118-72effd83a252@amd.com/ 
>

Yeah, of course. Please make sure that this gets removed before anybody 
else starts to use it :)

Christian.

>
>
> thanks
> Lucas De Marchi
diff mbox series

Patch

diff --git a/drivers/gpu/drm/ttm/ttm_pool.c b/drivers/gpu/drm/ttm/ttm_pool.c
index 935ab3cfd046..8504dbe19c1a 100644
--- a/drivers/gpu/drm/ttm/ttm_pool.c
+++ b/drivers/gpu/drm/ttm/ttm_pool.c
@@ -222,18 +222,15 @@  static void ttm_pool_unmap(struct ttm_pool *pool, dma_addr_t dma_addr,
 }
 
 /* Give pages into a specific pool_type */
-static void ttm_pool_type_give(struct ttm_pool_type *pt, struct page *p,
-			       bool cleared)
+static void ttm_pool_type_give(struct ttm_pool_type *pt, struct page *p)
 {
 	unsigned int i, num_pages = 1 << pt->order;
 
-	if (!cleared) {
-		for (i = 0; i < num_pages; ++i) {
-			if (PageHighMem(p))
-				clear_highpage(p + i);
-			else
-				clear_page(page_address(p + i));
-		}
+	for (i = 0; i < num_pages; ++i) {
+		if (PageHighMem(p))
+			clear_highpage(p + i);
+		else
+			clear_page(page_address(p + i));
 	}
 
 	spin_lock(&pt->lock);
@@ -397,7 +394,6 @@  static void ttm_pool_free_range(struct ttm_pool *pool, struct ttm_tt *tt,
 				pgoff_t start_page, pgoff_t end_page)
 {
 	struct page **pages = &tt->pages[start_page];
-	bool cleared = tt->page_flags & TTM_TT_FLAG_CLEARED_ON_FREE;
 	unsigned int order;
 	pgoff_t i, nr;
 
@@ -411,7 +407,7 @@  static void ttm_pool_free_range(struct ttm_pool *pool, struct ttm_tt *tt,
 
 		pt = ttm_pool_select_type(pool, caching, order);
 		if (pt)
-			ttm_pool_type_give(pt, *pages, cleared);
+			ttm_pool_type_give(pt, *pages);
 		else
 			ttm_pool_free_page(pool, caching, order, *pages);
 	}
diff --git a/include/drm/ttm/ttm_tt.h b/include/drm/ttm/ttm_tt.h
index cfaf49de2419..2b9d856ff388 100644
--- a/include/drm/ttm/ttm_tt.h
+++ b/include/drm/ttm/ttm_tt.h
@@ -85,9 +85,6 @@  struct ttm_tt {
 	 * fault handling abuses the DMA api a bit and dma_map_attrs can't be
 	 * used to assure pgprot always matches.
 	 *
-	 * TTM_TT_FLAG_CLEARED_ON_FREE: Set this if a drm driver handles
-	 * clearing backing store
-	 *
 	 * TTM_TT_FLAG_PRIV_POPULATED: TTM internal only. DO NOT USE. This is
 	 * set by TTM after ttm_tt_populate() has successfully returned, and is
 	 * then unset when TTM calls ttm_tt_unpopulate().
@@ -97,9 +94,8 @@  struct ttm_tt {
 #define TTM_TT_FLAG_EXTERNAL		BIT(2)
 #define TTM_TT_FLAG_EXTERNAL_MAPPABLE	BIT(3)
 #define TTM_TT_FLAG_DECRYPTED		BIT(4)
-#define TTM_TT_FLAG_CLEARED_ON_FREE	BIT(5)
 
-#define TTM_TT_FLAG_PRIV_POPULATED	BIT(6)
+#define TTM_TT_FLAG_PRIV_POPULATED	BIT(5)
 	uint32_t page_flags;
 	/** @num_pages: Number of pages in the page array. */
 	uint32_t num_pages;