From: Matthew Auld <matthew.auld@intel.com>
To: "Paneer Selvam, Arunpravin" <arunpravin.paneerselvam@amd.com>,
dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org
Cc: christian.koenig@amd.com, alexander.deucher@amd.com,
"Lin . Cao" <lincao12@amd.com>
Subject: Re: [PATCH v2 2/2] drm/buddy: Add a testcase to verify the multiroot fini
Date: Mon, 6 Jan 2025 12:40:22 +0000 [thread overview]
Message-ID: <043cb503-e05a-4383-95e4-df501c6a206a@intel.com> (raw)
In-Reply-To: <1d22b16a-8d8c-433d-a916-d6bec849f9f8@amd.com>
Hey,
On 06/01/2025 12:37, Paneer Selvam, Arunpravin wrote:
> Hi Matthew,
>
> Ping?
Just got back from time off. I already slapped an r-b here:
https://lore.kernel.org/dri-devel/aa27455c-04b8-494c-a3b5-c4385a7748bc@intel.com/
>
> Regards,
> Arun.
>
> On 12/26/2024 12:31 PM, Arunpravin Paneer Selvam wrote:
>> - Added a testcase to verify the multiroot force merge fini.
>> - Added a new field in_use to track the mm freed status.
>>
>> v2:(Matthew)
>> - Add kunit_fail_current_test() when WARN_ON is true.
>>
>> Signed-off-by: Arunpravin Paneer Selvam <Arunpravin.PaneerSelvam@amd.com>
>> Signed-off-by: Lin.Cao <lincao12@amd.com>
>> ---
>> drivers/gpu/drm/drm_buddy.c | 6 +++++-
>> drivers/gpu/drm/tests/drm_buddy_test.c | 29 ++++++++++++++++++--------
>> 2 files changed, 25 insertions(+), 10 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/drm_buddy.c b/drivers/gpu/drm/drm_buddy.c
>> index ca42e6081d27..241c855f891f 100644
>> --- a/drivers/gpu/drm/drm_buddy.c
>> +++ b/drivers/gpu/drm/drm_buddy.c
>> @@ -3,6 +3,8 @@
>> * Copyright © 2021 Intel Corporation
>> */
>> +#include <kunit/test-bug.h>
>> +
>> #include <linux/kmemleak.h>
>> #include <linux/module.h>
>> #include <linux/sizes.h>
>> @@ -335,7 +337,9 @@ void drm_buddy_fini(struct drm_buddy *mm)
>> start = drm_buddy_block_offset(mm->roots[i]);
>> __force_merge(mm, start, start + size, order);
>> - WARN_ON(!drm_buddy_block_is_free(mm->roots[i]));
>> + if (WARN_ON(!drm_buddy_block_is_free(mm->roots[i])))
>> + kunit_fail_current_test("buddy_fini() root");
>> +
>> drm_block_free(mm, mm->roots[i]);
>> root_size = mm->chunk_size << order;
>> diff --git a/drivers/gpu/drm/tests/drm_buddy_test.c b/drivers/gpu/drm/
>> tests/drm_buddy_test.c
>> index 9662c949d0e3..4b5818f9f2a9 100644
>> --- a/drivers/gpu/drm/tests/drm_buddy_test.c
>> +++ b/drivers/gpu/drm/tests/drm_buddy_test.c
>> @@ -385,17 +385,28 @@ static void drm_test_buddy_alloc_clear(struct
>> kunit *test)
>> drm_buddy_fini(&mm);
>> /*
>> - * Create a new mm with a non power-of-two size. Allocate a
>> random size, free as
>> - * cleared and then call fini. This will ensure the multi-root
>> force merge during
>> - * fini.
>> + * Create a new mm with a non power-of-two size. Allocate a
>> random size from each
>> + * root, free as cleared and then call fini. This will ensure the
>> multi-root
>> + * force merge during fini.
>> */
>> - mm_size = 12 * SZ_4K;
>> - size = max(round_up(prandom_u32_state(&prng) % mm_size, ps), ps);
>> + mm_size = (SZ_4K << max_order) + (SZ_4K << (max_order - 2));
>> +
>> KUNIT_EXPECT_FALSE(test, drm_buddy_init(&mm, mm_size, ps));
>> - KUNIT_ASSERT_FALSE_MSG(test, drm_buddy_alloc_blocks(&mm, 0, mm_size,
>> - size, ps, &allocated,
>> - DRM_BUDDY_TOPDOWN_ALLOCATION),
>> - "buddy_alloc hit an error size=%u\n", size);
>> + KUNIT_EXPECT_EQ(test, mm.max_order, max_order);
>> + KUNIT_ASSERT_FALSE_MSG(test, drm_buddy_alloc_blocks(&mm, 0, SZ_4K
>> << max_order,
>> + 4 * ps, ps, &allocated,
>> + DRM_BUDDY_RANGE_ALLOCATION),
>> + "buddy_alloc hit an error size=%lu\n", 4 * ps);
>> + drm_buddy_free_list(&mm, &allocated, DRM_BUDDY_CLEARED);
>> + KUNIT_ASSERT_FALSE_MSG(test, drm_buddy_alloc_blocks(&mm, 0, SZ_4K
>> << max_order,
>> + 2 * ps, ps, &allocated,
>> + DRM_BUDDY_CLEAR_ALLOCATION),
>> + "buddy_alloc hit an error size=%lu\n", 2 * ps);
>> + drm_buddy_free_list(&mm, &allocated, DRM_BUDDY_CLEARED);
>> + KUNIT_ASSERT_FALSE_MSG(test, drm_buddy_alloc_blocks(&mm, SZ_4K <<
>> max_order, mm_size,
>> + ps, ps, &allocated,
>> + DRM_BUDDY_RANGE_ALLOCATION),
>> + "buddy_alloc hit an error size=%lu\n", ps);
>> drm_buddy_free_list(&mm, &allocated, DRM_BUDDY_CLEARED);
>> drm_buddy_fini(&mm);
>> }
>
next prev parent reply other threads:[~2025-01-06 12:40 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-26 7:01 [PATCH v2 1/2] drm/buddy: fix issue that force_merge cannot free all roots Arunpravin Paneer Selvam
2024-12-26 7:01 ` [PATCH v2 2/2] drm/buddy: Add a testcase to verify the multiroot fini Arunpravin Paneer Selvam
2025-01-06 9:51 ` Matthew Auld
2025-01-06 12:37 ` Paneer Selvam, Arunpravin
2025-01-06 12:40 ` Matthew Auld [this message]
2025-01-15 11:38 ` Jani Nikula
2025-01-15 13:53 ` Paneer Selvam, Arunpravin
2025-01-15 12:12 ` [v2,2/2] " Hellstrom, Thomas
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=043cb503-e05a-4383-95e4-df501c6a206a@intel.com \
--to=matthew.auld@intel.com \
--cc=alexander.deucher@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=arunpravin.paneerselvam@amd.com \
--cc=christian.koenig@amd.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=lincao12@amd.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.