drm/amdgpu:fix race condition
Subsystems (3)
PATCH 1/1 drm/amdgpu:fix race condition
sequence is protected by spinlock so don't access sequence in paramter seq when invoking this function.
~0 means to get the latest sequence number and 0 means none to get.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c | 3 +++ include/uapi/drm/amdgpu_drm.h | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c +3 -0
@@ -277,6 +277,9 @@ struct fence *amdgpu_ctx_get_fence(struct amdgpu_ctx *ctx,spin_lock (&ctx->ring_lock); +if (seq == ~0ull ) + seq = ctx->rings[ring->idx].sequence -1 ; +if (seq >= cring->sequence) {spin_unlock (&ctx->ring_lock);return ERR_PTR (-EINVAL );
include/uapi/drm/amdgpu_drm.h +4 -1
@@ -297,7 +297,10 @@ union drm_amdgpu_gem_wait_idle { };struct drm_amdgpu_wait_cs_in { -/** Command submission handle */ +/* Command submission handle +* handle equals 0 means none to wait for +* handle equal ~0ull meanas wait for the latest sequence number +*/ __u64 handle;/** Absolute timeout to wait */ __u64 timeout;
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): 1491819882-19868-1-git-send-email-Monk.Liu-5C7GfCeVMHo@public.gmane.org
Christian König
Reviewed-byAm 10.04.2017 um 12:24 schrieb Monk Liu:
Quoted 8 lines
sequence is protected by spinlock so don't access sequence in paramter seq when invoking this function.
~0 means to get the latest sequence number and 0 means none to get.
Change-Id Ib7a03f3cf5594deeb4ad333cc59b47a6bddfd1adSigned-off-by Monk Liu <[email protected]>
Quoted 25 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c | 3 +++ include/uapi/drm/amdgpu_drm.h | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c +3
-0@@ -277,6 +277,9 @@ struct fence *amdgpu_ctx_get_fence(struct amdgpu_ctx *ctx,spin_lock (&ctx->ring_lock); +if (seq == ~0ull ) + seq = ctx->rings[ring->idx].sequence -1 ; +if (seq >= cring->sequence) {spin_unlock (&ctx->ring_lock);return ERR_PTR (-EINVAL );include/uapi/drm/amdgpu_drm.h +0
-0@@ -297,7 +297,10 @@ union drm_amdgpu_gem_wait_idle { };
include/uapi/drm/amdgpu_drm.h union drm_amdgpu_gem_wait_idle { · line 306
Quoted 10 lines
include/uapi/drm/amdgpu_drm.h +4
-1struct drm_amdgpu_wait_cs_in { -/** Command submission handle */ +/* Command submission handle +* handle equals 0 means none to wait for +* handle equal ~0ull meanas wait for the latest sequence number +*/ __u64 handle;/** Absolute timeout to wait */ __u64 timeout;
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
include/uapi/drm/amdgpu_drm.h union drm_amdgpu_gem_wait_idle { · line 300
Quoted 4 lines · Monk Liu
struct
drm_amdgpu_wait_cs_in{include/uapi/drm/amdgpu_drm.h +1
-1-/** Command submission handle */ +/* Command submission handle
Any particular reason for dropping the /** comment opening?
Quoted 1 line
+ * handle equals 0 means none to wait for
This line and the following lines are indented incorrectly (9 spaces, should be 1 tab + 1 space).
include/uapi/drm/amdgpu_drm.h union drm_amdgpu_gem_wait_idle { · line 303
Quoted 2 lines
include/uapi/drm/amdgpu_drm.h +2
-0+* handle equal ~0ull meanas wait for the latest sequence number +*/
Typo: "meanas" (vi(m) accident? :)
Signature · 6 lines
Earthling Michel Dänzer | http://www.amd.com Libre software enthusiast | Mesa and X developer _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx