From: Matthew Auld <matthew.auld@intel.com>
To: Arunpravin <Arunpravin.PaneerSelvam@amd.com>,
dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org,
amd-gfx@lists.freedesktop.org
Cc: alexander.deucher@amd.com, tzimmermann@suse.de, christian.koenig@amd.com
Subject: Re: [Intel-gfx] [PATCH 2/7] drm/selftests: add drm buddy alloc limit testcase
Date: Tue, 8 Feb 2022 09:40:10 +0000 [thread overview]
Message-ID: <644ce762-cb6a-0cf1-d1e0-1e799a3405bf@intel.com> (raw)
In-Reply-To: <20220203133234.3350-2-Arunpravin.PaneerSelvam@amd.com>
On 03/02/2022 13:32, Arunpravin wrote:
> add a test to check the maximum allocation limit
>
> Signed-off-by: Arunpravin <Arunpravin.PaneerSelvam@amd.com>
> ---
> .../gpu/drm/selftests/drm_buddy_selftests.h | 1 +
> drivers/gpu/drm/selftests/test-drm_buddy.c | 60 +++++++++++++++++++
> 2 files changed, 61 insertions(+)
>
> diff --git a/drivers/gpu/drm/selftests/drm_buddy_selftests.h b/drivers/gpu/drm/selftests/drm_buddy_selftests.h
> index a4bcf3a6dfe3..ebe16162762f 100644
> --- a/drivers/gpu/drm/selftests/drm_buddy_selftests.h
> +++ b/drivers/gpu/drm/selftests/drm_buddy_selftests.h
> @@ -7,3 +7,4 @@
> * Tests are executed in order by igt/drm_buddy
> */
> selftest(sanitycheck, igt_sanitycheck) /* keep first (selfcheck for igt) */
> +selftest(buddy_alloc_limit, igt_buddy_alloc_limit)
> diff --git a/drivers/gpu/drm/selftests/test-drm_buddy.c b/drivers/gpu/drm/selftests/test-drm_buddy.c
> index 51e4d393d22c..fd7d1a112458 100644
> --- a/drivers/gpu/drm/selftests/test-drm_buddy.c
> +++ b/drivers/gpu/drm/selftests/test-drm_buddy.c
> @@ -16,6 +16,66 @@
>
> static unsigned int random_seed;
>
> +static int igt_buddy_alloc_limit(void *arg)
> +{
> + u64 end, size = U64_MAX, start = 0;
> + struct drm_buddy_block *block;
> + unsigned long flags = 0;
> + LIST_HEAD(allocated);
> + struct drm_buddy mm;
> + int err;
> +
> + size = end = round_down(size, 4096);
> + err = drm_buddy_init(&mm, size, PAGE_SIZE);
> + if (err)
> + return err;
> +
> + if (mm.max_order != DRM_BUDDY_MAX_ORDER) {
> + pr_err("mm.max_order(%d) != %d\n",
> + mm.max_order, DRM_BUDDY_MAX_ORDER);
> + err = -EINVAL;
> + goto out_fini;
> + }
> +
> + err = drm_buddy_alloc_blocks(&mm, start, end, size,
> + PAGE_SIZE, &allocated, flags);
> +
> + if (unlikely(err))
> + goto out_free;
> +
> + block = list_first_entry_or_null(&allocated,
> + struct drm_buddy_block,
> + link);
> +
> + if (!block)
err = -EINVAL;
> + goto out_fini;
> +
> + if (drm_buddy_block_order(block) != mm.max_order) {
> + pr_err("block order(%d) != %d\n",
> + drm_buddy_block_order(block), mm.max_order);
> + err = -EINVAL;
> + goto out_free;
> + }
> +
> + if (drm_buddy_block_size(&mm, block) !=
> + BIT_ULL(mm.max_order) * PAGE_SIZE) {
> + pr_err("block size(%llu) != %llu\n",
> + drm_buddy_block_size(&mm, block),
> + BIT_ULL(mm.max_order) * PAGE_SIZE);
> + err = -EINVAL;
> + goto out_free;
> + }
> +
> + if (!err)
Always true AFAICT?
> + pr_info("%s - succeeded\n", __func__);
I guess this could be made part of the run_selftests()? It looks like it
already prints the current test, perhaps that is already enough?
With the err = -EINVAL change, feel free to add,
Reviewed-by: Matthew Auld <matthew.auld@intel.com>
> +
> +out_free:
> + drm_buddy_free_list(&mm, &allocated);
> +out_fini:
> + drm_buddy_fini(&mm);
> + return err;
> +}
> +
> static int igt_sanitycheck(void *ignored)
> {
> pr_info("%s - ok!\n", __func__);
next prev parent reply other threads:[~2022-02-08 9:40 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-03 13:32 [Intel-gfx] [PATCH 1/7] drm/selftests: Move i915 buddy selftests into drm Arunpravin
2022-02-03 13:32 ` [Intel-gfx] [PATCH 2/7] drm/selftests: add drm buddy alloc limit testcase Arunpravin
2022-02-08 9:40 ` Matthew Auld [this message]
2022-02-22 19:07 ` Arunpravin
2022-02-03 13:32 ` [Intel-gfx] [PATCH 3/7] drm/selftests: add drm buddy alloc range testcase Arunpravin
2022-02-08 10:03 ` Matthew Auld
2022-02-03 13:32 ` [Intel-gfx] [PATCH 4/7] drm/selftests: add drm buddy optimistic testcase Arunpravin
2022-02-08 10:12 ` Matthew Auld
2022-02-03 13:32 ` [Intel-gfx] [PATCH 5/7] drm/selftests: add drm buddy pessimistic testcase Arunpravin
2022-02-08 10:17 ` Matthew Auld
2022-02-03 13:32 ` [Intel-gfx] [PATCH 6/7] drm/selftests: add drm buddy smoke testcase Arunpravin
2022-02-08 10:22 ` Matthew Auld
2022-02-03 13:32 ` [Intel-gfx] [PATCH 7/7] drm/selftests: add drm buddy pathological testcase Arunpravin
2022-02-08 10:26 ` Matthew Auld
2022-02-03 14:12 ` [Intel-gfx] ✗ Fi.CI.BUILD: failure for series starting with [1/7] drm/selftests: Move i915 buddy selftests into drm Patchwork
2022-02-03 14:33 ` [Intel-gfx] [PATCH 1/7] " Christian König
2022-02-08 10:35 ` Matthew Auld
2022-02-22 18:35 ` Arunpravin
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=644ce762-cb6a-0cf1-d1e0-1e799a3405bf@intel.com \
--to=matthew.auld@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=tzimmermann@suse.de \
/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