That's kind of hack because dma32 zone is not needed, it has bad effect to trigger unnecessary eviction for KFDTest.BigBufStressTest. But ttm_bo_global_init->ttm_mem_global_init always create dma32 zone without accepting any parameter.
To avoid ttm_mem_global_alloc_page account to dma32 zone, another option is to add a new flag to ttm_operation_ctx->flags, that looks not good either. Thanks, Philip On 2019-06-12 1:23 p.m., Kuehling, Felix wrote: > TTM itself has some logic for need_dma32 and TTM_PAGE_FLAG_DMA32. I > believe that should already handle this. need_dma32 is passed from > amdgpu to ttm_bo_device_init to bdev->need_dma32. ttm_tt_create > translates that to page_flags |= TTM_PAGE_FLAG_DMA32 and passes that to > bdev->driver->ttm_tt_create. The two page allocators in ttm_page_alloc.c > and ttm_page_alloc_dma.c check ttm->page_flags. Is that chain broken > somewhere? Overriding glob->mem_glob->num_zones from amdgpu seems to be > a bit of a hack. > > Regards, > Felix > > On 2019-06-12 8:13, Yang, Philip wrote: >> TTM create two zones, kernel zone and dma32 zone for system memory. If >> system memory address allocated is below 4GB, this account to dma32 zone >> and will exhaust dma32 zone and trigger unnesssary TTM eviction. >> >> Patch "drm/ttm: Account for kernel allocations in kernel zone only" only >> handle the allocation for acc_size, the system memory page allocation is >> through ttm_mem_global_alloc_page which still account to dma32 zone if >> page is below 4GB. >> >> Change-Id: I289b85d891b8f64a1422c42b1eab398098ab7ef7 >> Signed-off-by: Philip Yang <philip.y...@amd.com> >> --- >> drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 4 ++++ >> 1 file changed, 4 insertions(+) >> >> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c >> b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c >> index 2778ff63d97d..79bb9dfe617b 100644 >> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c >> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c >> @@ -1686,6 +1686,10 @@ int amdgpu_ttm_init(struct amdgpu_device *adev) >> } >> adev->mman.initialized = true; >> >> + /* Only kernel zone (no dma32 zone) if device does not require dma32 */ >> + if (!adev->need_dma32) >> + adev->mman.bdev.glob->mem_glob->num_zones = 1; >> + >> /* We opt to avoid OOM on system pages allocations */ >> adev->mman.bdev.no_retry = true; >> _______________________________________________ amd-gfx mailing list amd-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/amd-gfx