accel: Replace deprecated create_singlethread_workqueue
cover accel: Replace deprecated create_singlethread_workqueue
Hi maintainers,
This patch series replaces the deprecated create_singlethread_workqueue() with the more efficient alloc_ordered_workqueue() in the amdxdna and habanalabs accel drivers.
Both patches have been compile tested with W=1 and produce no warnings.
Best regards,
George
George Karagounis (2):
accel/amdxdna: Replace create_singlethread_workqueue with
alloc_ordered_workqueue
accel/habanalabs: Replace create_singlethread_workqueue with
alloc_ordered_workqueue
drivers/accel/amdxdna/amdxdna_mailbox.c | 2 +- drivers/accel/habanalabs/common/device.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-)
Signature · 1 line
2.55.0
PATCH 1/2 accel/amdxdna: Replace create_singlethread_workqueue with alloc_ordered_workqueue
create_singlethread_workqueue() is deprecated. Replace it with
alloc_ordered_workqueue() to use the shared system workqueue
infrastructure more efficiently.
WQ_MEM_RECLAIM is added to ensure the mailbox can process
interrupts under memory pressure.
--- drivers/accel/amdxdna/amdxdna_mailbox.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/accel/amdxdna/amdxdna_mailbox.c +1 -1
@@ -481,7 +481,7 @@ struct mailbox_channel *xdna_mailbox_alloc_channel(struct mailbox *mb)return NULL ;INIT_WORK (&mb_chann->rx_work, mailbox_rx_worker); - mb_chann->work_q =create_singlethread_workqueue (MAILBOX_NAME ); + mb_chann->work_q =alloc_ordered_workqueue (MAILBOX_NAME ,WQ_MEM_RECLAIM );if (!mb_chann->work_q) {MB_ERR (mb_chann,"Create workqueue failed" ); goto free_chann;
Signature · 1 line
2.55.0
Re: [PATCH 1/2] accel/amdxdna: Replace create_singlethread_workqueue with alloc_ordered_workqueue
Quoted 20 lines · George Karagounis
create_singlethread_workqueue()is deprecated. Replace it with
alloc_ordered_workqueue()to use the shared system workqueueinfrastructure more efficiently.
WQ_MEM_RECLAIMis added to ensure the mailbox can processinterrupts under memory pressure.
Signed-off-by George Karagounis <[email protected]>--- drivers/accel/amdxdna/amdxdna_mailbox.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/accel/amdxdna/amdxdna_mailbox.c +0
-0
drivers/accel/amdxdna/amdxdna_mailbox.c struct mailbox_channel *xdna_mailbox_alloc_channel(struct mailbox *mb) · line 484
Quoted 5 lines
drivers/accel/amdxdna/amdxdna_mailbox.c +1
-1@@ -481,7 +481,7 @@ struct mailbox_channel *xdna_mailbox_alloc_channel(struct mailbox *mb)return NULL ;INIT_WORK (&mb_chann->rx_work, mailbox_rx_worker); - mb_chann->work_q =create_singlethread_workqueue (MAILBOX_NAME ); + mb_chann->work_q =alloc_ordered_workqueue (MAILBOX_NAME ,WQ_MEM_RECLAIM );
Quoted 3 lines
drivers/accel/amdxdna/amdxdna_mailbox.c +0
-0if (!mb_chann->work_q) {MB_ERR (mb_chann,"Create workqueue failed" ); goto free_chann;
Re: [PATCH 1/2] accel/amdxdna: Replace create_singlethread_workqueue with alloc_ordered_workqueue
In reply to George KaragounisApplied to drm-misc-next
Quoted 28 lines · George Karagounis
create_singlethread_workqueue()is deprecated. Replace it with
alloc_ordered_workqueue()to use the shared system workqueueinfrastructure more efficiently.
WQ_MEM_RECLAIMis added to ensure the mailbox can processinterrupts under memory pressure.
Signed-off-by George Karagounis <[email protected]>--- drivers/accel/amdxdna/amdxdna_mailbox.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/accel/amdxdna/amdxdna_mailbox.c +1
-1@@ -481,7 +481,7 @@ struct mailbox_channel *xdna_mailbox_alloc_channel(struct mailbox *mb)return NULL ;INIT_WORK (&mb_chann->rx_work, mailbox_rx_worker); - mb_chann->work_q =create_singlethread_workqueue (MAILBOX_NAME ); + mb_chann->work_q =alloc_ordered_workqueue (MAILBOX_NAME ,WQ_MEM_RECLAIM );if (!mb_chann->work_q) {MB_ERR (mb_chann,"Create workqueue failed" ); goto free_chann;
PATCH 2/2 accel/habanalabs: Replace create_singlethread_workqueue with alloc_ordered_workqueue
In reply to George Karagouniscreate_singlethread_workqueue() is deprecated. Replace it with
alloc_ordered_workqueue() for the command, event, and reset
workqueues.
Use the %s format string specifier to satisfy the API
requirements for variable workqueue names. WQ_MEM_RECLAIM is
added to ensure hardware events are processed under memory
pressure.
--- drivers/accel/habanalabs/common/device.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/accel/habanalabs/common/device.c +3 -3
@@ -902,7 +902,7 @@ static int device_early_init(struct hl_device *hdev)for (i =0 ; i < hdev->asic_prop.completion_queues_count ; i++) {snprintf (workq_name,32 ,"hl%u-free-jobs-%u" , hdev->cdev_idx, (u32 ) i); - hdev->cq_wq[i] =create_singlethread_workqueue (workq_name); + hdev->cq_wq[i] =alloc_ordered_workqueue ("%s" ,WQ_MEM_RECLAIM , workq_name);if (hdev->cq_wq[i] ==NULL ) {dev_err (hdev->dev,"Failed to allocate CQ workqueue\n" ); rc = -ENOMEM ;
@@ -911,7 +911,7 @@ static int device_early_init(struct hl_device *hdev) }snprintf (workq_name,32 ,"hl%u-events" , hdev->cdev_idx); - hdev->eq_wq =create_singlethread_workqueue (workq_name); + hdev->eq_wq =alloc_ordered_workqueue ("%s" ,WQ_MEM_RECLAIM , workq_name);if (hdev->eq_wq ==NULL ) {dev_err (hdev->dev,"Failed to allocate EQ workqueue\n" ); rc = -ENOMEM ;
@@ -957,7 +957,7 @@ static int device_early_init(struct hl_device *hdev)hl_mem_mgr_init (hdev->dev, &hdev->kernel_mem_mgr);snprintf (workq_name,32 ,"hl%u_device_reset" , hdev->cdev_idx); - hdev->reset_wq =create_singlethread_workqueue (workq_name); + hdev->reset_wq =alloc_ordered_workqueue ("%s" ,WQ_MEM_RECLAIM , workq_name);if (!hdev->reset_wq) { rc = -ENOMEM ;dev_err (hdev->dev,"Failed to create device reset WQ\n" );
Signature · 1 line
2.55.0