Re: [Accel-config] [PATCH v2 2/2] accel-config/test: Fix bug about finding a mismatched wq
Dave Jiang <[email protected]> Thu, 11 May 2023 09:48:57 -0700
| Newsgroups | dev.linux.lists.accel-config |
|---|---|
| Message-ID | <[email protected]> |
On 5/11/23 1:13 AM, 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]> > --- > 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(+) > > diff --git a/test/accel_test.c b/test/accel_test.c > index 7bbe780..d8fd70f 100644 > --- a/test/accel_test.c > +++ b/test/accel_test.c > @@ -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) > diff --git a/test/accel_test.h b/test/accel_test.h > index 3b41a78..17d4097 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; > + char device_type[3]; > > int is_batch; > int is_evl_test; > diff --git a/test/dsa_test.c b/test/dsa_test.c > index a4aad29..6eaf8cb 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); > + 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()? > > if (!dsa) > return -ENOMEM; > diff --git a/test/iaa_test.c b/test/iaa_test.c > index a1f529d..74a6027 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); > + strncpy(iaa->device_type, "iax", 3); > > if (!iaa) > return -ENOMEM;