Re: [Accel-config] [PATCH v3 2/2] accel-config/test: Fix bug about finding a mismatched wq

Dave Jiang <[email protected]> Fri, 12 May 2023 08:51:15 -0700
Newsgroups dev.linux.lists.accel-config
Message-ID <[email protected]>

On 5/11/23 10:31 PM, Rex Zhang wrote:
> 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]>

Simple ans straight forward.

Reviewed-by: Dave Jiang <[email protected]>

> ---
>   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(+)
> 
> diff --git a/test/accel_test.c b/test/accel_test.c
> index 7bbe780..61d9944 100644
> --- a/test/accel_test.c
> +++ b/test/accel_test.c
> @@ -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)
> diff --git a/test/accel_test.h b/test/accel_test.h
> index 3b41a78..f152850 100644
> --- a/test/accel_test.h
> +++ b/test/accel_test.h
> @@ -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;
> diff --git a/test/dsa_test.c b/test/dsa_test.c
> index a4aad29..31cb964 100644
> --- a/test/dsa_test.c
> +++ b/test/dsa_test.c
> @@ -897,6 +897,7 @@ int main(int argc, char *argv[])
>   	}
>   
>   	dsa = acctest_init(tflags);
> +	dsa->dev_type = ACCFG_DEVICE_DSA;
>   
>   	if (!dsa)
>   		return -ENOMEM;
> diff --git a/test/iaa_test.c b/test/iaa_test.c
> index a1f529d..c682009 100644
> --- a/test/iaa_test.c
> +++ b/test/iaa_test.c
> @@ -643,6 +643,7 @@ int main(int argc, char *argv[])
>   	}
>   
>   	iaa = acctest_init(tflags);
> +	iaa->dev_type = ACCFG_DEVICE_IAX;
>   
>   	if (!iaa)
>   		return -ENOMEM;