* [PATCH 1/2] drm/buddy: stop using PAGE_SIZE
@ 2024-02-29 10:51 Matthew Auld
2024-02-29 10:51 ` [PATCH 2/2] drm/tests/buddy: " Matthew Auld
` (3 more replies)
0 siblings, 4 replies; 10+ messages in thread
From: Matthew Auld @ 2024-02-29 10:51 UTC (permalink / raw)
To: dri-devel; +Cc: Arunpravin Paneer Selvam, Christian König, Arnd Bergmann
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.
Signed-off-by: Matthew Auld <matthew.auld@intel.com>
Cc: Arunpravin Paneer Selvam <Arunpravin.PaneerSelvam@amd.com>
Cc: Christian König <christian.koenig@amd.com>
Cc: Arnd Bergmann <arnd@arndb.de>
---
drivers/gpu/drm/drm_buddy.c | 2 +-
include/drm/drm_buddy.h | 6 +++---
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/drm_buddy.c b/drivers/gpu/drm/drm_buddy.c
index 5ebdd6f8f36e..f999568d69c1 100644
--- a/drivers/gpu/drm/drm_buddy.c
+++ b/drivers/gpu/drm/drm_buddy.c
@@ -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))
diff --git a/include/drm/drm_buddy.h b/include/drm/drm_buddy.h
index a5b39fc01003..19ed661a32f3 100644
--- a/include/drm/drm_buddy.h
+++ b/include/drm/drm_buddy.h
@@ -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;
--
2.43.2
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 2/2] drm/tests/buddy: stop using PAGE_SIZE
2024-02-29 10:51 [PATCH 1/2] drm/buddy: stop using PAGE_SIZE Matthew Auld
@ 2024-02-29 10:51 ` Matthew Auld
2024-02-29 11:10 ` Paneer Selvam, Arunpravin
2024-02-29 11:09 ` [PATCH 1/2] drm/buddy: " Paneer Selvam, Arunpravin
` (2 subsequent siblings)
3 siblings, 1 reply; 10+ messages in thread
From: Matthew Auld @ 2024-02-29 10:51 UTC (permalink / raw)
To: dri-devel; +Cc: Arunpravin Paneer Selvam, Christian König, Arnd Bergmann
Gives the wrong impression that min page-size has to be tied to the CPU
PAGE_SIZE.
Signed-off-by: Matthew Auld <matthew.auld@intel.com>
Cc: Arunpravin Paneer Selvam <Arunpravin.PaneerSelvam@amd.com>
Cc: Christian König <christian.koenig@amd.com>
Cc: Arnd Bergmann <arnd@arndb.de>
---
drivers/gpu/drm/tests/drm_buddy_test.c | 42 +++++++++++++-------------
1 file changed, 21 insertions(+), 21 deletions(-)
diff --git a/drivers/gpu/drm/tests/drm_buddy_test.c b/drivers/gpu/drm/tests/drm_buddy_test.c
index be2d9d7764be..8528f39a84e6 100644
--- a/drivers/gpu/drm/tests/drm_buddy_test.c
+++ b/drivers/gpu/drm/tests/drm_buddy_test.c
@@ -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);
--
2.43.2
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH 1/2] drm/buddy: stop using PAGE_SIZE
2024-02-29 10:51 [PATCH 1/2] drm/buddy: stop using PAGE_SIZE Matthew Auld
2024-02-29 10:51 ` [PATCH 2/2] drm/tests/buddy: " Matthew Auld
@ 2024-02-29 11:09 ` Paneer Selvam, Arunpravin
2024-02-29 13:24 ` Christian König
2024-02-29 13:29 ` Arnd Bergmann
3 siblings, 0 replies; 10+ messages in thread
From: Paneer Selvam, Arunpravin @ 2024-02-29 11:09 UTC (permalink / raw)
To: Matthew Auld, dri-devel; +Cc: Christian König, Arnd Bergmann
[-- Attachment #1: Type: text/plain, Size: 1776 bytes --]
Reviewed-by: Arunpravin Paneer Selvam <Arunpravin.PaneerSelvam@amd.com>
On 2/29/2024 4:21 PM, Matthew Auld wrote:
> 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.
>
> Signed-off-by: Matthew Auld<matthew.auld@intel.com>
> Cc: Arunpravin Paneer Selvam<Arunpravin.PaneerSelvam@amd.com>
> Cc: Christian König<christian.koenig@amd.com>
> Cc: Arnd Bergmann<arnd@arndb.de>
> ---
> drivers/gpu/drm/drm_buddy.c | 2 +-
> include/drm/drm_buddy.h | 6 +++---
> 2 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_buddy.c b/drivers/gpu/drm/drm_buddy.c
> index 5ebdd6f8f36e..f999568d69c1 100644
> --- a/drivers/gpu/drm/drm_buddy.c
> +++ b/drivers/gpu/drm/drm_buddy.c
> @@ -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))
> diff --git a/include/drm/drm_buddy.h b/include/drm/drm_buddy.h
> index a5b39fc01003..19ed661a32f3 100644
> --- a/include/drm/drm_buddy.h
> +++ b/include/drm/drm_buddy.h
> @@ -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;
[-- Attachment #2: Type: text/html, Size: 2450 bytes --]
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 2/2] drm/tests/buddy: stop using PAGE_SIZE
2024-02-29 10:51 ` [PATCH 2/2] drm/tests/buddy: " Matthew Auld
@ 2024-02-29 11:10 ` Paneer Selvam, Arunpravin
0 siblings, 0 replies; 10+ messages in thread
From: Paneer Selvam, Arunpravin @ 2024-02-29 11:10 UTC (permalink / raw)
To: Matthew Auld, dri-devel; +Cc: Christian König, Arnd Bergmann
[-- Attachment #1: Type: text/plain, Size: 7985 bytes --]
Reviewed-by: Arunpravin Paneer Selvam <Arunpravin.PaneerSelvam@amd.com>
On 2/29/2024 4:21 PM, Matthew Auld wrote:
> Gives the wrong impression that min page-size has to be tied to the CPU
> PAGE_SIZE.
>
> Signed-off-by: Matthew Auld<matthew.auld@intel.com>
> Cc: Arunpravin Paneer Selvam<Arunpravin.PaneerSelvam@amd.com>
> Cc: Christian König<christian.koenig@amd.com>
> Cc: Arnd Bergmann<arnd@arndb.de>
> ---
> drivers/gpu/drm/tests/drm_buddy_test.c | 42 +++++++++++++-------------
> 1 file changed, 21 insertions(+), 21 deletions(-)
>
> diff --git a/drivers/gpu/drm/tests/drm_buddy_test.c b/drivers/gpu/drm/tests/drm_buddy_test.c
> index be2d9d7764be..8528f39a84e6 100644
> --- a/drivers/gpu/drm/tests/drm_buddy_test.c
> +++ b/drivers/gpu/drm/tests/drm_buddy_test.c
> @@ -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);
[-- Attachment #2: Type: text/html, Size: 8695 bytes --]
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 1/2] drm/buddy: stop using PAGE_SIZE
2024-02-29 10:51 [PATCH 1/2] drm/buddy: stop using PAGE_SIZE Matthew Auld
2024-02-29 10:51 ` [PATCH 2/2] drm/tests/buddy: " Matthew Auld
2024-02-29 11:09 ` [PATCH 1/2] drm/buddy: " Paneer Selvam, Arunpravin
@ 2024-02-29 13:24 ` Christian König
2024-02-29 13:29 ` Arnd Bergmann
3 siblings, 0 replies; 10+ messages in thread
From: Christian König @ 2024-02-29 13:24 UTC (permalink / raw)
To: Matthew Auld, dri-devel; +Cc: Arunpravin Paneer Selvam, Arnd Bergmann
Am 29.02.24 um 11:51 schrieb 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.
>
> Signed-off-by: Matthew Auld <matthew.auld@intel.com>
> Cc: Arunpravin Paneer Selvam <Arunpravin.PaneerSelvam@amd.com>
> Cc: Christian König <christian.koenig@amd.com>
> Cc: Arnd Bergmann <arnd@arndb.de>
Acked-by: Christian König <christian.koenig@amd.com> for the series.
> ---
> drivers/gpu/drm/drm_buddy.c | 2 +-
> include/drm/drm_buddy.h | 6 +++---
> 2 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_buddy.c b/drivers/gpu/drm/drm_buddy.c
> index 5ebdd6f8f36e..f999568d69c1 100644
> --- a/drivers/gpu/drm/drm_buddy.c
> +++ b/drivers/gpu/drm/drm_buddy.c
> @@ -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))
> diff --git a/include/drm/drm_buddy.h b/include/drm/drm_buddy.h
> index a5b39fc01003..19ed661a32f3 100644
> --- a/include/drm/drm_buddy.h
> +++ b/include/drm/drm_buddy.h
> @@ -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;
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 1/2] drm/buddy: stop using PAGE_SIZE
2024-02-29 10:51 [PATCH 1/2] drm/buddy: stop using PAGE_SIZE Matthew Auld
` (2 preceding siblings ...)
2024-02-29 13:24 ` Christian König
@ 2024-02-29 13:29 ` Arnd Bergmann
2024-05-17 1:11 ` Dave Airlie
3 siblings, 1 reply; 10+ messages in thread
From: Arnd Bergmann @ 2024-02-29 13:29 UTC (permalink / raw)
To: Matthew Auld, dri-devel; +Cc: Arunpravin Paneer Selvam, Christian König
On Thu, Feb 29, 2024, at 11:51, Matthew Auld wrote:
> 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.
>
> Signed-off-by: Matthew Auld <matthew.auld@intel.com>
> Cc: Arunpravin Paneer Selvam <Arunpravin.PaneerSelvam@amd.com>
> Cc: Christian König <christian.koenig@amd.com>
> Cc: Arnd Bergmann <arnd@arndb.de>
Acked-by: Arnd Bergmann <arnd@arndb.de>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 1/2] drm/buddy: stop using PAGE_SIZE
2024-02-29 13:29 ` Arnd Bergmann
@ 2024-05-17 1:11 ` Dave Airlie
2024-05-17 8:53 ` Matthew Auld
0 siblings, 1 reply; 10+ messages in thread
From: Dave Airlie @ 2024-05-17 1:11 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Matthew Auld, dri-devel, Arunpravin Paneer Selvam, Christian König
On Thu, 29 Feb 2024 at 23:48, Arnd Bergmann <arnd@arndb.de> wrote:
>
> On Thu, Feb 29, 2024, at 11:51, Matthew Auld wrote:
> > 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.
> >
> > Signed-off-by: Matthew Auld <matthew.auld@intel.com>
> > Cc: Arunpravin Paneer Selvam <Arunpravin.PaneerSelvam@amd.com>
> > Cc: Christian König <christian.koenig@amd.com>
> > Cc: Arnd Bergmann <arnd@arndb.de>
>
> Acked-by: Arnd Bergmann <arnd@arndb.de>
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.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 1/2] drm/buddy: stop using PAGE_SIZE
2024-05-17 1:11 ` Dave Airlie
@ 2024-05-17 8:53 ` Matthew Auld
2024-05-17 11:00 ` Christian König
0 siblings, 1 reply; 10+ messages in thread
From: Matthew Auld @ 2024-05-17 8:53 UTC (permalink / raw)
To: Dave Airlie, Arnd Bergmann
Cc: dri-devel, Arunpravin Paneer Selvam, Christian König
On 17/05/2024 02:11, Dave Airlie wrote:
> On Thu, 29 Feb 2024 at 23:48, Arnd Bergmann <arnd@arndb.de> wrote:
>>
>> On Thu, Feb 29, 2024, at 11:51, Matthew Auld wrote:
>>> 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.
>>>
>>> Signed-off-by: Matthew Auld <matthew.auld@intel.com>
>>> Cc: Arunpravin Paneer Selvam <Arunpravin.PaneerSelvam@amd.com>
>>> Cc: Christian König <christian.koenig@amd.com>
>>> Cc: Arnd Bergmann <arnd@arndb.de>
>>
>> Acked-by: Arnd Bergmann <arnd@arndb.de>
>
> 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.
>
> I'm been testing 6.9 on 64K pages and the buddy tests are exploding so
> I wanted to pull this in.
>
> Dave.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 1/2] drm/buddy: stop using PAGE_SIZE
2024-05-17 8:53 ` Matthew Auld
@ 2024-05-17 11:00 ` Christian König
2024-05-17 11:17 ` Matthew Auld
0 siblings, 1 reply; 10+ messages in thread
From: Christian König @ 2024-05-17 11:00 UTC (permalink / raw)
To: Matthew Auld, Dave Airlie, Arnd Bergmann
Cc: dri-devel, Arunpravin Paneer Selvam
Am 17.05.24 um 10:53 schrieb Matthew Auld:
> On 17/05/2024 02:11, Dave Airlie wrote:
>> On Thu, 29 Feb 2024 at 23:48, Arnd Bergmann <arnd@arndb.de> wrote:
>>>
>>> On Thu, Feb 29, 2024, at 11:51, Matthew Auld wrote:
>>>> 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.
>>>>
>>>> Signed-off-by: Matthew Auld <matthew.auld@intel.com>
>>>> Cc: Arunpravin Paneer Selvam <Arunpravin.PaneerSelvam@amd.com>
>>>> Cc: Christian König <christian.koenig@amd.com>
>>>> Cc: Arnd Bergmann <arnd@arndb.de>
>>>
>>> Acked-by: Arnd Bergmann <arnd@arndb.de>
>>
>> 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.
>
>>
>> I'm been testing 6.9 on 64K pages and the buddy tests are exploding so
>> I wanted to pull this in.
>>
>> Dave.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 1/2] drm/buddy: stop using PAGE_SIZE
2024-05-17 11:00 ` Christian König
@ 2024-05-17 11:17 ` Matthew Auld
0 siblings, 0 replies; 10+ messages in thread
From: Matthew Auld @ 2024-05-17 11:17 UTC (permalink / raw)
To: Christian König, Dave Airlie, Arnd Bergmann
Cc: dri-devel, Arunpravin Paneer Selvam
On 17/05/2024 12:00, Christian König wrote:
> Am 17.05.24 um 10:53 schrieb Matthew Auld:
>> On 17/05/2024 02:11, Dave Airlie wrote:
>>> On Thu, 29 Feb 2024 at 23:48, Arnd Bergmann <arnd@arndb.de> wrote:
>>>>
>>>> On Thu, Feb 29, 2024, at 11:51, Matthew Auld wrote:
>>>>> 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.
>>>>>
>>>>> Signed-off-by: Matthew Auld <matthew.auld@intel.com>
>>>>> Cc: Arunpravin Paneer Selvam <Arunpravin.PaneerSelvam@amd.com>
>>>>> Cc: Christian König <christian.koenig@amd.com>
>>>>> Cc: Arnd Bergmann <arnd@arndb.de>
>>>>
>>>> Acked-by: Arnd Bergmann <arnd@arndb.de>
>>>
>>> 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.
>
> Regards,
> Christian.
>
>>
>>>
>>> I'm been testing 6.9 on 64K pages and the buddy tests are exploding so
>>> I wanted to pull this in.
>>>
>>> Dave.
>
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2024-05-17 11:17 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-29 10:51 [PATCH 1/2] drm/buddy: stop using PAGE_SIZE Matthew Auld
2024-02-29 10:51 ` [PATCH 2/2] drm/tests/buddy: " Matthew Auld
2024-02-29 11:10 ` Paneer Selvam, Arunpravin
2024-02-29 11:09 ` [PATCH 1/2] drm/buddy: " Paneer Selvam, Arunpravin
2024-02-29 13:24 ` Christian König
2024-02-29 13:29 ` Arnd Bergmann
2024-05-17 1:11 ` Dave Airlie
2024-05-17 8:53 ` Matthew Auld
2024-05-17 11:00 ` Christian König
2024-05-17 11:17 ` Matthew Auld
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).