From: "Zhang, Jerry (Junwei)" <Jerry.Zhang-5C7GfCeVMHo@public.gmane.org>
To: "Christian König"
<ckoenig.leichtzumerken-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Subject: Re: [PATCH libdrm] tests/amdgpu: add unaligned VM test
Date: Mon, 10 Sep 2018 10:44:40 +0800 [thread overview]
Message-ID: <5B95DA98.5040009@amd.com> (raw)
In-Reply-To: <20180909180427.1979-1-christian.koenig-5C7GfCeVMHo@public.gmane.org>
On 09/10/2018 02:04 AM, Christian König wrote:
> Make a VM mapping which is as unaligned as possible.
Is it going to test unaligned address between BO allocation and BO mapping
and skip huge page mapping?
>
> Signed-off-by: Christian König <christian.koenig@amd.com>
> ---
> tests/amdgpu/vm_tests.c | 45 ++++++++++++++++++++++++++++++++++++++++++++-
> 1 file changed, 44 insertions(+), 1 deletion(-)
>
> diff --git a/tests/amdgpu/vm_tests.c b/tests/amdgpu/vm_tests.c
> index 7b6dc5d6..fada2987 100644
> --- a/tests/amdgpu/vm_tests.c
> +++ b/tests/amdgpu/vm_tests.c
> @@ -31,8 +31,8 @@ static amdgpu_device_handle device_handle;
> static uint32_t major_version;
> static uint32_t minor_version;
>
> -
> static void amdgpu_vmid_reserve_test(void);
> +static void amdgpu_vm_unaligned_map(void);
>
> CU_BOOL suite_vm_tests_enable(void)
> {
> @@ -84,6 +84,7 @@ int suite_vm_tests_clean(void)
>
> CU_TestInfo vm_tests[] = {
> { "resere vmid test", amdgpu_vmid_reserve_test },
> + { "unaligned map", amdgpu_vm_unaligned_map },
> CU_TEST_INFO_NULL,
> };
>
> @@ -167,3 +168,45 @@ static void amdgpu_vmid_reserve_test(void)
> r = amdgpu_cs_ctx_free(context_handle);
> CU_ASSERT_EQUAL(r, 0);
> }
> +
> +static void amdgpu_vm_unaligned_map(void)
> +{
> + const uint64_t map_size = (4ULL << 30) - (2 << 12);
> + struct amdgpu_bo_alloc_request request = {};
> + amdgpu_bo_handle buf_handle;
> + amdgpu_va_handle handle;
> + uint64_t vmc_addr;
> + int r;
> +
> + request.alloc_size = 4ULL << 30;
> + request.phys_alignment = 4096;
> + request.preferred_heap = AMDGPU_GEM_DOMAIN_VRAM;
> + request.flags = AMDGPU_GEM_CREATE_NO_CPU_ACCESS;
> +
> + r = amdgpu_bo_alloc(device_handle, &request, &buf_handle);
> + /* Don't let the test fail if the device doesn't have enough VRAM */
We may print some info to the console here.
Regards,
Jerry
> + if (r)
> + return;
> +
> + r = amdgpu_va_range_alloc(device_handle, amdgpu_gpu_va_range_general,
> + 4ULL << 30, 1ULL << 30, 0, &vmc_addr,
> + &handle, 0);
> + CU_ASSERT_EQUAL(r, 0);
> + if (r)
> + goto error_va_alloc;
> +
> + vmc_addr += 1 << 12;
> +
> + r = amdgpu_bo_va_op(buf_handle, 0, map_size, vmc_addr, 0,
> + AMDGPU_VA_OP_MAP);
> + CU_ASSERT_EQUAL(r, 0);
> + if (r)
> + goto error_va_alloc;
> +
> + amdgpu_bo_va_op(buf_handle, 0, map_size, vmc_addr, 0,
> + AMDGPU_VA_OP_UNMAP);
> +
> +error_va_alloc:
> + amdgpu_bo_free(buf_handle);
> +
> +}
>
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
next prev parent reply other threads:[~2018-09-10 2:44 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-09 18:04 [PATCH libdrm] tests/amdgpu: add unaligned VM test Christian König
[not found] ` <20180909180427.1979-1-christian.koenig-5C7GfCeVMHo@public.gmane.org>
2018-09-10 2:44 ` Zhang, Jerry (Junwei) [this message]
[not found] ` <5B95DA98.5040009-5C7GfCeVMHo@public.gmane.org>
2018-09-10 9:33 ` Christian König
[not found] ` <a6ff230a-35e9-7009-e75a-dd7b3edd32d0-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2018-09-11 2:06 ` Zhang, Jerry (Junwei)
[not found] ` <5B972341.7050506-5C7GfCeVMHo@public.gmane.org>
2018-09-13 12:20 ` Christian König
[not found] ` <ff29eaf9-5075-a04e-ed76-388fc4610105-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2018-09-14 9:17 ` Zhang, Jerry(Junwei)
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=5B95DA98.5040009@amd.com \
--to=jerry.zhang-5c7gfcevmho@public.gmane.org \
--cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
--cc=ckoenig.leichtzumerken-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
/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