On 2018å¹´04æ??19æ?¥ 09:48, Zhang, Jerry (Junwei) wrote: > On 04/18/2018 06:37 PM, Chunming Zhou wrote: >> Otherwise, cpu stuck for 22s with kernel panic. >> >> Change-Id: I5b87cde662a4658c9ab253ba88d009c9628a44ca >> Signed-off-by: Chunming Zhou <david1.zhou at amd.com> >> --- >> Â drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 3 +-- >> Â 1 file changed, 1 insertion(+), 2 deletions(-) >> >> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c >> b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c >> index f0fbc331aa30..7131ad13c5b5 100644 >> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c >> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c >> @@ -1563,10 +1563,9 @@ int amdgpu_vm_bo_update(struct amdgpu_device >> *adev, >> Â Â Â Â Â Â Â Â Â Â * the evicted list so that it gets validated again on the >> Â Â Â Â Â Â Â Â Â Â * next command submission. >> Â Â Â Â Â Â Â Â Â Â */ >> +Â Â Â Â Â Â Â list_del_init(&bo_va->base.vm_status); >> Â Â Â Â Â Â Â Â Â if (!(bo->preferred_domains & >> amdgpu_mem_type_to_domain(mem_type))) >> Â Â Â Â Â Â Â Â Â Â Â Â Â list_add_tail(&bo_va->base.vm_status, &vm->evicted); >> -Â Â Â Â Â Â Â else >> -Â Â Â Â Â Â Â Â Â Â Â list_del_init(&bo_va->base.vm_status); >> Â Â Â Â Â } else { >> Â Â Â Â Â Â Â Â Â list_del_init(&bo_va->base.vm_status); >> Â Â Â Â Â } > We may simplify the logic as below. > How do you think? > > Â Â Â Â Â Â Â list_del_init(&bo_va->base.vm_status); > Â Â Â Â Â Â Â unsigned mem_type = bo->tbo.mem.mem_type; > Â Â Â Â Â Â Â /* If the BO is not in its preferred location add it back to > Â Â Â Â Â Â Â Â * the evicted list so that it gets validated again on the > Â Â Â Â Â Â Â Â * next command submission. > Â Â Â Â Â Â Â Â */ > Â Â Â Â Â Â Â if ((bo && bo->tbo.resv == vm->root.base.bo->tbo.resv) && > Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â (!(bo->preferred_domains & > amdgpu_mem_type_to_domain(mem_type)))) > list_add_tail(&bo_va->base.vm_status, &vm->evicted); Looks good, but I already pushed that patch just now. if you like, you can make a simplify patch with your idea. Regards, David Zhou > > Jerry > >> > _______________________________________________ > amd-gfx mailing list > amd-gfx at lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/amd-gfx