accel-config/test: Fix bug about finding a mismatched wq
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 44 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.
Signed-off-by Rex Zhang <[email protected]>--- test/accel_test.c | 3 +++ test/accel_test.h | 1 + test/dsa_test.c | 1 + test/iaa_test.c | 1 + 4 files changed, 6 insertions(+)test/accel_test.c +3
-0@@ -125,6 +125,9 @@ static struct accfg_wq *acctest_get_wq(struct acctest_context *ctx,enum accfg_wq_mode mode;enum accfg_wq_type type; +if (strncmp (accfg_device_get_type_str (device), ctx->device_type,3 )) +continue ; +/* Get a workqueue that's enabled */ wstate =accfg_wq_get_state (wq);if (wstate !=ACCFG_WQ_ENABLED )test/accel_test.h +1
-0@@ -160,6 +160,7 @@ struct acctest_context {unsigned int wq_max_batch_size;unsigned long wq_max_xfer_size;int ats_disable; +char device_type[3 ];int is_batch;int is_evl_test;test/dsa_test.c +0
-0
test/dsa_test.c int main(int argc, char *argv[]) · line 900
Quoted 4 lines
test/dsa_test.c +1
-0@@ -897,6 +897,7 @@ int main(int argc, char *argv[]) } dsa =acctest_init (tflags); +strncpy (dsa->device_type,"dsa" ,3 );
It's probably cleaner to convert string to device type enum here and then compare it against accfg_device_get_type() later on.
Maybe libaccel-config can export a helper function to convert device string to device type?
accfg_str_to_device_type()?
Quoted 15 lines
test/dsa_test.c +0
-0if (!dsa)return -ENOMEM ;test/iaa_test.c +1
-0@@ -643,6 +643,7 @@ int main(int argc, char *argv[]) } iaa =acctest_init (tflags); +strncpy (iaa->device_type,"iax" ,3 );if (!iaa)return -ENOMEM ;
How about using device type enum directly?
Please help review my v3 patch.
Thanks.
----------------------------
Best wishes,
Rex Zhang
[email protected]
-----Original Message-----
From: Jiang, Dave <[email protected]>
Sent: Friday, May 12, 2023 12:49 AM
To: Zhang, Rex <[email protected]>; Yu, Fenghua <[email protected]>; Thomas, Ramesh <[email protected]>; Zhu, Tony <[email protected]>; [email protected]
Subject: Re: [PATCH v2 2/2] accel-config/test: Fix bug about finding a mismatched wq
Quoted 44 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.
Signed-off-by Rex Zhang <[email protected]>--- test/accel_test.c | 3 +++ test/accel_test.h | 1 + test/dsa_test.c | 1 + test/iaa_test.c | 1 + 4 files changed, 6 insertions(+)test/accel_test.c index renamed from test/accel_test.c +0
-07bbe780..d8fd70f 100644
test/accel_test.c +3
-0@@ -125,6 +125,9 @@ static struct accfg_wq *acctest_get_wq(struct acctest_context *ctx,enum accfg_wq_mode mode;enum accfg_wq_type type; +if (strncmp (accfg_device_get_type_str (device), ctx->device_type,3 )) +continue ; +/* Get a workqueue that's enabled */ wstate =accfg_wq_get_state (wq);if (wstate !=ACCFG_WQ_ENABLED )test/accel_test.h index renamed from test/accel_test.h +0
-03b41a78..17d4097 100644
test/accel_test.h +1
-0@@ -160,6 +160,7 @@ struct acctest_context {unsigned int wq_max_batch_size;unsigned long wq_max_xfer_size;int ats_disable; +char device_type[3 ];int is_batch;int is_evl_test;test/dsa_test.c index a4aad29..6eaf8cb renamed from test/dsa_test.c +0
-0100644
test/dsa_test.c int main(int argc, char *argv[]) · line 900
Quoted 4 lines
test/dsa_test.c +1
-0@@ -897,6 +897,7 @@ int main(int argc, char *argv[]) } dsa =acctest_init (tflags); +strncpy (dsa->device_type,"dsa" ,3 );
It's probably cleaner to convert string to device type enum here and then compare it against accfg_device_get_type() later on.
Maybe libaccel-config can export a helper function to convert device string to device type?
accfg_str_to_device_type()?
Quoted 15 lines
test/dsa_test.c +0
-0if (!dsa)return -ENOMEM ;test/iaa_test.c index a1f529d..74a6027 renamed from test/iaa_test.c +0
-0100644
test/iaa_test.c +1
-0@@ -643,6 +643,7 @@ int main(int argc, char *argv[]) } iaa =acctest_init (tflags); +strncpy (iaa->device_type,"iax" ,3 );if (!iaa)return -ENOMEM ;