Skip to contentSkip to conversation

accel-config/test: Fix bug about finding a mismatched wq

PATCH Dave Jiang 2 participants 3 messages May 12, 2023 – May 24, 2023 2 messages not in the archive

lore
Share & tools
lore

Dave Jiang

author Reviewed-by
#2 lore raw
In reply to a message not in the archive
Quoted 6 lines · Rex Zhang

When both DSA wq and IAA wq are enabled, the test code would find the first available wq for submitting descriptors. If the DSA wq is prior to IAA wq, the IAA test code would use DSA wq. It's incorrect. For fixing this bug, jump over the wq with mismatched device type.

Simple ans straight forward.

Quoted 58 lines
---
  test/accel_test.c | 4 ++++
  test/accel_test.h | 1 +
  test/dsa_test.c   | 1 +
  test/iaa_test.c   | 1 +
  4 files changed, 7 insertions(+)
test/accel_test.c +4 -0
index 7bbe780..61d9944 100644
@@ -125,6 +125,10 @@ static struct accfg_wq *acctest_get_wq(struct acctest_context *ctx,
  			enum accfg_wq_mode mode;
  			enum accfg_wq_type type;
 
+			/* Make sure iaa_test will not use dsa wq, vice versa*/
+			if (accfg_device_get_type(device) != ctx->dev_type)
+				continue;
+
  			/* Get a workqueue that's enabled */
  			wstate = accfg_wq_get_state(wq);
  			if (wstate != ACCFG_WQ_ENABLED)
test/accel_test.h +1 -0
index 3b41a78..f152850 100644
@@ -160,6 +160,7 @@ struct acctest_context {
  	unsigned int wq_max_batch_size;
  	unsigned long wq_max_xfer_size;
  	int ats_disable;
+	enum accfg_device_type dev_type;
 
  	int is_batch;
  	int is_evl_test;
test/dsa_test.c +1 -0
index a4aad29..31cb964 100644
@@ -897,6 +897,7 @@ int main(int argc, char *argv[])
  	}
 
  	dsa = acctest_init(tflags);
+	dsa->dev_type = ACCFG_DEVICE_DSA;
 
  	if (!dsa)
  		return -ENOMEM;
test/iaa_test.c +1 -0
index a1f529d..c682009 100644
@@ -643,6 +643,7 @@ int main(int argc, char *argv[])
  	}
 
  	iaa = acctest_init(tflags);
+	iaa->dev_type = ACCFG_DEVICE_IAX;
 
  	if (!iaa)
  		return -ENOMEM;
author Reviewed-by
#3 lore raw

Re: [Accel-config] [PATCH v3 1/2] accel-config: Add defconfig.conf for default config

In reply to a message not in the archive
Quoted 7 lines · Rex Zhang

A default configuration file is necessary. Add defconfig.conf as the default config file. Configure 1 DSA and 1 IAX device, 1 kernel wq and 1 user wq for either DSA or IAX by default. The Kernel wq is configured in dedicated mode while the user wq in shared mode.

Quoted 120 lines
---
  contrib/configs/defconfig.conf | 109 +++++++++++++++++++++++++++++++++
  1 file changed, 109 insertions(+)

create mode 100644 contrib/configs/defconfig.conf

contrib/configs/defconfig.conf new file +109 -0
new file mode 100644
index 0000000..2d27fc2
@@ -0,0 +1,109 @@
+[
+  {
+    "dev":"dsa0",
+    "read_buffer_limit":0,
+    "groups":[
+      {
+        "dev":"group0.0",
+        "grouped_workqueues":[
+          {
+            "dev":"wq0.0",
+            "mode":"dedicated",
+            "size":8,
+            "group_id":0,
+            "priority":10,
+            "block_on_fault":0,
+            "max_batch_size":32,
+            "max_transfer_size":16384,
+            "type":"kernel",
+            "driver_name":"dmaengine",
+            "name":"wq0.0",
+          }
+        ],
+        "grouped_engines":[
+          {
+            "dev":"engine0.0",
+            "group_id":0
+          }
+        ]
+      },
+      {
+        "dev":"group0.1",
+        "grouped_workqueues":[
+          {
+            "dev":"wq0.1",
+            "mode":"shared",
+            "size":32,
+            "group_id":1,
+            "priority":10,
+            "block_on_fault":1,
+            "max_batch_size":32,
+            "max_transfer_size":2097152,
+            "type":"user",
+            "driver_name":"user",
+            "name":"wq0.1",
+            "threshold":28
+          }
+        ],
+        "grouped_engines":[
+          {
+            "dev":"engine0.1",
+            "group_id":1
+          }
+        ]
+      }
+    ]
+  },
+  {
+    "dev":"iax1",
+    "groups":[
+      {
+        "dev":"group1.0",
+        "grouped_workqueues":[
+          {
+            "dev":"wq1.0",
+            "mode":"dedicated",
+            "size":8,
+            "group_id":2,
+            "priority":10,
+            "block_on_fault":0,
+            "max_transfer_size":16384,
+            "type":"kernel",
+            "driver_name":"crypto",
+            "name":"wq1.0",
+          }
+        ],
+        "grouped_engines":[
+          {
+            "dev":"engine1.0",
+            "group_id":2
+          }
+        ]
+      },
+      {
+        "dev":"group1.1",
+        "grouped_workqueues":[
+          {
+            "dev":"wq1.1",
+            "mode":"shared",
+            "size":32,
+            "group_id":3,
+            "priority":10,
+            "block_on_fault":1,
+            "max_transfer_size":4194304,
+            "type":"user",
+            "driver_name":"user",
+            "name":"wq1.1",
+            "threshold":28
+          }
+        ],
+        "grouped_engines":[
+          {
+            "dev":"engine1.1",
+            "group_id":3
+          }
+        ]
+      }
+    ]
+  }
+]
#4 lore raw

Re: [Accel-config] [PATCH v3 1/2] accel-config: Add defconfig.conf for default config

In a meeting today regarding the default config issue, we decided to do it a bit differently than simply loading a default config file. Accel-config would only configure user type WQs. It will scan all devices in sysfs for engines and WQs that are not enabled yet. They will be configured into a new group and enabled. The WQs would be configured as shared and the name would be set to indicate it is a default configuration.

Thanks for this patch. I would refer to this and other sample configs to set the default parameter values. My plan is to remove the kernel configurations and keep the user configurations as a template and internally load them into a json array that will be used to set the attributes of each device being configured.

Quoted 131 lines · Dave Jiang
Quoted 7 lines · Rex Zhang

A default configuration file is necessary. Add defconfig.conf as the default config file. Configure 1 DSA and 1 IAX device, 1 kernel wq and 1 user wq for either DSA or IAX by default. The Kernel wq is configured in dedicated mode while the user wq in shared mode.

Quoted 120 lines

---
  contrib/configs/defconfig.conf | 109 +++++++++++++++++++++++++++++++++

  1 file changed, 109 insertions(+)

  create mode 100644 contrib/configs/defconfig.conf

contrib/configs/defconfig.conf new file +109 -0
new file mode 100644
index 0000000..2d27fc2
@@ -0,0 +1,109 @@
+[
+  {
+    "dev":"dsa0",
+    "read_buffer_limit":0,
+    "groups":[
+      {
+        "dev":"group0.0",
+        "grouped_workqueues":[
+          {
+            "dev":"wq0.0",
+            "mode":"dedicated",
+            "size":8,
+            "group_id":0,
+            "priority":10,
+            "block_on_fault":0,
+            "max_batch_size":32,
+            "max_transfer_size":16384,
+            "type":"kernel",
+            "driver_name":"dmaengine",
+            "name":"wq0.0",
+          }
+        ],
+        "grouped_engines":[
+          {
+            "dev":"engine0.0",
+            "group_id":0
+          }
+        ]
+      },
+      {
+        "dev":"group0.1",
+        "grouped_workqueues":[
+          {
+            "dev":"wq0.1",
+            "mode":"shared",
+            "size":32,
+            "group_id":1,
+            "priority":10,
+            "block_on_fault":1,
+            "max_batch_size":32,
+            "max_transfer_size":2097152,
+            "type":"user",
+            "driver_name":"user",
+            "name":"wq0.1",
+            "threshold":28
+          }
+        ],
+        "grouped_engines":[
+          {
+            "dev":"engine0.1",
+            "group_id":1
+          }
+        ]
+      }
+    ]
+  },
+  {
+    "dev":"iax1",
+    "groups":[
+      {
+        "dev":"group1.0",
+        "grouped_workqueues":[
+          {
+            "dev":"wq1.0",
+            "mode":"dedicated",
+            "size":8,
+            "group_id":2,
+            "priority":10,
+            "block_on_fault":0,
+            "max_transfer_size":16384,
+            "type":"kernel",
+            "driver_name":"crypto",
+            "name":"wq1.0",
+          }
+        ],
+        "grouped_engines":[
+          {
+            "dev":"engine1.0",
+            "group_id":2
+          }
+        ]
+      },
+      {
+        "dev":"group1.1",
+        "grouped_workqueues":[
+          {
+            "dev":"wq1.1",
+            "mode":"shared",
+            "size":32,
+            "group_id":3,
+            "priority":10,
+            "block_on_fault":1,
+            "max_transfer_size":4194304,
+            "type":"user",
+            "driver_name":"user",
+            "name":"wq1.1",
+            "threshold":28
+          }
+        ],
+        "grouped_engines":[
+          {
+            "dev":"engine1.1",
+            "group_id":3
+          }
+        ]
+      }
+    ]
+  }
+]