[PATCH] drm/xe/ufence: Wake up waiters after setting ufence->signalled
Nirmoy Das
nirmoy.das at intel.com
Thu Nov 14 16:22:56 UTC 2024
On 11/14/2024 5:17 PM, Matthew Brost wrote:
> On Thu, Nov 14, 2024 at 04:05:37PM +0100, Nirmoy Das wrote:
>> If a previous ufence is not signalled, vm_bind will return -EBUSY.
>> Delaying the modification of ufence->signalled can cause issues if the
>> UMD reuses the same ufence so update ufence->signalled before waking up
>> waiters.
>>
>> Cc: Matthew Brost <matthew.brost at intel.com>
>> Link: https://gitlab.freedesktop.org/drm/xe/kernel/-/issues/3233
> Do we need a fixes tag?
Yes, it should have below:
Fixes: 977e5b82e090 ("drm/xe: Expose user fence from xe_sync_entry")
>
> Reviewed-by: Matthew Brost <matthew.brost at intel.com>
Thanks,
Nirmoy
>
>> Signed-off-by: Nirmoy Das <nirmoy.das at intel.com>
>> ---
>> drivers/gpu/drm/xe/xe_sync.c | 6 +++++-
>> 1 file changed, 5 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/xe/xe_sync.c b/drivers/gpu/drm/xe/xe_sync.c
>> index a90480c6aecf..42f5bebd09e5 100644
>> --- a/drivers/gpu/drm/xe/xe_sync.c
>> +++ b/drivers/gpu/drm/xe/xe_sync.c
>> @@ -87,8 +87,12 @@ static void user_fence_worker(struct work_struct *w)
>> drm_dbg(&ufence->xe->drm, "mmget_not_zero() failed, ufence wasn't signaled\n");
>> }
>>
>> - wake_up_all(&ufence->xe->ufence_wq);
>> + /*
>> + * Wake up waiters only after updating the ufence state, allowing the UMD
>> + * to safely reuse the same ufence without encountering -EBUSY errors.
>> + */
>> WRITE_ONCE(ufence->signalled, 1);
>> + wake_up_all(&ufence->xe->ufence_wq);
>> user_fence_put(ufence);
>> }
>>
>> --
>> 2.46.0
>>
More information about the Intel-xe
mailing list