[PATCH i-g-t] tests/amdgpu: fix VM test issue

Zhang, Jesse(Jie) Jesse.Zhang at amd.com
Fri Dec 15 01:43:21 UTC 2023


[AMD Official Use Only - General]

-----Original Message-----
From: Koenig, Christian <Christian.Koenig at amd.com>
Sent: Thursday, December 14, 2023 5:54 PM
To: Zhang, Jesse(Jie) <Jesse.Zhang at amd.com>; igt-dev at lists.freedesktop.org
Cc: Prosyak, Vitaly <Vitaly.Prosyak at amd.com>; Deucher, Alexander <Alexander.Deucher at amd.com>; Luben Tuikov <luben.tuikov at amd.com>; Kamil Konieczny <kamil.konieczny at linux.intel.com>
Subject: Re: [PATCH i-g-t] tests/amdgpu: fix VM test issue

Am 14.12.23 um 10:07 schrieb Jesse Zhang:
> In some cases, the size of Vram and GTT is not large, such as mobile devices.
> It should be skipped.

Well how much memory is actually needed? The unaligned mmap test should be able to work with something like 2-8MiB.

Maybe we are just using something to big here, that below looks like we are using a 1GiB buffer.
[Zhang, Jesse(Jie)] Hi Christian,
  Hi Christian,
allocate size is 4G(4ULL <<30) in this test. But for some APUs, VRAM size is 512M and GTT size is  3727683584 (=3554M =3G).
Here is the test code:

static void
amdgpu_vm_unaligned_map(amdgpu_device_handle device_handle)
{
        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; = 4294967296 = 4G
        request.phys_alignment = 4096;
        request.preferred_heap = AMDGPU_GEM_DOMAIN_VRAM;
        request.flags = AMDGPU_GEM_CREATE_NO_CPU_ACCESS;
              ...
Here is the kernel log:
  200.689133] [drm] initializing kernel modesetting (IP DISCOVERY 0x1002:0x15BF 0x1002:0x0124 0x03).
[  200.690103] [drm] register mmio base: 0xB0600000
[  200.690105] [drm] register mmio size: 524288
[  200.693709] [drm] add ip block number 0 <soc21_common>
[  200.693711] [drm] add ip block number 1 <gmc_v11_0>
[  200.693713] [drm] add ip block number 2 <ih_v6_0>
[  200.693714] [drm] add ip block number 3 <psp>
[  200.693715] [drm] add ip block number 4 <smu>
[  200.693716] [drm] add ip block number 5 <dm>
[  200.693718] [drm] add ip block number 6 <gfx_v11_0>
[  200.693719] [drm] add ip block number 7 <sdma_v6_0>
[  200.693720] [drm] add ip block number 8 <vcn_v4_0>
[  200.693722] [drm] add ip block number 9 <jpeg_v4_0>
[  200.693723] [drm] add ip block number 10 <mes_v11_0>
[  200.693736] amdgpu 0000:c2:00.0: amdgpu: Fetched VBIOS from VFCT
[  200.693738] amdgpu: ATOM BIOS: 113-PHXGENERIC-001
[  200.710068] [drm] VCN(0) encode/decode are enabled in VM mode
[  200.711575] amdgpu 0000:c2:00.0: [drm:jpeg_v4_0_early_init [amdgpu]] JPEG decode is enabled in VM mode
[  200.713991] Console: switching to colour dummy device 80x25
[  200.714043] amdgpu 0000:c2:00.0: vgaarb: deactivate vga console
[  200.714046] amdgpu 0000:c2:00.0: amdgpu: Trusted Memory Zone (TMZ) feature enabled
[  200.714094] [drm] vm size is 262144 GB, 4 levels, block size is 9-bit, fragment size is 9-bit
[  200.714117] amdgpu 0000:c2:00.0: amdgpu: VRAM: 512M 0x0000008000000000 - 0x000000801FFFFFFF (512M used)
[  200.714119] amdgpu 0000:c2:00.0: amdgpu: GART: 512M 0x00007FFF00000000 - 0x00007FFF1FFFFFFF
[  200.714133] [drm] Detected VRAM RAM=512M, BAR=512M
[  200.714134] [drm] RAM width 128bits LPDDR5
[  200.714684] [drm] amdgpu: 512M of VRAM memory ready
[  200.714686] [drm] amdgpu: 3554M of GTT memory ready.

...
//dmesg log when run vm test.
[63261.226958] amdgpu_bo_validate_size[472] domain:4 ####
[63261.226961] BO size 4294967296 > total memory in domain: 536870912
[63261.226963] amdgpu_bo_create[573] retunr -ENOMEM ####
[63261.226967] amdgpu_bo_validate_size[472] domain:6 ####
[63261.226968] BO size 4294967296 > total memory in domain: 3727683584
[63261.226970] amdgpu_bo_create[573] retunr -ENOMEM ####

Thanks
Jesse

Christian.

>
> Cc: Vitaly Prosyak <vitaly.prosyak at amd.com>
> Cc: Alex Deucher <alexander.deucher at amd.com>
> Cc: Christian Koenig <christian.koenig at amd.com>
> Cc: Kamil Konieczny <kamil.konieczny at linux.intel.com>
>
> Signed-off-by: Jesse zhang <jesse.zhang at amd.com>
> ---
>   tests/amdgpu/amd_vm.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/tests/amdgpu/amd_vm.c b/tests/amdgpu/amd_vm.c index
> 11be25ae8..0dde28e2e 100644
> --- a/tests/amdgpu/amd_vm.c
> +++ b/tests/amdgpu/amd_vm.c
> @@ -127,8 +127,8 @@ amdgpu_vm_unaligned_map(amdgpu_device_handle device_handle)
>       request.preferred_heap = AMDGPU_GEM_DOMAIN_VRAM;
>       request.flags = AMDGPU_GEM_CREATE_NO_CPU_ACCESS;
>
> -     r = amdgpu_bo_alloc(device_handle, &request, &buf_handle);
> -     igt_assert_eq(r, 0);
> +     /* Don't let the test fail if the device doesn't have enough VRAM */
> +     igt_skip_on(amdgpu_bo_alloc(device_handle, &request, &buf_handle));
>
>       r = amdgpu_va_range_alloc(device_handle, amdgpu_gpu_va_range_general,
>                               4ULL << 30, 1ULL << 30, 0, &vmc_addr,



More information about the igt-dev mailing list