* [PATCH] drm/amdgpu:fix race condition
@ 2017-04-10 7:18 Monk Liu
[not found] ` <1491808681-25687-1-git-send-email-Monk.Liu-5C7GfCeVMHo@public.gmane.org>
0 siblings, 1 reply; 10+ messages in thread
From: Monk Liu @ 2017-04-10 7:18 UTC (permalink / raw)
To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW; +Cc: Monk Liu
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: Ib7a03f3cf5594deeb4ad333cc59b47a6bddfd1ad
Signed-off-by: Monk Liu <Monk.Liu@amd.com>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
index 6d86eae..71d5f25 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
@@ -277,6 +277,13 @@ struct fence *amdgpu_ctx_get_fence(struct amdgpu_ctx *ctx,
spin_lock(&ctx->ring_lock);
+ if (seq == ~0) {
+ seq = ctx->rings[ring->idx].sequence - 1;
+ } else if(seq == 0) {
+ spin_unlock(&ctx->ring_lock);
+ return NULL;
+ }
+
if (seq >= cring->sequence) {
spin_unlock(&ctx->ring_lock);
return ERR_PTR(-EINVAL);
--
2.7.4
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH] drm/amdgpu:fix race condition
[not found] ` <1491808681-25687-1-git-send-email-Monk.Liu-5C7GfCeVMHo@public.gmane.org>
@ 2017-04-10 7:21 ` Christian König
[not found] ` <82d5bbc6-5c2c-9707-fbed-d58ab34ab204-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
0 siblings, 1 reply; 10+ messages in thread
From: Christian König @ 2017-04-10 7:21 UTC (permalink / raw)
To: Monk Liu, amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
Am 10.04.2017 um 09:18 schrieb Monk Liu:
> 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: Ib7a03f3cf5594deeb4ad333cc59b47a6bddfd1ad
> Signed-off-by: Monk Liu <Monk.Liu@amd.com>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
> index 6d86eae..71d5f25 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
> @@ -277,6 +277,13 @@ struct fence *amdgpu_ctx_get_fence(struct amdgpu_ctx *ctx,
>
> spin_lock(&ctx->ring_lock);
>
> + if (seq == ~0) {
That must be ~0ull, otherwise you would be checking a 32bit value here.
Additional to that please define something in amdgpu_drm.h for that value.
> + seq = ctx->rings[ring->idx].sequence - 1;
> + } else if(seq == 0) {
> + spin_unlock(&ctx->ring_lock);
> + return NULL;
> + }
> +
That is unnecessary the "if (seq + amdgpu_sched_jobs < cring->sequence)
{" will catch this case.
Regards,
Christian.
> if (seq >= cring->sequence) {
> spin_unlock(&ctx->ring_lock);
> return ERR_PTR(-EINVAL);
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
^ permalink raw reply [flat|nested] 10+ messages in thread
* 答复: [PATCH] drm/amdgpu:fix race condition
[not found] ` <82d5bbc6-5c2c-9707-fbed-d58ab34ab204-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
@ 2017-04-10 7:23 ` Liu, Monk
2017-04-10 7:26 ` Liu, Monk
1 sibling, 0 replies; 10+ messages in thread
From: Liu, Monk @ 2017-04-10 7:23 UTC (permalink / raw)
To: Christian König, amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
Oh yeah~~ thanks
-----邮件原件-----
发件人: Christian König [mailto:deathsimple@vodafone.de]
发送时间: Monday, April 10, 2017 3:22 PM
收件人: Liu, Monk <Monk.Liu@amd.com>; amd-gfx@lists.freedesktop.org
主题: Re: [PATCH] drm/amdgpu:fix race condition
Am 10.04.2017 um 09:18 schrieb Monk Liu:
> 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: Ib7a03f3cf5594deeb4ad333cc59b47a6bddfd1ad
> Signed-off-by: Monk Liu <Monk.Liu@amd.com>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
> index 6d86eae..71d5f25 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
> @@ -277,6 +277,13 @@ struct fence *amdgpu_ctx_get_fence(struct
> amdgpu_ctx *ctx,
>
> spin_lock(&ctx->ring_lock);
>
> + if (seq == ~0) {
That must be ~0ull, otherwise you would be checking a 32bit value here.
Additional to that please define something in amdgpu_drm.h for that value.
> + seq = ctx->rings[ring->idx].sequence - 1;
> + } else if(seq == 0) {
> + spin_unlock(&ctx->ring_lock);
> + return NULL;
> + }
> +
That is unnecessary the "if (seq + amdgpu_sched_jobs < cring->sequence) {" will catch this case.
Regards,
Christian.
> if (seq >= cring->sequence) {
> spin_unlock(&ctx->ring_lock);
> return ERR_PTR(-EINVAL);
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
^ permalink raw reply [flat|nested] 10+ messages in thread
* 答复: [PATCH] drm/amdgpu:fix race condition
[not found] ` <82d5bbc6-5c2c-9707-fbed-d58ab34ab204-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
2017-04-10 7:23 ` 答复: " Liu, Monk
@ 2017-04-10 7:26 ` Liu, Monk
[not found] ` <DM5PR12MB16105F2589A1C93C223E94E884010-2J9CzHegvk++jCVTvoAFKAdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
1 sibling, 1 reply; 10+ messages in thread
From: Liu, Monk @ 2017-04-10 7:26 UTC (permalink / raw)
To: Christian König, amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
>That is unnecessary the "if (seq + amdgpu_sched_jobs < cring->sequence) {" will catch this case.
But what if user land pass in seq 0 on purpose , but the latest cring->sequence value is only 3 ?
Without this "if (seq == 0)" the logic seems goes to a wrong direction
BR Monk
-----邮件原件-----
发件人: Christian König [mailto:deathsimple@vodafone.de]
发送时间: Monday, April 10, 2017 3:22 PM
收件人: Liu, Monk <Monk.Liu@amd.com>; amd-gfx@lists.freedesktop.org
主题: Re: [PATCH] drm/amdgpu:fix race condition
Am 10.04.2017 um 09:18 schrieb Monk Liu:
> 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: Ib7a03f3cf5594deeb4ad333cc59b47a6bddfd1ad
> Signed-off-by: Monk Liu <Monk.Liu@amd.com>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
> index 6d86eae..71d5f25 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
> @@ -277,6 +277,13 @@ struct fence *amdgpu_ctx_get_fence(struct
> amdgpu_ctx *ctx,
>
> spin_lock(&ctx->ring_lock);
>
> + if (seq == ~0) {
That must be ~0ull, otherwise you would be checking a 32bit value here.
Additional to that please define something in amdgpu_drm.h for that value.
> + seq = ctx->rings[ring->idx].sequence - 1;
> + } else if(seq == 0) {
> + spin_unlock(&ctx->ring_lock);
> + return NULL;
> + }
> +
That is unnecessary the "if (seq + amdgpu_sched_jobs < cring->sequence) {" will catch this case.
Regards,
Christian.
> if (seq >= cring->sequence) {
> spin_unlock(&ctx->ring_lock);
> return ERR_PTR(-EINVAL);
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: 答复: [PATCH] drm/amdgpu:fix race condition
[not found] ` <DM5PR12MB16105F2589A1C93C223E94E884010-2J9CzHegvk++jCVTvoAFKAdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
@ 2017-04-10 7:29 ` Christian König
0 siblings, 0 replies; 10+ messages in thread
From: Christian König @ 2017-04-10 7:29 UTC (permalink / raw)
To: Liu, Monk, amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
Am 10.04.2017 um 09:26 schrieb Liu, Monk:
>> That is unnecessary the "if (seq + amdgpu_sched_jobs < cring->sequence) {" will catch this case.
> But what if user land pass in seq 0 on purpose , but the latest cring->sequence value is only 3 ?
> Without this "if (seq == 0)" the logic seems goes to a wrong direction
If cring->sequence is only 3 cring->fences[0] will be NULL, so we will
just return NULL anyway (We might want to add a comment explaining that).
Christian.
>
> BR Monk
>
> -----邮件原件-----
> 发件人: Christian König [mailto:deathsimple@vodafone.de]
> 发送时间: Monday, April 10, 2017 3:22 PM
> 收件人: Liu, Monk <Monk.Liu@amd.com>; amd-gfx@lists.freedesktop.org
> 主题: Re: [PATCH] drm/amdgpu:fix race condition
>
> Am 10.04.2017 um 09:18 schrieb Monk Liu:
>> 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: Ib7a03f3cf5594deeb4ad333cc59b47a6bddfd1ad
>> Signed-off-by: Monk Liu <Monk.Liu@amd.com>
>> ---
>> drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c | 7 +++++++
>> 1 file changed, 7 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
>> index 6d86eae..71d5f25 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
>> @@ -277,6 +277,13 @@ struct fence *amdgpu_ctx_get_fence(struct
>> amdgpu_ctx *ctx,
>>
>> spin_lock(&ctx->ring_lock);
>>
>> + if (seq == ~0) {
> That must be ~0ull, otherwise you would be checking a 32bit value here.
>
> Additional to that please define something in amdgpu_drm.h for that value.
>
>> + seq = ctx->rings[ring->idx].sequence - 1;
>> + } else if(seq == 0) {
>> + spin_unlock(&ctx->ring_lock);
>> + return NULL;
>> + }
>> +
> That is unnecessary the "if (seq + amdgpu_sched_jobs < cring->sequence) {" will catch this case.
>
> Regards,
> Christian.
>
>> if (seq >= cring->sequence) {
>> spin_unlock(&ctx->ring_lock);
>> return ERR_PTR(-EINVAL);
>
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] drm/amdgpu:fix race condition
[not found] ` <1491819882-19868-1-git-send-email-Monk.Liu-5C7GfCeVMHo@public.gmane.org>
2017-04-10 10:49 ` Christian König
@ 2017-04-11 1:50 ` Michel Dänzer
1 sibling, 0 replies; 10+ messages in thread
From: Michel Dänzer @ 2017-04-11 1:50 UTC (permalink / raw)
To: Monk Liu; +Cc: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
On 10/04/17 07:24 PM, Monk Liu wrote:
>
> struct drm_amdgpu_wait_cs_in {
> - /** Command submission handle */
> + /* Command submission handle
Any particular reason for dropping the /** comment opening?
> + * 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).
> + * handle equal ~0ull meanas wait for the latest sequence number
> + */
Typo: "meanas" (vi(m) accident? :)
--
Earthling Michel Dänzer | http://www.amd.com
Libre software enthusiast | Mesa and X developer
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] drm/amdgpu:fix race condition
[not found] ` <1491819882-19868-1-git-send-email-Monk.Liu-5C7GfCeVMHo@public.gmane.org>
@ 2017-04-10 10:49 ` Christian König
2017-04-11 1:50 ` Michel Dänzer
1 sibling, 0 replies; 10+ messages in thread
From: Christian König @ 2017-04-10 10:49 UTC (permalink / raw)
To: Monk Liu, amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
Am 10.04.2017 um 12:24 schrieb Monk Liu:
> 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: Ib7a03f3cf5594deeb4ad333cc59b47a6bddfd1ad
> Signed-off-by: Monk Liu <Monk.Liu@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c | 3 +++
> include/uapi/drm/amdgpu_drm.h | 5 ++++-
> 2 files changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
> index 6d86eae..b4bbbb3 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
> @@ -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);
> diff --git a/include/uapi/drm/amdgpu_drm.h b/include/uapi/drm/amdgpu_drm.h
> index 34e5f93..3243409 100644
> --- a/include/uapi/drm/amdgpu_drm.h
> +++ b/include/uapi/drm/amdgpu_drm.h
> @@ -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;
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH] drm/amdgpu:fix race condition
@ 2017-04-10 10:24 Monk Liu
[not found] ` <1491819882-19868-1-git-send-email-Monk.Liu-5C7GfCeVMHo@public.gmane.org>
0 siblings, 1 reply; 10+ messages in thread
From: Monk Liu @ 2017-04-10 10:24 UTC (permalink / raw)
To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW; +Cc: Monk Liu
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: Ib7a03f3cf5594deeb4ad333cc59b47a6bddfd1ad
Signed-off-by: Monk Liu <Monk.Liu@amd.com>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c | 3 +++
include/uapi/drm/amdgpu_drm.h | 5 ++++-
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
index 6d86eae..b4bbbb3 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
@@ -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);
diff --git a/include/uapi/drm/amdgpu_drm.h b/include/uapi/drm/amdgpu_drm.h
index 34e5f93..3243409 100644
--- a/include/uapi/drm/amdgpu_drm.h
+++ b/include/uapi/drm/amdgpu_drm.h
@@ -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;
--
2.7.4
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH] drm/amdgpu:fix race condition
[not found] ` <1491809988-26981-1-git-send-email-Monk.Liu-5C7GfCeVMHo@public.gmane.org>
@ 2017-04-10 8:09 ` Christian König
0 siblings, 0 replies; 10+ messages in thread
From: Christian König @ 2017-04-10 8:09 UTC (permalink / raw)
To: Monk Liu, amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
Am 10.04.2017 um 09:39 schrieb Monk Liu:
> 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.
Well you are still not using ~0ull as I said. Using ~0 here will cause
0xffffffff to be used instead of 0xffffffffffffffff.
Additional to that please add a define into amdgpu_drm.h to document
this interface change.
Christian.
>
> Change-Id: Ib7a03f3cf5594deeb4ad333cc59b47a6bddfd1ad
> Signed-off-by: Monk Liu <Monk.Liu@amd.com>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
> index 6d86eae..c24bb90 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
> @@ -277,6 +277,9 @@ struct fence *amdgpu_ctx_get_fence(struct amdgpu_ctx *ctx,
>
> spin_lock(&ctx->ring_lock);
>
> + if (seq == ~0)
> + seq = ctx->rings[ring->idx].sequence - 1;
> +
> if (seq >= cring->sequence) {
> spin_unlock(&ctx->ring_lock);
> return ERR_PTR(-EINVAL);
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH] drm/amdgpu:fix race condition
@ 2017-04-10 7:39 Monk Liu
[not found] ` <1491809988-26981-1-git-send-email-Monk.Liu-5C7GfCeVMHo@public.gmane.org>
0 siblings, 1 reply; 10+ messages in thread
From: Monk Liu @ 2017-04-10 7:39 UTC (permalink / raw)
To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW; +Cc: Monk Liu
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: Ib7a03f3cf5594deeb4ad333cc59b47a6bddfd1ad
Signed-off-by: Monk Liu <Monk.Liu@amd.com>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
index 6d86eae..c24bb90 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
@@ -277,6 +277,9 @@ struct fence *amdgpu_ctx_get_fence(struct amdgpu_ctx *ctx,
spin_lock(&ctx->ring_lock);
+ if (seq == ~0)
+ seq = ctx->rings[ring->idx].sequence - 1;
+
if (seq >= cring->sequence) {
spin_unlock(&ctx->ring_lock);
return ERR_PTR(-EINVAL);
--
2.7.4
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
^ permalink raw reply related [flat|nested] 10+ messages in thread
end of thread, other threads:[~2017-04-11 1:50 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-10 7:18 [PATCH] drm/amdgpu:fix race condition Monk Liu
[not found] ` <1491808681-25687-1-git-send-email-Monk.Liu-5C7GfCeVMHo@public.gmane.org>
2017-04-10 7:21 ` Christian König
[not found] ` <82d5bbc6-5c2c-9707-fbed-d58ab34ab204-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
2017-04-10 7:23 ` 答复: " Liu, Monk
2017-04-10 7:26 ` Liu, Monk
[not found] ` <DM5PR12MB16105F2589A1C93C223E94E884010-2J9CzHegvk++jCVTvoAFKAdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2017-04-10 7:29 ` Christian König
2017-04-10 7:39 Monk Liu
[not found] ` <1491809988-26981-1-git-send-email-Monk.Liu-5C7GfCeVMHo@public.gmane.org>
2017-04-10 8:09 ` Christian König
2017-04-10 10:24 Monk Liu
[not found] ` <1491819882-19868-1-git-send-email-Monk.Liu-5C7GfCeVMHo@public.gmane.org>
2017-04-10 10:49 ` Christian König
2017-04-11 1:50 ` Michel Dänzer
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.