Hi Christian,
On 11/20/2024 4:06 PM, Christian König wrote:
Am 20.11.24 um 10:26 schrieb Arunpravin Paneer Selvam:
Fix the warning issue generated at lib/xarray.c:1849.
v2: keep the error handling same as before when the
xalloc() call fails to store the fence_drv ref.
Signed-off-by: Arunpravin Paneer Selvam
<Arunpravin.PaneerSelvam@xxxxxxx>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_userq_fence.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_userq_fence.c
b/drivers/gpu/drm/amd/amdgpu/amdgpu_userq_fence.c
index 76f7babd7a54..bfe7d1d139d1 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_userq_fence.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_userq_fence.c
@@ -842,8 +842,10 @@ int amdgpu_userq_wait_ioctl(struct drm_device
*dev, void *data,
* have any more space left and crash.
*/
if (fence_drv->fence_drv_xa_ptr) {
- r = xa_alloc(fence_drv->fence_drv_xa_ptr, &index,
fence_drv,
- xa_limit_32b, GFP_KERNEL);
+ xa_lock(fence_drv->fence_drv_xa_ptr);
+ r = __xa_alloc(fence_drv->fence_drv_xa_ptr, &index,
fence_drv,
+ xa_limit_32b, GFP_KERNEL);
+ xa_unlock(fence_drv->fence_drv_xa_ptr);
Why should that fix anything? That code looks identical, just with
explicit locking.
The flag XA_FLAGS_TRACK_FREE is cleared for unknown reason and a warning
is generated when we
run the libdrm fence synchronization test case continuously with just
xa_alloc function (this function has implicit locking).
The warnings are coming from lib/xarray.c, in __xa_alloc() function, we
have a WARN_ON_ONCE to check the
XA_FLAGS_TRACK_FREE flag enablement.
This particular warning is not triggered when we do a explicit locking,
this could be a bug in xa_alloc implementation?
Regards,
Christian.
if (r)
goto free_fences;