From: Jani Nikula <jani.nikula@linux.intel.com>
To: Arunpravin Paneer Selvam <Arunpravin.PaneerSelvam@amd.com>,
matthew.auld@intel.com, christian.koenig@amd.com,
dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org,
intel-xe@lists.freedesktop.org, amd-gfx@lists.freedesktop.org
Cc: alexander.deucher@amd.com,
Arunpravin Paneer Selvam <Arunpravin.PaneerSelvam@amd.com>
Subject: Re: [PATCH v6] drm/tests/gpu_buddy: add a new test case for buffer clearance during resume
Date: Tue, 28 Jul 2026 10:58:16 +0300 [thread overview]
Message-ID: <2f6a441823533feed75e1cba028f3ec5c8c33535@intel.com> (raw)
In-Reply-To: <20260721114236.507578-1-Arunpravin.PaneerSelvam@amd.com>
On Tue, 21 Jul 2026, Arunpravin Paneer Selvam <Arunpravin.PaneerSelvam@amd.com> wrote:
> Add a new unit test case for buffer clearance issue during
> resume.
>
> Using a non-power-of-two mm size, allocate alternating blocks of
> 4KiB in an even sequence and free them as cleared. All alternate
> blocks should be marked as dirty and the split blocks should be
> merged back to their original size when the blocks clear reset
> function is called.
>
> Signed-off-by: Arunpravin Paneer Selvam <Arunpravin.PaneerSelvam@amd.com>
> Reviewed-by: Matthew Auld <matthew.auld@intel.com>
> ---
> v6: Standalone repost of patch 3/3 from series 151686; the other two
> patches are already applied. Rebased onto the gpu_buddy rename
> (drm_buddy_test.c -> gpu_buddy_test.c, drm_buddy_* -> gpu_buddy_*)
> and updated the subject accordingly. No functional change; kept
> Matthew's Reviewed-by as the port is mechanical.
>
> drivers/gpu/tests/gpu_buddy_test.c | 41 ++++++++++++++++++++++++++++++
> 1 file changed, 41 insertions(+)
>
> diff --git a/drivers/gpu/tests/gpu_buddy_test.c b/drivers/gpu/tests/gpu_buddy_test.c
> index 7df5c2ae83bb..89698563c61b 100644
> --- a/drivers/gpu/tests/gpu_buddy_test.c
> +++ b/drivers/gpu/tests/gpu_buddy_test.c
> @@ -1002,6 +1002,47 @@ static void gpu_test_buddy_alloc_clear(struct kunit *test)
> "buddy_alloc hit an error size=%lu\n", ps);
> gpu_buddy_free_list(&mm, &allocated, GPU_BUDDY_CLEARED);
> gpu_buddy_fini(&mm);
> +
> + /*
> + * Using a non-power-of-two mm size, allocate alternating blocks of 4KiB in an
> + * even sequence and free them as cleared. All blocks should be marked as
> + * dirty and the split blocks should be merged back to their original
> + * size when the blocks clear reset function is called.
> + */
> + KUNIT_EXPECT_FALSE(test, gpu_buddy_init(&mm, mm_size, ps));
> + KUNIT_EXPECT_EQ(test, mm.max_order, max_order);
> +
> + i = 0;
> + n_pages = mm_size / ps;
> + do {
> + if (i % 2 == 0)
> + KUNIT_ASSERT_FALSE_MSG(test, gpu_buddy_alloc_blocks(&mm, 0, mm_size,
> + ps, ps, &allocated, 0),
> + "buddy_alloc hit an error size=%lu\n", ps);
> + } while (++i < n_pages);
Please prefer a for loop over do-while or while. This is so much more
obvious:
for (i = 0; i < n_pages; i++)
> +
> + gpu_buddy_free_list(&mm, &allocated, GPU_BUDDY_CLEARED);
> + gpu_buddy_reset_clear(&mm, false);
> + KUNIT_EXPECT_EQ(test, mm.clear_avail, 0);
> +
> + /*
> + * Using a non-power-of-two mm size, allocate alternating blocks of 4KiB in an
> + * odd sequence and free them as cleared. All blocks should be marked as
> + * cleared and the split blocks should be merged back to their original
> + * size when the blocks clear reset function is called.
> + */
> + i = 0;
> + do {
> + if (i % 2 != 0)
> + KUNIT_ASSERT_FALSE_MSG(test, gpu_buddy_alloc_blocks(&mm, 0, mm_size,
> + ps, ps, &allocated, 0),
> + "buddy_alloc hit an error size=%lu\n", ps);
> + } while (++i < n_pages);
> +
> + gpu_buddy_free_list(&mm, &allocated, GPU_BUDDY_CLEARED);
> + gpu_buddy_reset_clear(&mm, true);
> + KUNIT_EXPECT_EQ(test, mm.clear_avail, mm_size);
> + gpu_buddy_fini(&mm);
> }
>
> static void gpu_test_buddy_alloc_contiguous(struct kunit *test)
--
Jani Nikula, Intel
prev parent reply other threads:[~2026-07-28 7:58 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-21 11:42 [PATCH v6] drm/tests/gpu_buddy: add a new test case for buffer clearance during resume Arunpravin Paneer Selvam
2026-07-21 13:05 ` ✓ i915.CI.BAT: success for " Patchwork
2026-07-22 3:49 ` ✓ i915.CI.Full: " Patchwork
2026-07-28 7:58 ` Jani Nikula [this message]
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=2f6a441823533feed75e1cba028f3ec5c8c33535@intel.com \
--to=jani.nikula@linux.intel.com \
--cc=Arunpravin.PaneerSelvam@amd.com \
--cc=alexander.deucher@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=christian.koenig@amd.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=intel-xe@lists.freedesktop.org \
--cc=matthew.auld@intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox