From: Bart Van Assche <bvanassche@acm.org>
To: Tejun Heo <tj@kernel.org>
Cc: Lai Jiangshan <jiangshanlai@gmail.com>,
"Martin K . Petersen" <martin.petersen@oracle.com>,
linux-kernel@vger.kernel.org,
Bart Van Assche <bvanassche@acm.org>,
Oded Gabbay <ogabbay@kernel.org>, Tomer Tayar <ttayar@habana.ai>,
Farah Kassabri <fkassabri@habana.ai>,
Ofir Bitton <obitton@habana.ai>, Koby Elbaz <kelbaz@habana.ai>,
Dafna Hirschfeld <dhirschfeld@habana.ai>,
Ohad Sharabi <osharabi@habana.ai>,
Dani Liberman <dliberman@habana.ai>
Subject: [PATCH 21/53] accel/habanalabs: Simplify the workqueue creation calls
Date: Sun, 30 Jun 2024 15:26:39 -0700 [thread overview]
Message-ID: <20240630222904.627462-22-bvanassche@acm.org> (raw)
In-Reply-To: <20240630222904.627462-1-bvanassche@acm.org>
Pass a format string to the workqueue creation calls instead of formatting
the workqueue name before a workqueue creation macro is used.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
drivers/accel/habanalabs/common/device.c | 25 ++++++++++++------------
1 file changed, 12 insertions(+), 13 deletions(-)
diff --git a/drivers/accel/habanalabs/common/device.c b/drivers/accel/habanalabs/common/device.c
index 8f92445c5a90..e44c8352c1da 100644
--- a/drivers/accel/habanalabs/common/device.c
+++ b/drivers/accel/habanalabs/common/device.c
@@ -831,7 +831,6 @@ static void device_release_watchdog_func(struct work_struct *work)
static int device_early_init(struct hl_device *hdev)
{
int i, rc;
- char workq_name[32];
switch (hdev->asic_type) {
case ASIC_GOYA:
@@ -883,8 +882,8 @@ 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] = create_singlethread_workqueue2(
+ "hl%u-free-jobs-%u", hdev->cdev_idx, i);
if (hdev->cq_wq[i] == NULL) {
dev_err(hdev->dev, "Failed to allocate CQ workqueue\n");
rc = -ENOMEM;
@@ -892,16 +891,16 @@ 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 =
+ create_singlethread_workqueue2("hl%u-events", hdev->cdev_idx);
if (hdev->eq_wq == NULL) {
dev_err(hdev->dev, "Failed to allocate EQ workqueue\n");
rc = -ENOMEM;
goto free_cq_wq;
}
- snprintf(workq_name, 32, "hl%u-cs-completions", hdev->cdev_idx);
- hdev->cs_cmplt_wq = alloc_workqueue(workq_name, WQ_UNBOUND, 0);
+ hdev->cs_cmplt_wq = alloc_workqueue("hl%u-cs-completions", WQ_UNBOUND,
+ 0, hdev->cdev_idx);
if (!hdev->cs_cmplt_wq) {
dev_err(hdev->dev,
"Failed to allocate CS completions workqueue\n");
@@ -909,8 +908,8 @@ static int device_early_init(struct hl_device *hdev)
goto free_eq_wq;
}
- snprintf(workq_name, 32, "hl%u-ts-free-obj", hdev->cdev_idx);
- hdev->ts_free_obj_wq = alloc_workqueue(workq_name, WQ_UNBOUND, 0);
+ hdev->ts_free_obj_wq = alloc_workqueue("hl%u-ts-free-obj", WQ_UNBOUND,
+ 0, hdev->cdev_idx);
if (!hdev->ts_free_obj_wq) {
dev_err(hdev->dev,
"Failed to allocate Timestamp registration free workqueue\n");
@@ -918,8 +917,8 @@ static int device_early_init(struct hl_device *hdev)
goto free_cs_cmplt_wq;
}
- snprintf(workq_name, 32, "hl%u-prefetch", hdev->cdev_idx);
- hdev->prefetch_wq = alloc_workqueue(workq_name, WQ_UNBOUND, 0);
+ hdev->prefetch_wq =
+ alloc_workqueue("hl%u-prefetch", WQ_UNBOUND, 0, hdev->cdev_idx);
if (!hdev->prefetch_wq) {
dev_err(hdev->dev, "Failed to allocate MMU prefetch workqueue\n");
rc = -ENOMEM;
@@ -938,8 +937,8 @@ 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 = create_singlethread_workqueue2("hl%u_device_reset",
+ hdev->cdev_idx);
if (!hdev->reset_wq) {
rc = -ENOMEM;
dev_err(hdev->dev, "Failed to create device reset WQ\n");
next prev parent reply other threads:[~2024-06-30 22:31 UTC|newest]
Thread overview: 71+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-30 22:26 [PATCH 00/53] Let create*_workqueue() accept a printf-style format string Bart Van Assche
2024-06-30 22:26 ` [PATCH 01/53] workqueue: Introduce the create*_workqueue2() macros Bart Van Assche
2024-07-01 2:51 ` Lai Jiangshan
2024-07-01 16:42 ` Bart Van Assche
2024-07-03 20:24 ` Kees Cook
2024-07-03 21:28 ` Bart Van Assche
2024-07-03 22:20 ` Kees Cook
2024-07-03 22:33 ` Tejun Heo
2024-06-30 22:26 ` [PATCH 02/53] dmaengine: idxd: Switch to create*_workqueue2() Bart Van Assche
2024-06-30 22:26 ` [PATCH 03/53] drm/amdgpu: " Bart Van Assche
2024-06-30 22:26 ` [PATCH 04/53] media: i2c: adv7511: " Bart Van Assche
2024-06-30 22:26 ` [PATCH 05/53] media: cobalt: " Bart Van Assche
2024-06-30 22:26 ` [PATCH 06/53] media: dm1105: " Bart Van Assche
2024-06-30 22:26 ` [PATCH 07/53] misc: bcm_vk: " Bart Van Assche
2024-06-30 22:26 ` [PATCH 08/53] net: amd-xgbe: " Bart Van Assche
2024-06-30 22:26 ` [PATCH 09/53] net: atlantic: " Bart Van Assche
2024-06-30 22:26 ` [PATCH 10/53] net: mvpp2: " Bart Van Assche
2024-06-30 22:26 ` [PATCH 11/53] remoteproc: stm32: " Bart Van Assche
2024-06-30 22:26 ` [PATCH 12/53] mm/z3fold: " Bart Van Assche
2024-06-30 22:26 ` [PATCH 13/53] usb: typec: tcpm: " Bart Van Assche
2024-06-30 22:26 ` [PATCH 14/53] net/qla3xxx: " Bart Van Assche
2024-06-30 22:26 ` [PATCH 15/53] sfc: " Bart Van Assche
2024-06-30 22:26 ` [PATCH 16/53] wifi: zd1211rw: " Bart Van Assche
2024-06-30 22:26 ` [PATCH 17/53] power: supply: mt6370: " Bart Van Assche
2024-06-30 22:26 ` [PATCH 18/53] remoteproc: imx_rproc: " Bart Van Assche
2024-06-30 22:26 ` [PATCH 19/53] scsi: hisi_sas: " Bart Van Assche
2024-06-30 22:26 ` [PATCH 20/53] scsi: mpt3sas: " Bart Van Assche
2024-06-30 22:26 ` Bart Van Assche [this message]
2024-06-30 22:26 ` [PATCH 22/53] crypto: safexcel - Simplify a create*_workqueue() call Bart Van Assche
2024-06-30 22:26 ` [PATCH 23/53] pds_core: " Bart Van Assche
2024-07-01 18:49 ` Brett Creeley
2024-07-01 19:53 ` Bart Van Assche
2024-06-30 22:26 ` [PATCH 24/53] net: bna: " Bart Van Assche
2024-06-30 22:26 ` [PATCH 25/53] net/mlx5: Simplify the create*_workqueue() calls Bart Van Assche
2024-06-30 22:26 ` [PATCH 26/53] net: lan966x: Simplify a create*_workqueue() call Bart Van Assche
2024-06-30 22:26 ` [PATCH 27/53] net: sparx5: Simplify the create*_workqueue() calls Bart Van Assche
2024-06-30 22:26 ` [PATCH 28/53] net: mscc: ocelot: Simplify a create*_workqueue() call Bart Van Assche
2024-06-30 22:26 ` [PATCH 29/53] net: qed: " Bart Van Assche
2024-06-30 22:26 ` [PATCH 30/53] net: stmmac: " Bart Van Assche
2024-06-30 22:26 ` [PATCH 31/53] nfc: mrvl: " Bart Van Assche
2024-07-01 9:17 ` Krzysztof Kozlowski
2024-07-01 16:44 ` Bart Van Assche
2024-07-01 16:54 ` Krzysztof Kozlowski
2024-06-30 22:26 ` [PATCH 32/53] scsi: ibmvscsi_tgt: " Bart Van Assche
2024-06-30 22:26 ` [PATCH 33/53] scsi: libsas: Simplify the create*_workqueue() calls Bart Van Assche
2024-07-01 0:15 ` Damien Le Moal
2024-07-01 1:50 ` Jason Yan
2024-06-30 22:26 ` [PATCH 34/53] scsi: mpi3mr: Simplify a create*_workqueue() call Bart Van Assche
2024-06-30 22:26 ` [PATCH 35/53] scsi: qedf: Simplify the create*_workqueue() calls Bart Van Assche
2024-06-30 22:26 ` [PATCH 36/53] scsi: qedi: " Bart Van Assche
2024-06-30 22:26 ` [PATCH 37/53] scsi: qla2xxx: " Bart Van Assche
2024-06-30 22:26 ` [PATCH 38/53] scsi: qla4xxx: Simplify a create*_workqueue() call Bart Van Assche
2024-06-30 22:26 ` [PATCH 39/53] scsi: vmw_pvscsi: " Bart Van Assche
2024-06-30 22:26 ` [PATCH 40/53] scsi: myrb: Simplify the create*_workqueue() calls Bart Van Assche
2024-06-30 22:26 ` [PATCH 41/53] scsi: myrs: " Bart Van Assche
2024-06-30 22:27 ` [PATCH 42/53] scsi: stex: " Bart Van Assche
2024-06-30 22:27 ` [PATCH 43/53] scsi: fcoe: " Bart Van Assche
2024-06-30 22:27 ` [PATCH 44/53] scsi: snic: " Bart Van Assche
2024-06-30 22:27 ` [PATCH 45/53] scsi: scsi_transport_fc: " Bart Van Assche
2024-06-30 22:27 ` [PATCH 46/53] scsi: core: Simplify the alloc_workqueue() calls Bart Van Assche
2024-06-30 22:27 ` [PATCH 47/53] serial: max3100: Simplify a create*_workqueue() call Bart Van Assche
2024-08-09 15:21 ` Andy Shevchenko
2024-06-30 22:27 ` [PATCH 48/53] scsi: ufs: Simplify the create*_workqueue() calls Bart Van Assche
2024-06-30 22:27 ` [PATCH 49/53] usb: typec: ucsi: Simplify a create*_workqueue() call Bart Van Assche
2024-06-30 22:27 ` [PATCH 50/53] cifs: " Bart Van Assche
2024-06-30 22:27 ` [PATCH 51/53] mac802154: Simplify the create*_workqueue() calls Bart Van Assche
2024-06-30 22:27 ` [PATCH 52/53] nfc: nci: " Bart Van Assche
2024-07-01 16:54 ` Krzysztof Kozlowski
2024-07-01 19:39 ` [PATCH 00/53] Let create*_workqueue() accept a printf-style format string Tejun Heo
2024-07-01 20:13 ` Bart Van Assche
2024-07-01 20:17 ` Tejun Heo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240630222904.627462-22-bvanassche@acm.org \
--to=bvanassche@acm.org \
--cc=dhirschfeld@habana.ai \
--cc=dliberman@habana.ai \
--cc=fkassabri@habana.ai \
--cc=jiangshanlai@gmail.com \
--cc=kelbaz@habana.ai \
--cc=linux-kernel@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=obitton@habana.ai \
--cc=ogabbay@kernel.org \
--cc=osharabi@habana.ai \
--cc=tj@kernel.org \
--cc=ttayar@habana.ai \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®