Skip to contentSkip to conversation

drm/amdgpu/userq: remove queue from doorbell xarray

PATCH In review Sunil Khatri 2 participants 4 messages Mar 3 – Mar 5

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 drm/amdgpu/userq: remove queue from doorbell xarray

In case of failure in xa_alloc, remove the queue during clean up from the userq_doorbell_xa.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c +1 -0
index 001fcfcbde0f..5224871a099c 100644
@@ -865,6 +865,7 @@ amdgpu_userq_create(struct drm_file *filp, union drm_amdgpu_userq *args)
 	if (r) {
 		drm_file_err(uq_mgr->file, "Failed to allocate a queue id\n");
 		amdgpu_userq_fence_driver_free(queue);
+		xa_erase_irq(&adev->userq_doorbell_xa, index);
 		uq_funcs->mqd_destroy(queue);
 		kfree(queue);
 		r = -ENOMEM;
Signature · 1 line
2.34.1
#1 lore raw

PATCH 2/2 drm/amdgpu/userq: remove queue from doorbell xa during clean up

If function amdgpu_userq_map_helper fails we do need to clean up and remove the queue from the userq_doorbell_xa.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c +1 -0
index 5224871a099c..7d2f78899c47 100644
@@ -885,6 +885,7 @@ amdgpu_userq_create(struct drm_file *filp, union drm_amdgpu_userq *args)
 		r = amdgpu_userq_map_helper(queue);
 		if (r) {
 			drm_file_err(uq_mgr->file, "Failed to map Queue\n");
+			xa_erase_irq(&adev->userq_doorbell_xa, index);
 			xa_erase(&uq_mgr->userq_xa, qid);
 			amdgpu_userq_fence_driver_free(queue);
 			uq_funcs->mqd_destroy(queue);
Signature · 1 line
2.34.1
#2 lore raw
In reply to Sunil Khatri

[AMD Official Use Only - AMD Internal Distribution Only]

Ping

Get Outlook for iOS<https://aka.ms/o0ukef>
________________________________
From: Sunil Khatri <[email protected]>
Sent: Tuesday, March 3, 2026 10:41:10 PM
To: Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>
Cc: [email protected] <[email protected]>; Khatri, Sunil <[email protected]>
Subject: [PATCH v1 1/2] drm/amdgpu/userq: remove queue from doorbell xarray

In case of failure in xa_alloc, remove the queue during clean up from the userq_doorbell_xa.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c +1 -0
index 001fcfcbde0f..5224871a099c 100644
@@ -865,6 +865,7 @@ amdgpu_userq_create(struct drm_file *filp, union drm_amdgpu_userq *args)
         if (r) {
                 drm_file_err(uq_mgr->file, "Failed to allocate a queue id\n");
                 amdgpu_userq_fence_driver_free(queue);
+               xa_erase_irq(&adev->userq_doorbell_xa, index);
                 uq_funcs->mqd_destroy(queue);
                 kfree(queue);
                 r = -ENOMEM;

--
2.34.1

maintainer Reviewed-by
#3 lore raw
Quoted 36 lines · Sunil

[AMD Official Use Only - AMD Internal Distribution Only]

Ping

Get Outlook for iOS <https://aka.ms/o0ukef>
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
*From:* Sunil Khatri <[email protected]>
*Sent:* Tuesday, March 3, 2026 10:41:10 PM
*To:* Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]> *Cc:* [email protected] <[email protected]>; Khatri, Sunil <[email protected]> *Subject:* [PATCH v1 1/2] drm/amdgpu/userq: remove queue from doorbell xarray

In case of failure in xa_alloc, remove the queue during
clean up from the userq_doorbell_xa.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c | 1 +

 1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c +1 -0
index 001fcfcbde0f..5224871a099c 100644
@@ -865,6 +865,7 @@ amdgpu_userq_create(struct drm_file *filp, union drm_amdgpu_userq *args)
          if (r) {
                  drm_file_err(uq_mgr->file, "Failed to allocate a queue id\n");
                  amdgpu_userq_fence_driver_free(queue);
+               xa_erase_irq(&adev->userq_doorbell_xa, index);
                  uq_funcs->mqd_destroy(queue);
                  kfree(queue);
                  r = -ENOMEM;
Signature · 1 line
2.34.1