All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/amdgpu: simplify bo_va list when vm bo update
@ 2018-04-19  5:31 Junwei Zhang
       [not found] ` <1524115892-22616-1-git-send-email-Jerry.Zhang-5C7GfCeVMHo@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Junwei Zhang @ 2018-04-19  5:31 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW; +Cc: Junwei Zhang

Signed-off-by: Junwei Zhang <Jerry.Zhang@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 21 +++++++++------------
 1 file changed, 9 insertions(+), 12 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
index 8c34060..93ad925 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
@@ -1561,19 +1561,16 @@ int amdgpu_vm_bo_update(struct amdgpu_device *adev,
 	}
 
 	spin_lock(&vm->status_lock);
-	if (bo && bo->tbo.resv == vm->root.base.bo->tbo.resv) {
-		unsigned mem_type = bo->tbo.mem.mem_type;
+	list_del_init(&bo_va->base.vm_status);
 
-		/* 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.
-		 */
-		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);
-	}
+	/* 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.
+	 */
+	unsigned mem_type = bo->tbo.mem.mem_type;
+	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);
 	spin_unlock(&vm->status_lock);
 
 	list_splice_init(&bo_va->invalids, &bo_va->valids);
-- 
1.9.1

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] drm/amdgpu: simplify bo_va list when vm bo update
       [not found] ` <1524115892-22616-1-git-send-email-Jerry.Zhang-5C7GfCeVMHo@public.gmane.org>
@ 2018-04-19  6:26   ` zhoucm1
       [not found]     ` <5c9f7bf7-df86-4201-24f2-7adadef1f1c1-5C7GfCeVMHo@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: zhoucm1 @ 2018-04-19  6:26 UTC (permalink / raw)
  To: Junwei Zhang, amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW



On 2018年04月19日 13:31, Junwei Zhang wrote:
> Signed-off-by: Junwei Zhang <Jerry.Zhang@amd.com>
> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 21 +++++++++------------
>   1 file changed, 9 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> index 8c34060..93ad925 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> @@ -1561,19 +1561,16 @@ int amdgpu_vm_bo_update(struct amdgpu_device *adev,
>   	}
>   
>   	spin_lock(&vm->status_lock);
> -	if (bo && bo->tbo.resv == vm->root.base.bo->tbo.resv) {
> -		unsigned mem_type = bo->tbo.mem.mem_type;
> +	list_del_init(&bo_va->base.vm_status);
>   
> -		/* 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.
> -		 */
> -		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);
> -	}
> +	/* 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.
> +	 */
> +	unsigned mem_type = bo->tbo.mem.mem_type;
Don't you get compiling warning for defining var between code?

Regards,
David Zhou
> +	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);
>   	spin_unlock(&vm->status_lock);
>   
>   	list_splice_init(&bo_va->invalids, &bo_va->valids);

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] drm/amdgpu: simplify bo_va list when vm bo update
       [not found]     ` <5c9f7bf7-df86-4201-24f2-7adadef1f1c1-5C7GfCeVMHo@public.gmane.org>
@ 2018-04-19  6:53       ` Zhang, Jerry (Junwei)
  0 siblings, 0 replies; 3+ messages in thread
From: Zhang, Jerry (Junwei) @ 2018-04-19  6:53 UTC (permalink / raw)
  To: zhoucm1, amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

On 04/19/2018 02:26 PM, zhoucm1 wrote:
>
>
> On 2018年04月19日 13:31, Junwei Zhang wrote:
>> Signed-off-by: Junwei Zhang <Jerry.Zhang@amd.com>
>> ---
>>   drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 21 +++++++++------------
>>   1 file changed, 9 insertions(+), 12 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
>> index 8c34060..93ad925 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
>> @@ -1561,19 +1561,16 @@ int amdgpu_vm_bo_update(struct amdgpu_device *adev,
>>       }
>>       spin_lock(&vm->status_lock);
>> -    if (bo && bo->tbo.resv == vm->root.base.bo->tbo.resv) {
>> -        unsigned mem_type = bo->tbo.mem.mem_type;
>> +    list_del_init(&bo_va->base.vm_status);
>> -        /* 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.
>> -         */
>> -        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);
>> -    }
>> +    /* 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.
>> +     */
>> +    unsigned mem_type = bo->tbo.mem.mem_type;
> Don't you get compiling warning for defining var between code?

Thanks to reminder that.
Fixed in v2.

Jerry

>
> Regards,
> David Zhou
>> +    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);
>>       spin_unlock(&vm->status_lock);
>>       list_splice_init(&bo_va->invalids, &bo_va->valids);
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-04-19  6:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-19  5:31 [PATCH] drm/amdgpu: simplify bo_va list when vm bo update Junwei Zhang
     [not found] ` <1524115892-22616-1-git-send-email-Jerry.Zhang-5C7GfCeVMHo@public.gmane.org>
2018-04-19  6:26   ` zhoucm1
     [not found]     ` <5c9f7bf7-df86-4201-24f2-7adadef1f1c1-5C7GfCeVMHo@public.gmane.org>
2018-04-19  6:53       ` Zhang, Jerry (Junwei)

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.