drm/amdgpu: fix object unreserved issue
Subsystems (2)
PATCH 1/4 drm/amdgpu: fix object unreserved issue
bo_do_create will unreserve in in the end if @resv is NULL, which cause the following bo_create_shadow run without lock held on @resv
--- drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +6 -3
@@ -507,9 +507,12 @@ int amdgpu_bo_create(struct amdgpu_device *adev,return r;if ((flags &AMDGPU_GEM_CREATE_SHADOW ) &&amdgpu_need_backup (adev)) { -if (!resv) -WARN_ON (reservation_object_lock ((*bo_ptr)->tbo.resv, -NULL )); +if (!resv) { +WARN_ON (reservation_object_lock ((*bo_ptr)->tbo.resv,NULL )); + r =amdgpu_bo_reserve (*bo_ptr, kernel?true:false); +if (unlikely (r)) +return r; + } r =amdgpu_bo_create_shadow (adev, size, byte_align, (*bo_ptr));
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 1520222976-18814-1-git-send-email-Monk.Liu-5C7GfCeVMHo@public.gmane.org
PATCH 2/4 drm/amdgpu: remove useless variable
--- drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c +1 -1
@@ -141,7 +141,7 @@ uint32_t amdgpu_virt_kiq_rreg(struct amdgpu_device *adev, uint32_t reg) {signed long r, cnt =0 ;unsigned long flags; -uint32_t val, seq; +uint32_t seq;struct amdgpu_kiq *kiq = &adev->gfx.kiq;struct amdgpu_ring *ring = &kiq->ring;
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 1520222976-18814-2-git-send-email-Monk.Liu-5C7GfCeVMHo@public.gmane.org
Re: [PATCH 2/4] drm/amdgpu: remove useless variable
Quoted 2 lines · Monk Liu
Change-Id Iec96c7762d791164c719ec64ec410e00a8cf5d90Signed-off-by Monk Liu <[email protected]>
Already fixed in amd-staging-drm-next.
Alex
Quoted 20 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c +1
-2@@ -141,7 +141,7 @@ uint32_t amdgpu_virt_kiq_rreg(struct amdgpu_device *adev, uint32_t reg) {signed long r, cnt =0 ;unsigned long flags; -uint32_t val, seq; +uint32_t seq;struct amdgpu_kiq *kiq = &adev->gfx.kiq;struct amdgpu_ring *ring = &kiq->ring; --2.7.4
Quoted 4 lines
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Quoted 15 lines · Monk Liu
bo_do_createwill unreserve in in the end if @resv is NULL, which cause the followingbo_create_shadowrun without lock held on @resvChange-Id Iaad24b8aea60522f25188874ab9d5c5f13f1a941Signed-off-by Monk Liu <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +0
-0
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c int amdgpu_bo_create(struct amdgpu_device *adev, · line 511
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +2
-3@@ -507,9 +507,12 @@ int amdgpu_bo_create(struct amdgpu_device *adev,return r;if ((flags &AMDGPU_GEM_CREATE_SHADOW ) &&amdgpu_need_backup (adev)) { -if (!resv) -WARN_ON (reservation_object_lock ((*bo_ptr)->tbo.resv, -NULL )); +if (!resv) { +WARN_ON (reservation_object_lock ((*bo_ptr)->tbo.resv,NULL ));
isn't this locking resv?
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c int amdgpu_bo_create(struct amdgpu_device *adev, · line 512
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +1
-0+ r =amdgpu_bo_reserve (*bo_ptr, kernel?true:false);
I don't think this is need.
Regards,
David Zhou
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c int amdgpu_bo_create(struct amdgpu_device *adev, · line 518
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +3
-0+if (unlikely (r)) +return r; + } r =amdgpu_bo_create_shadow (adev, size, byte_align, (*bo_ptr));
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 8b077a9e-da17-39b4-8368-c98ee805f8f2-5C7GfCeVMHo@public.gmane.org
Please check amdgpu_do_bo_create() logic,
-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of zhoucm1
Sent: 2018年3月5日 12:52
To: Liu, Monk <[email protected]>; [email protected]
Subject: Re: [PATCH 1/4] drm/amdgpu: fix object unreserved issue
Quoted 15 lines · Monk Liu
bo_do_createwill unreserve in in the end if @resv is NULL, which cause the followingbo_create_shadowrun without lock held on @resvChange-Id Iaad24b8aea60522f25188874ab9d5c5f13f1a941Signed-off-by Monk Liu <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +0
-0
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c int amdgpu_bo_create(struct amdgpu_device *adev, · line 511
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +2
-3@@ -507,9 +507,12 @@ int amdgpu_bo_create(struct amdgpu_device *adev,return r;if ((flags &AMDGPU_GEM_CREATE_SHADOW ) &&amdgpu_need_backup (adev)) { -if (!resv) -WARN_ON (reservation_object_lock ((*bo_ptr)->tbo.resv, -NULL )); +if (!resv) { +WARN_ON (reservation_object_lock ((*bo_ptr)->tbo.resv,NULL ));
isn't this locking resv?
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c int amdgpu_bo_create(struct amdgpu_device *adev, · line 512
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +1
-0+ r =amdgpu_bo_reserve (*bo_ptr, kernel?true:false);
I don't think this is need.
Regards,
David Zhou
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c int amdgpu_bo_create(struct amdgpu_device *adev, · line 518
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +3
-0+if (unlikely (r)) +return r; + } r =amdgpu_bo_create_shadow (adev, size, byte_align, (*bo_ptr));
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): BLUPR12MB044981CF01DA7983A3308ECB84DA0-7LeqcoF/[email protected]
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c int amdgpu_bo_create(struct amdgpu_device *adev, · line 511
Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +2
-0+if (!resv) { +WARN_ON (reservation_object_lock ((*bo_ptr)->tbo.resv,NULL ));
isn't this locking resv?
[ML] oh yeah, this patch is not needed in staging, my branch is a little different, missed that part, thanks
/Monk
-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Liu, Monk
Sent: 2018年3月5日 13:53
To: Zhou, David(ChunMing) <[email protected]>; [email protected]
Subject: RE: [PATCH 1/4] drm/amdgpu: fix object unreserved issue
Please check amdgpu_do_bo_create() logic,
-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of zhoucm1
Sent: 2018年3月5日 12:52
To: Liu, Monk <[email protected]>; [email protected]
Subject: Re: [PATCH 1/4] drm/amdgpu: fix object unreserved issue
Quoted 15 lines · Monk Liu
bo_do_createwill unreserve in in the end if @resv is NULL, which cause the followingbo_create_shadowrun without lock held on @resvChange-Id Iaad24b8aea60522f25188874ab9d5c5f13f1a941Signed-off-by Monk Liu <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +0
-0
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c int amdgpu_bo_create(struct amdgpu_device *adev, · line 511
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +2
-3@@ -507,9 +507,12 @@ int amdgpu_bo_create(struct amdgpu_device *adev,return r;if ((flags &AMDGPU_GEM_CREATE_SHADOW ) &&amdgpu_need_backup (adev)) { -if (!resv) -WARN_ON (reservation_object_lock ((*bo_ptr)->tbo.resv, -NULL )); +if (!resv) { +WARN_ON (reservation_object_lock ((*bo_ptr)->tbo.resv,NULL ));
isn't this locking resv?
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c int amdgpu_bo_create(struct amdgpu_device *adev, · line 512
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +1
-0+ r =amdgpu_bo_reserve (*bo_ptr, kernel?true:false);
I don't think this is need.
Regards,
David Zhou
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c int amdgpu_bo_create(struct amdgpu_device *adev, · line 518
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +3
-0+if (unlikely (r)) +return r; + } r =amdgpu_bo_create_shadow (adev, size, byte_align, (*bo_ptr));
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx