[AMD Official Use Only]
Hi Chirs,
yes, right, the amdgpu drive rwill use amdgpu_bo_validate_size()
function to verify bo size,
but when driver try to allocate VRAM domain bo fail, the amdgpu driver will fall back to
allocate domain = (GTT | VRAM) bo.
please check following code, it will cause the 2nd
time to allocate bo fail during allocate 256Mb buffer to store dma address (via kvmalloc()).
initial_domain = (u32)(0xffffffff & args->in.domains);
retry:
r = amdgpu_gem_object_create(adev, size, args->in.alignment,
initial_domain,
flags, ttm_bo_type_device, resv, &gobj);
if (r && r != -ERESTARTSYS) {
if (flags & AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED) {
flags &= ~AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED;
goto retry;
}
if (initial_domain == AMDGPU_GEM_DOMAIN_VRAM) {
initial_domain |= AMDGPU_GEM_DOMAIN_GTT;
goto retry;
}
DRM_DEBUG("Failed to allocate GEM object (%llu, %d, %llu, %d)\n",
size, initial_domain, args->in.alignment, r);
}
Best Regards,
Kevin
From: Christian König <ckoenig.leichtzumerken@xxxxxxxxx>
Sent: Wednesday, April 20, 2022 7:55 PM To: Wang, Yang(Kevin) <KevinYang.Wang@xxxxxxx>; Koenig, Christian <Christian.Koenig@xxxxxxx>; dri-devel@xxxxxxxxxxxxxxxxxxxxx <dri-devel@xxxxxxxxxxxxxxxxxxxxx>; amd-gfx@xxxxxxxxxxxxxxxxxxxxx <amd-gfx@xxxxxxxxxxxxxxxxxxxxx> Subject: Re: [PATCH] drm/ttm: fix ttm tt init fail when size exceeds kmalloc limit Hi Kevin,
no, the test case should already fail in amdgpu_bo_validate_size(). If we have a system with 2TiB of memory where the test case could succeed then we should increase the requested size to something larger. And if the underlying core Linux kernel functions don't allow allocations as large as the requested one we should *NEVER* ever add workarounds like this. It is perfectly expected that this test case is not able to fulfill the desired allocation. That it fails during kvmalloc is unfortunate, but not a show stopper. Regards, Christian. Am 20.04.22 um 13:32 schrieb Wang, Yang(Kevin):
|