* [PATCH] drm/xe/ufence: ufence can be signaled right after wait_woken
@ 2024-10-11 13:25 Nirmoy Das
2024-10-11 14:10 ` Nirmoy Das
0 siblings, 1 reply; 4+ messages in thread
From: Nirmoy Das @ 2024-10-11 13:25 UTC (permalink / raw)
To: intel-xe
Cc: Nirmoy Das, stable, Bommu Krishnaiah, Matthew Auld, Matthew Brost
do_comapre() can return success after wait_woken() which is treated as
-ETIME here.
Fixes: e670f0b4ef24 ("drm/xe/uapi: Return correct error code for xe_wait_user_fence_ioctl")
Cc: <stable@vger.kernel.org> # v6.8+
Cc: Bommu Krishnaiah <krishnaiah.bommu@intel.com>
Link: https://gitlab.freedesktop.org/drm/xe/kernel/-/issues/1630
Cc: Matthew Auld <matthew.auld@intel.com>
Cc: Matthew Brost <matthew.brost@intel.com>
Signed-off-by: Nirmoy Das <nirmoy.das@intel.com>
---
drivers/gpu/drm/xe/xe_wait_user_fence.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/xe/xe_wait_user_fence.c b/drivers/gpu/drm/xe/xe_wait_user_fence.c
index d46fa8374980..d532283d4aa3 100644
--- a/drivers/gpu/drm/xe/xe_wait_user_fence.c
+++ b/drivers/gpu/drm/xe/xe_wait_user_fence.c
@@ -169,7 +169,7 @@ int xe_wait_user_fence_ioctl(struct drm_device *dev, void *data,
args->timeout = 0;
}
- if (!timeout && !(err < 0))
+ if (!timeout && err < 0)
err = -ETIME;
if (q)
--
2.46.0
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH] drm/xe/ufence: ufence can be signaled right after wait_woken
2024-10-11 13:25 [PATCH] drm/xe/ufence: ufence can be signaled right after wait_woken Nirmoy Das
@ 2024-10-11 14:10 ` Nirmoy Das
2024-10-11 15:16 ` Matthew Auld
0 siblings, 1 reply; 4+ messages in thread
From: Nirmoy Das @ 2024-10-11 14:10 UTC (permalink / raw)
To: intel-xe; +Cc: stable, Bommu Krishnaiah, Matthew Auld, Matthew Brost
On 10/11/2024 3:25 PM, Nirmoy Das wrote:
> do_comapre() can return success after wait_woken() which is treated as
> -ETIME here.
s/after wait_woken()/after timedout wait_woken()
I will resend with that change.
>
> Fixes: e670f0b4ef24 ("drm/xe/uapi: Return correct error code for xe_wait_user_fence_ioctl")
> Cc: <stable@vger.kernel.org> # v6.8+
> Cc: Bommu Krishnaiah <krishnaiah.bommu@intel.com>
> Link: https://gitlab.freedesktop.org/drm/xe/kernel/-/issues/1630
> Cc: Matthew Auld <matthew.auld@intel.com>
> Cc: Matthew Brost <matthew.brost@intel.com>
> Signed-off-by: Nirmoy Das <nirmoy.das@intel.com>
> ---
> drivers/gpu/drm/xe/xe_wait_user_fence.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/xe/xe_wait_user_fence.c b/drivers/gpu/drm/xe/xe_wait_user_fence.c
> index d46fa8374980..d532283d4aa3 100644
> --- a/drivers/gpu/drm/xe/xe_wait_user_fence.c
> +++ b/drivers/gpu/drm/xe/xe_wait_user_fence.c
> @@ -169,7 +169,7 @@ int xe_wait_user_fence_ioctl(struct drm_device *dev, void *data,
> args->timeout = 0;
> }
>
> - if (!timeout && !(err < 0))
> + if (!timeout && err < 0)
> err = -ETIME;
>
> if (q)
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] drm/xe/ufence: ufence can be signaled right after wait_woken
2024-10-11 14:10 ` Nirmoy Das
@ 2024-10-11 15:16 ` Matthew Auld
2024-10-11 15:44 ` Nirmoy Das
0 siblings, 1 reply; 4+ messages in thread
From: Matthew Auld @ 2024-10-11 15:16 UTC (permalink / raw)
To: Nirmoy Das, intel-xe; +Cc: stable, Bommu Krishnaiah, Matthew Brost
On 11/10/2024 15:10, Nirmoy Das wrote:
>
> On 10/11/2024 3:25 PM, Nirmoy Das wrote:
>> do_comapre() can return success after wait_woken() which is treated as
>> -ETIME here.
>
> s/after wait_woken()/after timedout wait_woken()
>
> I will resend with that change.
>
>>
>> Fixes: e670f0b4ef24 ("drm/xe/uapi: Return correct error code for xe_wait_user_fence_ioctl")
>> Cc: <stable@vger.kernel.org> # v6.8+
>> Cc: Bommu Krishnaiah <krishnaiah.bommu@intel.com>
>> Link: https://gitlab.freedesktop.org/drm/xe/kernel/-/issues/1630
>> Cc: Matthew Auld <matthew.auld@intel.com>
>> Cc: Matthew Brost <matthew.brost@intel.com>
>> Signed-off-by: Nirmoy Das <nirmoy.das@intel.com>
>> ---
>> drivers/gpu/drm/xe/xe_wait_user_fence.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/xe/xe_wait_user_fence.c b/drivers/gpu/drm/xe/xe_wait_user_fence.c
>> index d46fa8374980..d532283d4aa3 100644
>> --- a/drivers/gpu/drm/xe/xe_wait_user_fence.c
>> +++ b/drivers/gpu/drm/xe/xe_wait_user_fence.c
>> @@ -169,7 +169,7 @@ int xe_wait_user_fence_ioctl(struct drm_device *dev, void *data,
>> args->timeout = 0;
>> }
>>
>> - if (!timeout && !(err < 0))
Since err > 0 is impossible, this could be written as: && err == 0.
So I think this is saying: if we have timedout and err does not already
have an error set then go ahead and set to -ETIME since we hit the
timeout. But it might have -EIO or -ERESTARTSYS for example, which
should then take precedence over -ETIME...
>> + if (!timeout && err < 0)
...this would then trample the existing err. The err can either be zero
or an existing error at this point, so I think just remove this entire
check:
- if (!timeout && !(err < 0))
- err = -ETIME;
-
?
>> err = -ETIME;
>>
>> if (q)
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] drm/xe/ufence: ufence can be signaled right after wait_woken
2024-10-11 15:16 ` Matthew Auld
@ 2024-10-11 15:44 ` Nirmoy Das
0 siblings, 0 replies; 4+ messages in thread
From: Nirmoy Das @ 2024-10-11 15:44 UTC (permalink / raw)
To: Matthew Auld, intel-xe; +Cc: stable, Bommu Krishnaiah, Matthew Brost
On 10/11/2024 5:16 PM, Matthew Auld wrote:
> On 11/10/2024 15:10, Nirmoy Das wrote:
>>
>> On 10/11/2024 3:25 PM, Nirmoy Das wrote:
>>> do_comapre() can return success after wait_woken() which is treated as
>>> -ETIME here.
>>
>> s/after wait_woken()/after timedout wait_woken()
>>
>> I will resend with that change.
>>
>>>
>>> Fixes: e670f0b4ef24 ("drm/xe/uapi: Return correct error code for xe_wait_user_fence_ioctl")
>>> Cc: <stable@vger.kernel.org> # v6.8+
>>> Cc: Bommu Krishnaiah <krishnaiah.bommu@intel.com>
>>> Link: https://gitlab.freedesktop.org/drm/xe/kernel/-/issues/1630
>>> Cc: Matthew Auld <matthew.auld@intel.com>
>>> Cc: Matthew Brost <matthew.brost@intel.com>
>>> Signed-off-by: Nirmoy Das <nirmoy.das@intel.com>
>>> ---
>>> drivers/gpu/drm/xe/xe_wait_user_fence.c | 2 +-
>>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/gpu/drm/xe/xe_wait_user_fence.c b/drivers/gpu/drm/xe/xe_wait_user_fence.c
>>> index d46fa8374980..d532283d4aa3 100644
>>> --- a/drivers/gpu/drm/xe/xe_wait_user_fence.c
>>> +++ b/drivers/gpu/drm/xe/xe_wait_user_fence.c
>>> @@ -169,7 +169,7 @@ int xe_wait_user_fence_ioctl(struct drm_device *dev, void *data,
>>> args->timeout = 0;
>>> }
>>> - if (!timeout && !(err < 0))
>
> Since err > 0 is impossible, this could be written as: && err == 0.
>
> So I think this is saying: if we have timedout and err does not already have an error set then go ahead and set to -ETIME since we hit the timeout.
This is the issue here. This assumption is wrong that if timeout happen then return -ETIME even though the fence is signaled.
> But it might have -EIO or -ERESTARTSYS for example, which should then take precedence over -ETIME...
>
>>> + if (!timeout && err < 0)
>
> ...this would then trample the existing err. The err can either be zero or an existing error at this point, so I think just remove this entire check:
>
> - if (!timeout && !(err < 0))
> - err = -ETIME;
> -
>
> ?
Yes, this works for me. The for loops sets err correctly even when there is real timeout on not-signaled fence.
I will resend a v2.
Regards,
Nirmoy
>
>>> err = -ETIME;
>>> if (q)
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-10-11 15:44 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-11 13:25 [PATCH] drm/xe/ufence: ufence can be signaled right after wait_woken Nirmoy Das
2024-10-11 14:10 ` Nirmoy Das
2024-10-11 15:16 ` Matthew Auld
2024-10-11 15:44 ` Nirmoy Das
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox