Skip to contentSkip to conversation

accel-config/test: Disable all WQs and rmmod iaa_crypto

PATCH New Rex Zhang 1 participant 3 messages Feb 20, 2024

lore
Share & tools
lore

Rex Zhang

author
#0 lore raw

PATCH 1/3 accel-config/test: Disable all WQs and rmmod iaa_crypto

Some default WQs are enabled by module iaa_crypto, it can block the subsequential WQs enabling.
The solution is disabling all WQs and rmmod iaa_crypto at the beginning of the script.

---
 test/common | 3 +++
 1 file changed, 3 insertions(+)
test/common +3 -0
index 8b8f40f..a5a53ec 100755
@@ -182,6 +182,9 @@ _cleanup()
 	modprobe idxd
 	sleep 1
 	modprobe vfio_pci
+
+	disable_all
+	rmmod iaa_crypto
 }
 
 # json2var
Signature · 1 line
2.25.1
author
#1 lore raw

PATCH 2/3 accel-config/test: Remove the script about vfio passthrough device

The operation translation fetch no longer use the vfio passthrough device to map/unmap address. Remove the relavant script.

---
 test/iaa_user_test_runner.sh | 28 +---------------------------
 1 file changed, 1 insertion(+), 27 deletions(-)
test/iaa_user_test_runner.sh +1 -27
index d85d043..eb9629b 100755
@@ -20,10 +20,6 @@ fi
 echo "$IAA"
 WQ0=wq1.4
 WQ1=wq1.1
-DBDF=`ls -l /sys/bus/dsa/devices/iax3 | awk -F '/' '{print $(NF - 1)}'`
-VENDOR_ID=`lspci -n -s ${DBDF} | awk -F ' ' '{print $NF}' | awk -F ':' '{print $1}'`
-DEVICE_ID=`lspci -n -s ${DBDF} | awk -F ' ' '{print $NF}' | awk -F ':' '{print $2}'`
-VFIO_BINDED=0
 
 IAA_OPCODE_NOOP=0x0
 IAA_OPCODE_TRANSL_FETCH=0xa
@@ -112,22 +108,6 @@ disable_wqs()
 	"$ACCFG" disable-wq "$IAA"/"$WQ1"
 }
 
-bind_vfio()
-{
-	echo "PCI dev info: ${DBDF} ${VENDOR_ID} ${DEVICE_ID}"
-	echo ${DBDF} > /sys/bus/pci/drivers/idxd/unbind
-	echo ${VENDOR_ID} ${DEVICE_ID} > /sys/bus/pci/drivers/vfio-pci/new_id
-	VFIO_BINDED=1
-}
-
-unbind_vfio()
-{
-	echo ${VENDOR_ID} ${DEVICE_ID} > /sys/bus/pci/drivers/vfio-pci/remove_id
-	echo ${DBDF} > /sys/bus/pci/drivers/vfio-pci/unbind
-	echo 1 > /sys/bus/pci/devices/${DBDF}/reset
-	echo ${DBDF} > /sys/bus/pci/drivers/idxd/bind
-}
-
 err_exit()
 {
 	err_code=$?
@@ -349,9 +329,7 @@ test_op_transl_fetch()
 			echo "Testing $xfer_size bytes"
 
 			"$IAATEST" -w "$wq_mode_code" -l "$xfer_size" -o "$opcode" \
-				-f "$flag" -m 0 -t 5000 -v $DEV_OPT
-			"$IAATEST" -w "$wq_mode_code" -l "$xfer_size" -o "$opcode" \
-				-f "$flag" -m 1 -t 5000 -v $DEV_OPT
+				-f "$flag" -t 5000 -v $DEV_OPT
 		done
 	done
 }
@@ -500,8 +478,6 @@ if [ $((IAA_OPCODE_MASK_DECRYPT & OP_CAP2)) -ne 0 ]; then
 fi
 
 if [ $((IAA_OPCODE_MASK_TRANSL_FETCH & OP_CAP0)) -ne 0 ]; then
-	bind_vfio
-
 	flag="0x1"
 	echo "Testing with 'block on fault' flag ON"
 	test_op_transl_fetch $IAA_OPCODE_TRANSL_FETCH $flag
@@ -509,8 +485,6 @@ if [ $((IAA_OPCODE_MASK_TRANSL_FETCH & OP_CAP0)) -ne 0 ]; then
 	flag="0x0"
 	echo "Testing with 'block on fault' flag OFF"
 	test_op_transl_fetch $IAA_OPCODE_TRANSL_FETCH $flag
-
-	unbind_vfio
 fi
 
 if [ "$input1" != "--skip-config" ]; then
Signature · 1 line
2.25.1
author
#2 lore raw

PATCH 3/3 accel-config/test: Use madvise(MADV_DONTNEED) to ummap address

In reply to Rex Zhang

Instead of vfio passthrough device, use madvise(MADV_DONTNEED) to unmap source address for the operation translation fetch.

---
 test/accel_test.c |   8 +--
 test/accel_test.h |   4 --
 test/iaa.c        | 179 ++--------------------------------------------
 test/iaa.h        |   2 +-
 test/iaa_test.c   |  23 ++----
 5 files changed, 13 insertions(+), 203 deletions(-)
test/accel_test.c +1 -7
index 61d9944..e7f0e8e 100644
@@ -479,13 +479,7 @@ void __clean_task(struct task *tsk)
 	free(tsk->desc);
 	free(tsk->comp);
 	mprotect(tsk->src1, PAGE_SIZE, PROT_READ | PROT_WRITE);
-	if (tsk->opcode != IAX_OPCODE_TRANSL_FETCH) {
-		free(tsk->src1);
-	} else {
-		munmap(tsk->src1, tsk->xfer_size);
-		close(tsk->group);
-		close(tsk->container);
-	}
+	free(tsk->src1);
 	free(tsk->src2);
 	free(tsk->dst1);
 	free(tsk->dst2);
test/accel_test.h +0 -4
index fea0fe6..1402620 100644
@@ -94,10 +94,6 @@ struct task {
 		uint8_t algorithm;
 		uint8_t flags;
 	} crypto_aecs;
-
-	/* Translation Fetch */
-	int container;
-	int group;
 };
 
 struct task_node {
test/iaa.c +5 -174

210 lines not on this page · raw message

test/iaa.h +1 -1
index bbb4bad..69c5de4 100644
@@ -26,7 +26,7 @@ int iaa_select_multi_task_nodes(struct acctest_context *ctx);
 int iaa_rle_burst_multi_task_nodes(struct acctest_context *ctx);
 int iaa_find_unique_multi_task_nodes(struct acctest_context *ctx);
 int iaa_expand_multi_task_nodes(struct acctest_context *ctx);
-int iaa_transl_fetch_multi_task_nodes(struct acctest_context *ctx, int do_mmap);
+int iaa_transl_fetch_multi_task_nodes(struct acctest_context *ctx);
 int iaa_encrypto_multi_task_nodes(struct acctest_context *ctx);
 int iaa_decrypto_multi_task_nodes(struct acctest_context *ctx);
 
test/iaa_test.c +6 -17
index 1417924..5854c64 100644
@@ -23,7 +23,6 @@ static void usage(void)
 	"-2 <extra_flags_2> ; specified by each opcpde\n"
 	"-3 <extra_flags_3> ; specified by each opcpde\n"
 	"-a <aecs> ; specifies AECS\n"
-	"-m <map or unmap> ; specified by Translation Fetch\n"
 	"-o <opcode>     ; opcode, same value as in IAA spec\n"
 	"-d              ; wq device such as iax1/wq1.0\n"
 	"-n <number of descriptors> ;descriptor count to submit\n"
@@ -436,14 +435,14 @@ static int test_filter(struct acctest_context *ctx, size_t buf_size, int tflags,
 }
 
 static int test_transl_fetch(struct acctest_context *ctx, size_t buf_size,
-			     int tflags, uint32_t opcode, int num_desc, int do_map)
+			     int tflags, uint32_t opcode, int num_desc)
 {
 	struct task_node *tsk_node;
 	int rc = ACCTEST_STATUS_OK;
 	int itr = num_desc, i = 0, range = 0;
 
-	info("test transl-fetch: opcode %d len %#lx tflags %#x num_desc %ld do_map %d\n",
-	     opcode, buf_size, tflags, num_desc, do_map);
+	info("test transl-fetch: opcode %d len %#lx tflags %#x num_desc %ld\n",
+	     opcode, buf_size, tflags, num_desc);
 
 	ctx->is_batch = 0;
 
@@ -471,16 +470,10 @@ static int test_transl_fetch(struct acctest_context *ctx, size_t buf_size,
 
 		switch (opcode) {
 		case IAX_OPCODE_TRANSL_FETCH:
-			rc = iaa_transl_fetch_multi_task_nodes(ctx, do_map);
-			if ((tflags & TEST_FLAGS_BOF) ||
-			    ((!(tflags & TEST_FLAGS_BOF)) && do_map)) {
-				if (rc != ACCTEST_STATUS_OK)
-					return rc;
-			}
+			rc = iaa_transl_fetch_multi_task_nodes(ctx);
 
 			/* Verification of all the nodes*/
-			if ((tflags & TEST_FLAGS_BOF) ||
-			    ((!(tflags & TEST_FLAGS_BOF)) && do_map))
+			if (tflags & TEST_FLAGS_BOF)
 				rc = iaa_task_result_verify_task_nodes(ctx, 0);
 			else
 				rc = iaa_task_result_verify_task_nodes(ctx, 1);
@@ -579,7 +572,6 @@ int main(int argc, char *argv[])
 	int extra_flags_1 = 0;
 	int extra_flags_2 = 0;
 	int extra_flags_3 = 0;
-	int do_map = 0;
 	int aecs = 0;
 	int opcode = IAX_OPCODE_NOOP;
 	int opt;
@@ -612,9 +604,6 @@ int main(int argc, char *argv[])
 		case 'a':
 			aecs = strtoul(optarg, NULL, 0);
 			break;
-		case 'm':
-			do_map = strtoul(optarg, NULL, 0);
-			break;
 		case 'o':
 			opcode = strtoul(optarg, NULL, 0);
 			break;
@@ -702,7 +691,7 @@ int main(int argc, char *argv[])
 			goto error;
 		break;
 	case IAX_OPCODE_TRANSL_FETCH:
-		rc = test_transl_fetch(iaa, buf_size, tflags, opcode, num_desc, do_map);
+		rc = test_transl_fetch(iaa, buf_size, tflags, opcode, num_desc);
 		if (rc != ACCTEST_STATUS_OK)
 			goto error;
 		break;
Signature · 1 line
2.25.1