[linux-yocto] [PATCH 03/15] drivers/edac: Add private work queues.

Daniel Dragomir daniel.dragomir at windriver.com
Tue Jun 27 08:41:03 PDT 2017


From: Marek Majtyka <marekx.majtyka at intel.com>

Off-load CMC isr functionality improved. Shared system work queue has been
replaces with private work queues (two wq per memory controller in order
to handle 'events' and 'alerts' separately).

Signed-off-by: Marek Majtyka <marekx.majtyka at intel.com>
---
 drivers/edac/axxia_edac-cmc_56xx.c | 27 +++++++++++++++++++++++++--
 1 file changed, 25 insertions(+), 2 deletions(-)

diff --git a/drivers/edac/axxia_edac-cmc_56xx.c b/drivers/edac/axxia_edac-cmc_56xx.c
index 690d31f..d72e618 100644
--- a/drivers/edac/axxia_edac-cmc_56xx.c
+++ b/drivers/edac/axxia_edac-cmc_56xx.c
@@ -439,6 +439,8 @@ struct intel_edac_dev_info {
 	char *blk_name;
 	struct work_struct offload_alerts;
 	struct work_struct offload_events;
+	struct workqueue_struct *wq_alerts;
+	struct workqueue_struct *wq_events;
 	int is_ddr4;
 	int edac_idx;
 	u32 cm_region;
@@ -1118,14 +1120,26 @@ static int intel_edac_mc_probe(struct platform_device *pdev)
 	snprintf(&dev_info->data->irq_name[0], IRQ_NAME_LEN,
 			"%s-mon", dev_info->ctl_name);
 
+	dev_info->wq_events = alloc_workqueue("%s-events", WQ_MEM_RECLAIM, 1,
+						(dev_info->ctl_name));
+	if (!dev_info->wq_events)
+		goto err_nosysfs;
+
+	if (dev_info->is_ddr4) {
+		dev_info->wq_alerts =
+			alloc_workqueue("%s-alerts", WQ_MEM_RECLAIM, 1,
+					(dev_info->ctl_name));
+		if (!dev_info->wq_alerts)
+			goto err_noevents;
+	}
 	if (dev_info->is_ddr4)
 		INIT_WORK(&dev_info->offload_alerts, axxia_alerts_work);
 
 	INIT_WORK(&dev_info->offload_events, axxia_events_work);
 
 	if (dev_info->is_ddr4)
-		schedule_work(&dev_info->offload_alerts);
-	schedule_work(&dev_info->offload_events);
+		queue_work(dev_info->wq_alerts, &dev_info->offload_alerts);
+	queue_work(dev_info->wq_events, &dev_info->offload_events);
 
 	irq = platform_get_irq(pdev, 0);
 	if (irq < 0) {
@@ -1177,6 +1191,11 @@ err_noirq:
 	cancel_work_sync(&dev_info->offload_events);
 
 	edac_device_del_device(&dev_info->pdev->dev);
+	if (dev_info->is_ddr4)
+		destroy_workqueue(dev_info->wq_alerts);
+
+err_noevents:
+	destroy_workqueue(dev_info->wq_events);
 
 err_nosysfs:
 	edac_device_free_ctl_info(dev_info->edac_dev);
@@ -1208,6 +1227,10 @@ static int intel_edac_mc_remove(struct platform_device *pdev)
 			if (dev_info->is_ddr4)
 				cancel_work_sync(&dev_info->offload_alerts);
 			cancel_work_sync(&dev_info->offload_events);
+
+			if (dev_info->is_ddr4)
+				destroy_workqueue(dev_info->wq_alerts);
+			destroy_workqueue(dev_info->wq_events);
 		}
 
 		if (dev_info->edac_dev != NULL) {
-- 
2.7.4



More information about the linux-yocto mailing list