lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240630222904.627462-22-bvanassche@acm.org>
Date: Sun, 30 Jun 2024 15:26:39 -0700
From: Bart Van Assche <bvanassche@....org>
To: Tejun Heo <tj@...nel.org>
Cc: Lai Jiangshan <jiangshanlai@...il.com>,
	"Martin K . Petersen" <martin.petersen@...cle.com>,
	linux-kernel@...r.kernel.org,
	Bart Van Assche <bvanassche@....org>,
	Oded Gabbay <ogabbay@...nel.org>,
	Tomer Tayar <ttayar@...ana.ai>,
	Farah Kassabri <fkassabri@...ana.ai>,
	Ofir Bitton <obitton@...ana.ai>,
	Koby Elbaz <kelbaz@...ana.ai>,
	Dafna Hirschfeld <dhirschfeld@...ana.ai>,
	Ohad Sharabi <osharabi@...ana.ai>,
	Dani Liberman <dliberman@...ana.ai>
Subject: [PATCH 21/53] accel/habanalabs: Simplify the workqueue creation calls

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@....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");

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ