Skip to contentSkip to conversation

drm/buddy: stop using PAGE_SIZE

PATCH Applied Matthew Auld 5 participants 10 messages Feb 29, 2024 – May 17, 2024

Subsystems (3)
lore
Share & tools
lore

Matthew Auld

author maintainer
#0 lore raw

PATCH 1/2 drm/buddy: stop using PAGE_SIZE

The drm_buddy minimum page-size requirements should be distinct from the CPU PAGE_SIZE. Only restriction is that the minimum page-size is at least 4K.

Cc Arunpravin Paneer Selvam <[email protected]>
Cc Christian König <[email protected]>
Cc Arnd Bergmann <[email protected]>
---
 drivers/gpu/drm/drm_buddy.c | 2 +-
 include/drm/drm_buddy.h     | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/drm_buddy.c +1 -1
index 5ebdd6f8f36e..f999568d69c1 100644
@@ -102,7 +102,7 @@ int drm_buddy_init(struct drm_buddy *mm, u64 size, u64 chunk_size)
 	if (size < chunk_size)
 		return -EINVAL;
 
-	if (chunk_size < PAGE_SIZE)
+	if (chunk_size < SZ_4K)
 		return -EINVAL;
 
 	if (!is_power_of_2(chunk_size))
include/drm/drm_buddy.h +3 -3
index a5b39fc01003..19ed661a32f3 100644
@@ -53,8 +53,8 @@ struct drm_buddy_block {
 	struct list_head tmp_link;
 };
 
-/* Order-zero must be at least PAGE_SIZE */
-#define DRM_BUDDY_MAX_ORDER (63 - PAGE_SHIFT)
+/* Order-zero must be at least SZ_4K */
+#define DRM_BUDDY_MAX_ORDER (63 - 12)
 
 /*
  * Binary Buddy System.
@@ -82,7 +82,7 @@ struct drm_buddy {
 	unsigned int n_roots;
 	unsigned int max_order;
 
-	/* Must be at least PAGE_SIZE */
+	/* Must be at least SZ_4K */
 	u64 chunk_size;
 	u64 size;
 	u64 avail;
Signature · 1 line
2.43.2
author maintainer
#1 lore raw

PATCH 2/2 drm/tests/buddy: stop using PAGE_SIZE

Gives the wrong impression that min page-size has to be tied to the CPU PAGE_SIZE.

Cc Arunpravin Paneer Selvam <[email protected]>
Cc Christian König <[email protected]>
Cc Arnd Bergmann <[email protected]>
---
 drivers/gpu/drm/tests/drm_buddy_test.c | 42 +++++++++++++-------------
 1 file changed, 21 insertions(+), 21 deletions(-)
drivers/gpu/drm/tests/drm_buddy_test.c +21 -21
index be2d9d7764be..8528f39a84e6 100644
@@ -329,8 +329,8 @@ static void drm_test_buddy_alloc_pathological(struct kunit *test)
 	 * Eventually we will have a fully 50% fragmented mm.
 	 */
 
-	mm_size = PAGE_SIZE << max_order;
-	KUNIT_ASSERT_FALSE_MSG(test, drm_buddy_init(&mm, mm_size, PAGE_SIZE),
+	mm_size = SZ_4K << max_order;
+	KUNIT_ASSERT_FALSE_MSG(test, drm_buddy_init(&mm, mm_size, SZ_4K),
 			       "buddy_init failed\n");
 
 	KUNIT_EXPECT_EQ(test, mm.max_order, max_order);
@@ -344,7 +344,7 @@ static void drm_test_buddy_alloc_pathological(struct kunit *test)
 		}
 
 		for (order = top; order--;) {
-			size = get_size(order, PAGE_SIZE);
+			size = get_size(order, mm.chunk_size);
 			KUNIT_ASSERT_FALSE_MSG(test, drm_buddy_alloc_blocks(&mm, start,
 									    mm_size, size, size,
 										&tmp, flags),
@@ -358,7 +358,7 @@ static void drm_test_buddy_alloc_pathological(struct kunit *test)
 		}
 
 		/* There should be one final page for this sub-allocation */
-		size = get_size(0, PAGE_SIZE);
+		size = get_size(0, mm.chunk_size);
 		KUNIT_ASSERT_FALSE_MSG(test, drm_buddy_alloc_blocks(&mm, start, mm_size,
 								    size, size, &tmp, flags),
 							   "buddy_alloc hit -ENOMEM for hole\n");
@@ -368,7 +368,7 @@ static void drm_test_buddy_alloc_pathological(struct kunit *test)
 
 		list_move_tail(&block->link, &holes);
 
-		size = get_size(top, PAGE_SIZE);
+		size = get_size(top, mm.chunk_size);
 		KUNIT_ASSERT_TRUE_MSG(test, drm_buddy_alloc_blocks(&mm, start, mm_size,
 								   size, size, &tmp, flags),
 							  "buddy_alloc unexpectedly succeeded at top-order %d/%d, it should be full!",
@@ -379,7 +379,7 @@ static void drm_test_buddy_alloc_pathological(struct kunit *test)
 
 	/* Nothing larger than blocks of chunk_size now available */
 	for (order = 1; order <= max_order; order++) {
-		size = get_size(order, PAGE_SIZE);
+		size = get_size(order, mm.chunk_size);
 		KUNIT_ASSERT_TRUE_MSG(test, drm_buddy_alloc_blocks(&mm, start, mm_size,
 								   size, size, &tmp, flags),
 							  "buddy_alloc unexpectedly succeeded at order %d, it should be full!",
@@ -408,14 +408,14 @@ static void drm_test_buddy_alloc_pessimistic(struct kunit *test)
 	 * page left.
 	 */
 
-	mm_size = PAGE_SIZE << max_order;
-	KUNIT_ASSERT_FALSE_MSG(test, drm_buddy_init(&mm, mm_size, PAGE_SIZE),
+	mm_size = SZ_4K << max_order;
+	KUNIT_ASSERT_FALSE_MSG(test, drm_buddy_init(&mm, mm_size, SZ_4K),
 			       "buddy_init failed\n");
 
 	KUNIT_EXPECT_EQ(test, mm.max_order, max_order);
 
 	for (order = 0; order < max_order; order++) {
-		size = get_size(order, PAGE_SIZE);
+		size = get_size(order, mm.chunk_size);
 		KUNIT_ASSERT_FALSE_MSG(test, drm_buddy_alloc_blocks(&mm, start, mm_size,
 								    size, size, &tmp, flags),
 							   "buddy_alloc hit -ENOMEM with order=%d\n",
@@ -428,7 +428,7 @@ static void drm_test_buddy_alloc_pessimistic(struct kunit *test)
 	}
 
 	/* And now the last remaining block available */
-	size = get_size(0, PAGE_SIZE);
+	size = get_size(0, mm.chunk_size);
 	KUNIT_ASSERT_FALSE_MSG(test, drm_buddy_alloc_blocks(&mm, start, mm_size,
 							    size, size, &tmp, flags),
 						   "buddy_alloc hit -ENOMEM on final alloc\n");
@@ -440,7 +440,7 @@ static void drm_test_buddy_alloc_pessimistic(struct kunit *test)
 
 	/* Should be completely full! */
 	for (order = max_order; order--;) {
-		size = get_size(order, PAGE_SIZE);
+		size = get_size(order, mm.chunk_size);
 		KUNIT_ASSERT_TRUE_MSG(test, drm_buddy_alloc_blocks(&mm, start, mm_size,
 								   size, size, &tmp, flags),
 							  "buddy_alloc unexpectedly succeeded, it should be full!");
@@ -456,7 +456,7 @@ static void drm_test_buddy_alloc_pessimistic(struct kunit *test)
 		list_del(&block->link);
 		drm_buddy_free_block(&mm, block);
 
-		size = get_size(order, PAGE_SIZE);
+		size = get_size(order, mm.chunk_size);
 		KUNIT_ASSERT_FALSE_MSG(test, drm_buddy_alloc_blocks(&mm, start, mm_size,
 								    size, size, &tmp, flags),
 							   "buddy_alloc hit -ENOMEM with order=%d\n",
@@ -471,7 +471,7 @@ static void drm_test_buddy_alloc_pessimistic(struct kunit *test)
 	}
 
 	/* To confirm, now the whole mm should be available */
-	size = get_size(max_order, PAGE_SIZE);
+	size = get_size(max_order, mm.chunk_size);
 	KUNIT_ASSERT_FALSE_MSG(test, drm_buddy_alloc_blocks(&mm, start, mm_size,
 							    size, size, &tmp, flags),
 						   "buddy_alloc (realloc) hit -ENOMEM with order=%d\n",
@@ -502,15 +502,15 @@ static void drm_test_buddy_alloc_optimistic(struct kunit *test)
 	 * try to allocate them all.
 	 */
 
-	mm_size = PAGE_SIZE * ((1 << (max_order + 1)) - 1);
+	mm_size = SZ_4K * ((1 << (max_order + 1)) - 1);
 
-	KUNIT_ASSERT_FALSE_MSG(test, drm_buddy_init(&mm, mm_size, PAGE_SIZE),
+	KUNIT_ASSERT_FALSE_MSG(test, drm_buddy_init(&mm, mm_size, SZ_4K),
 			       "buddy_init failed\n");
 
 	KUNIT_EXPECT_EQ(test, mm.max_order, max_order);
 
 	for (order = 0; order <= max_order; order++) {
-		size = get_size(order, PAGE_SIZE);
+		size = get_size(order, mm.chunk_size);
 		KUNIT_ASSERT_FALSE_MSG(test, drm_buddy_alloc_blocks(&mm, start, mm_size,
 								    size, size, &tmp, flags),
 							   "buddy_alloc hit -ENOMEM with order=%d\n",
@@ -523,7 +523,7 @@ static void drm_test_buddy_alloc_optimistic(struct kunit *test)
 	}
 
 	/* Should be completely full! */
-	size = get_size(0, PAGE_SIZE);
+	size = get_size(0, mm.chunk_size);
 	KUNIT_ASSERT_TRUE_MSG(test, drm_buddy_alloc_blocks(&mm, start, mm_size,
 							   size, size, &tmp, flags),
 						  "buddy_alloc unexpectedly succeeded, it should be full!");
@@ -540,7 +540,7 @@ static void drm_test_buddy_alloc_limit(struct kunit *test)
 	LIST_HEAD(allocated);
 	struct drm_buddy mm;
 
-	KUNIT_EXPECT_FALSE(test, drm_buddy_init(&mm, size, PAGE_SIZE));
+	KUNIT_EXPECT_FALSE(test, drm_buddy_init(&mm, size, SZ_4K));
 
 	KUNIT_EXPECT_EQ_MSG(test, mm.max_order, DRM_BUDDY_MAX_ORDER,
 			    "mm.max_order(%d) != %d\n", mm.max_order,
@@ -548,7 +548,7 @@ static void drm_test_buddy_alloc_limit(struct kunit *test)
 
 	size = mm.chunk_size << mm.max_order;
 	KUNIT_EXPECT_FALSE(test, drm_buddy_alloc_blocks(&mm, start, size, size,
-							PAGE_SIZE, &allocated, flags));
+							mm.chunk_size, &allocated, flags));
 
 	block = list_first_entry_or_null(&allocated, struct drm_buddy_block, link);
 	KUNIT_EXPECT_TRUE(test, block);
@@ -558,10 +558,10 @@ static void drm_test_buddy_alloc_limit(struct kunit *test)
 						drm_buddy_block_order(block), mm.max_order);
 
 	KUNIT_EXPECT_EQ_MSG(test, drm_buddy_block_size(&mm, block),
-			    BIT_ULL(mm.max_order) * PAGE_SIZE,
+			    BIT_ULL(mm.max_order) * mm.chunk_size,
 						"block size(%llu) != %llu\n",
 						drm_buddy_block_size(&mm, block),
-						BIT_ULL(mm.max_order) * PAGE_SIZE);
+						BIT_ULL(mm.max_order) * mm.chunk_size);
 
 	drm_buddy_free_list(&mm, &allocated);
 	drm_buddy_fini(&mm);
Signature · 1 line
2.43.2
maintainer Reviewed-by on v1 2/2
#2 lore raw

Re: [PATCH 2/2] drm/tests/buddy: stop using PAGE_SIZE

Quoted 175 lines · Matthew Auld

Gives the wrong impression that min page-size has to be tied to the CPU PAGE_SIZE.

Cc Arunpravin Paneer Selvam<[email protected]>
Cc Christian König<[email protected]>
Cc Arnd Bergmann<[email protected]>
---
  drivers/gpu/drm/tests/drm_buddy_test.c | 42 +++++++++++++-------------
  1 file changed, 21 insertions(+), 21 deletions(-)
drivers/gpu/drm/tests/drm_buddy_test.c +21 -21
index be2d9d7764be..8528f39a84e6 100644
@@ -329,8 +329,8 @@ static void drm_test_buddy_alloc_pathological(struct kunit *test)
  	 * Eventually we will have a fully 50% fragmented mm.
  	 */
 
-	mm_size = PAGE_SIZE << max_order;
-	KUNIT_ASSERT_FALSE_MSG(test, drm_buddy_init(&mm, mm_size, PAGE_SIZE),
+	mm_size = SZ_4K << max_order;
+	KUNIT_ASSERT_FALSE_MSG(test, drm_buddy_init(&mm, mm_size, SZ_4K),
  			       "buddy_init failed\n");
 
  	KUNIT_EXPECT_EQ(test, mm.max_order, max_order);
@@ -344,7 +344,7 @@ static void drm_test_buddy_alloc_pathological(struct kunit *test)
  		}
 
  		for (order = top; order--;) {
-			size = get_size(order, PAGE_SIZE);
+			size = get_size(order, mm.chunk_size);
  			KUNIT_ASSERT_FALSE_MSG(test, drm_buddy_alloc_blocks(&mm, start,
  									    mm_size, size, size,
  										&tmp, flags),
@@ -358,7 +358,7 @@ static void drm_test_buddy_alloc_pathological(struct kunit *test)
  		}
 
  		/* There should be one final page for this sub-allocation */
-		size = get_size(0, PAGE_SIZE);
+		size = get_size(0, mm.chunk_size);
  		KUNIT_ASSERT_FALSE_MSG(test, drm_buddy_alloc_blocks(&mm, start, mm_size,
  								    size, size, &tmp, flags),
  							   "buddy_alloc hit -ENOMEM for hole\n");
@@ -368,7 +368,7 @@ static void drm_test_buddy_alloc_pathological(struct kunit *test)
 
  		list_move_tail(&block->link, &holes);
 
-		size = get_size(top, PAGE_SIZE);
+		size = get_size(top, mm.chunk_size);
  		KUNIT_ASSERT_TRUE_MSG(test, drm_buddy_alloc_blocks(&mm, start, mm_size,
  								   size, size, &tmp, flags),
  							  "buddy_alloc unexpectedly succeeded at top-order %d/%d, it should be full!",
@@ -379,7 +379,7 @@ static void drm_test_buddy_alloc_pathological(struct kunit *test)
 
  	/* Nothing larger than blocks of chunk_size now available */
  	for (order = 1; order <= max_order; order++) {
-		size = get_size(order, PAGE_SIZE);
+		size = get_size(order, mm.chunk_size);
  		KUNIT_ASSERT_TRUE_MSG(test, drm_buddy_alloc_blocks(&mm, start, mm_size,
  								   size, size, &tmp, flags),
  							  "buddy_alloc unexpectedly succeeded at order %d, it should be full!",
@@ -408,14 +408,14 @@ static void drm_test_buddy_alloc_pessimistic(struct kunit *test)
  	 * page left.
  	 */
 
-	mm_size = PAGE_SIZE << max_order;
-	KUNIT_ASSERT_FALSE_MSG(test, drm_buddy_init(&mm, mm_size, PAGE_SIZE),
+	mm_size = SZ_4K << max_order;
+	KUNIT_ASSERT_FALSE_MSG(test, drm_buddy_init(&mm, mm_size, SZ_4K),
  			       "buddy_init failed\n");
 
  	KUNIT_EXPECT_EQ(test, mm.max_order, max_order);
 
  	for (order = 0; order < max_order; order++) {
-		size = get_size(order, PAGE_SIZE);
+		size = get_size(order, mm.chunk_size);
  		KUNIT_ASSERT_FALSE_MSG(test, drm_buddy_alloc_blocks(&mm, start, mm_size,
  								    size, size, &tmp, flags),
  							   "buddy_alloc hit -ENOMEM with order=%d\n",
@@ -428,7 +428,7 @@ static void drm_test_buddy_alloc_pessimistic(struct kunit *test)
  	}
 
  	/* And now the last remaining block available */
-	size = get_size(0, PAGE_SIZE);
+	size = get_size(0, mm.chunk_size);
  	KUNIT_ASSERT_FALSE_MSG(test, drm_buddy_alloc_blocks(&mm, start, mm_size,
  							    size, size, &tmp, flags),
  						   "buddy_alloc hit -ENOMEM on final alloc\n");
@@ -440,7 +440,7 @@ static void drm_test_buddy_alloc_pessimistic(struct kunit *test)
 
  	/* Should be completely full! */
  	for (order = max_order; order--;) {
-		size = get_size(order, PAGE_SIZE);
+		size = get_size(order, mm.chunk_size);
  		KUNIT_ASSERT_TRUE_MSG(test, drm_buddy_alloc_blocks(&mm, start, mm_size,
  								   size, size, &tmp, flags),
  							  "buddy_alloc unexpectedly succeeded, it should be full!");
@@ -456,7 +456,7 @@ static void drm_test_buddy_alloc_pessimistic(struct kunit *test)
  		list_del(&block->link);
  		drm_buddy_free_block(&mm, block);
 
-		size = get_size(order, PAGE_SIZE);
+		size = get_size(order, mm.chunk_size);
  		KUNIT_ASSERT_FALSE_MSG(test, drm_buddy_alloc_blocks(&mm, start, mm_size,
  								    size, size, &tmp, flags),
  							   "buddy_alloc hit -ENOMEM with order=%d\n",
@@ -471,7 +471,7 @@ static void drm_test_buddy_alloc_pessimistic(struct kunit *test)
  	}
 
  	/* To confirm, now the whole mm should be available */
-	size = get_size(max_order, PAGE_SIZE);
+	size = get_size(max_order, mm.chunk_size);
  	KUNIT_ASSERT_FALSE_MSG(test, drm_buddy_alloc_blocks(&mm, start, mm_size,
  							    size, size, &tmp, flags),
  						   "buddy_alloc (realloc) hit -ENOMEM with order=%d\n",
@@ -502,15 +502,15 @@ static void drm_test_buddy_alloc_optimistic(struct kunit *test)
  	 * try to allocate them all.
  	 */
 
-	mm_size = PAGE_SIZE * ((1 << (max_order + 1)) - 1);
+	mm_size = SZ_4K * ((1 << (max_order + 1)) - 1);
 
-	KUNIT_ASSERT_FALSE_MSG(test, drm_buddy_init(&mm, mm_size, PAGE_SIZE),
+	KUNIT_ASSERT_FALSE_MSG(test, drm_buddy_init(&mm, mm_size, SZ_4K),
  			       "buddy_init failed\n");
 
  	KUNIT_EXPECT_EQ(test, mm.max_order, max_order);
 
  	for (order = 0; order <= max_order; order++) {
-		size = get_size(order, PAGE_SIZE);
+		size = get_size(order, mm.chunk_size);
  		KUNIT_ASSERT_FALSE_MSG(test, drm_buddy_alloc_blocks(&mm, start, mm_size,
  								    size, size, &tmp, flags),
  							   "buddy_alloc hit -ENOMEM with order=%d\n",
@@ -523,7 +523,7 @@ static void drm_test_buddy_alloc_optimistic(struct kunit *test)
  	}
 
  	/* Should be completely full! */
-	size = get_size(0, PAGE_SIZE);
+	size = get_size(0, mm.chunk_size);
  	KUNIT_ASSERT_TRUE_MSG(test, drm_buddy_alloc_blocks(&mm, start, mm_size,
  							   size, size, &tmp, flags),
  						  "buddy_alloc unexpectedly succeeded, it should be full!");
@@ -540,7 +540,7 @@ static void drm_test_buddy_alloc_limit(struct kunit *test)
  	LIST_HEAD(allocated);
  	struct drm_buddy mm;
 
-	KUNIT_EXPECT_FALSE(test, drm_buddy_init(&mm, size, PAGE_SIZE));
+	KUNIT_EXPECT_FALSE(test, drm_buddy_init(&mm, size, SZ_4K));
 
  	KUNIT_EXPECT_EQ_MSG(test, mm.max_order, DRM_BUDDY_MAX_ORDER,
  			    "mm.max_order(%d) != %d\n", mm.max_order,
@@ -548,7 +548,7 @@ static void drm_test_buddy_alloc_limit(struct kunit *test)
 
  	size = mm.chunk_size << mm.max_order;
  	KUNIT_EXPECT_FALSE(test, drm_buddy_alloc_blocks(&mm, start, size, size,
-							PAGE_SIZE, &allocated, flags));
+							mm.chunk_size, &allocated, flags));
 
  	block = list_first_entry_or_null(&allocated, struct drm_buddy_block, link);
  	KUNIT_EXPECT_TRUE(test, block);
@@ -558,10 +558,10 @@ static void drm_test_buddy_alloc_limit(struct kunit *test)
  						drm_buddy_block_order(block), mm.max_order);
 
  	KUNIT_EXPECT_EQ_MSG(test, drm_buddy_block_size(&mm, block),
-			    BIT_ULL(mm.max_order) * PAGE_SIZE,
+			    BIT_ULL(mm.max_order) * mm.chunk_size,
  						"block size(%llu) != %llu\n",
  						drm_buddy_block_size(&mm, block),
-						BIT_ULL(mm.max_order) * PAGE_SIZE);
+						BIT_ULL(mm.max_order) * mm.chunk_size);
 
  	drm_buddy_free_list(&mm, &allocated);
  	drm_buddy_fini(&mm);
maintainer Reviewed-by on v1 1/2
#3 lore raw
In reply to Matthew Auld
Quoted 50 lines · Matthew Auld

The drm_buddy minimum page-size requirements should be distinct from the CPU PAGE_SIZE. Only restriction is that the minimum page-size is at least 4K.

Cc Arunpravin Paneer Selvam<[email protected]>
Cc Christian König<[email protected]>
Cc Arnd Bergmann<[email protected]>
---
  drivers/gpu/drm/drm_buddy.c | 2 +-
  include/drm/drm_buddy.h     | 6 +++---
  2 files changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/drm_buddy.c +1 -1
index 5ebdd6f8f36e..f999568d69c1 100644
@@ -102,7 +102,7 @@ int drm_buddy_init(struct drm_buddy *mm, u64 size, u64 chunk_size)
  	if (size < chunk_size)
  		return -EINVAL;
 
-	if (chunk_size < PAGE_SIZE)
+	if (chunk_size < SZ_4K)
  		return -EINVAL;
 
  	if (!is_power_of_2(chunk_size))
include/drm/drm_buddy.h +3 -3
index a5b39fc01003..19ed661a32f3 100644
@@ -53,8 +53,8 @@ struct drm_buddy_block {
  	struct list_head tmp_link;
  };
 
-/* Order-zero must be at least PAGE_SIZE */
-#define DRM_BUDDY_MAX_ORDER (63 - PAGE_SHIFT)
+/* Order-zero must be at least SZ_4K */
+#define DRM_BUDDY_MAX_ORDER (63 - 12)
 
  /*
   * Binary Buddy System.
@@ -82,7 +82,7 @@ struct drm_buddy {
  	unsigned int n_roots;
  	unsigned int max_order;
 
-	/* Must be at least PAGE_SIZE */
+	/* Must be at least SZ_4K */
  	u64 chunk_size;
  	u64 size;
  	u64 avail;
Acked-by on v1 1/2
#4 lore raw
In reply to Matthew Auld

Am 29.02.24 um 11:51 schrieb Matthew Auld:

Quoted 8 lines

The drm_buddy minimum page-size requirements should be distinct from the CPU PAGE_SIZE. Only restriction is that the minimum page-size is at least 4K.

Cc Arunpravin Paneer Selvam <[email protected]>
Cc Christian König <[email protected]>
Cc Arnd Bergmann <[email protected]>
Quoted 42 lines
---
  drivers/gpu/drm/drm_buddy.c | 2 +-
  include/drm/drm_buddy.h     | 6 +++---
  2 files changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/drm_buddy.c +1 -1
index 5ebdd6f8f36e..f999568d69c1 100644
@@ -102,7 +102,7 @@ int drm_buddy_init(struct drm_buddy *mm, u64 size, u64 chunk_size)
  	if (size < chunk_size)
  		return -EINVAL;
 
-	if (chunk_size < PAGE_SIZE)
+	if (chunk_size < SZ_4K)
  		return -EINVAL;
 
  	if (!is_power_of_2(chunk_size))
include/drm/drm_buddy.h +3 -3
index a5b39fc01003..19ed661a32f3 100644
@@ -53,8 +53,8 @@ struct drm_buddy_block {
  	struct list_head tmp_link;
  };
 
-/* Order-zero must be at least PAGE_SIZE */
-#define DRM_BUDDY_MAX_ORDER (63 - PAGE_SHIFT)
+/* Order-zero must be at least SZ_4K */
+#define DRM_BUDDY_MAX_ORDER (63 - 12)
 
  /*
   * Binary Buddy System.
@@ -82,7 +82,7 @@ struct drm_buddy {
  	unsigned int n_roots;
  	unsigned int max_order;
 
-	/* Must be at least PAGE_SIZE */
+	/* Must be at least SZ_4K */
  	u64 chunk_size;
  	u64 size;
  	u64 avail;
maintainer
#6 lore raw
Quoted 6 lines · Arnd Bergmann
Quoted 4 lines · Matthew Auld

The drm_buddy minimum page-size requirements should be distinct from the CPU PAGE_SIZE. Only restriction is that the minimum page-size is at least 4K.

Quoted 6 lines
Quoted 4 lines
Cc Arunpravin Paneer Selvam <[email protected]>
Cc Christian König <[email protected]>
Cc Arnd Bergmann <[email protected]>

Has this landed anywhere yet?

I'm been testing 6.9 on 64K pages and the buddy tests are exploding so I wanted to pull this in.

Dave.

author maintainer
#7 lore raw
Quoted 7 lines · Dave Airlie
Quoted 6 lines · Arnd Bergmann
Quoted 4 lines · Matthew Auld

The drm_buddy minimum page-size requirements should be distinct from the CPU PAGE_SIZE. Only restriction is that the minimum page-size is at least 4K.

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
Cc Arunpravin Paneer Selvam <[email protected]>
Cc Christian König <[email protected]>
Cc Arnd Bergmann <[email protected]>

Has this landed anywhere yet?

Looks like it fell through the cracks. I think it still applies, so just needs someone with commit rights to push it.

Quoted 5 lines

I'm been testing 6.9 on 64K pages and the buddy tests are exploding so I wanted to pull this in.

Dave.

#8 lore raw

Am 17.05.24 um 10:53 schrieb Matthew Auld:

Quoted 13 lines · Dave Airlie
Quoted 12 lines · Arnd Bergmann
Quoted 11 lines · Matthew Auld
Quoted 8 lines

The drm_buddy minimum page-size requirements should be distinct from the CPU PAGE_SIZE. Only restriction is that the minimum page-size is at least 4K.

Cc Arunpravin Paneer Selvam <[email protected]>
Cc Christian König <[email protected]>
Cc Arnd Bergmann <[email protected]>
Quoted 5 lines
Quoted 3 lines
Quoted 1 line

Has this landed anywhere yet?

Looks like it fell through the cracks. I think it still applies, so just needs someone with commit rights to push it.

Pushed to drm-misc-fixes.

Regards,
Christian.

Quoted 6 lines
Quoted 6 lines

I'm been testing 6.9 on 64K pages and the buddy tests are exploding so I wanted to pull this in.

Dave.

author maintainer
#9 lore raw
Quoted 14 lines · Christian König

Am 17.05.24 um 10:53 schrieb Matthew Auld:

Quoted 13 lines · Dave Airlie
Quoted 12 lines · Arnd Bergmann
Quoted 11 lines · Matthew Auld
Quoted 8 lines

The drm_buddy minimum page-size requirements should be distinct from the CPU PAGE_SIZE. Only restriction is that the minimum page-size is at least 4K.

Cc Arunpravin Paneer Selvam <[email protected]>
Cc Christian König <[email protected]>
Cc Arnd Bergmann <[email protected]>
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line

Has this landed anywhere yet?

Looks like it fell through the cracks. I think it still applies, so just needs someone with commit rights to push it.

Pushed to drm-misc-fixes.

Thanks.

Quoted 11 lines

Regards,
Christian.

Quoted 6 lines
Quoted 6 lines

I'm been testing 6.9 on 64K pages and the buddy tests are exploding so I wanted to pull this in.

Dave.