Return-Path: Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by lists.linuxfoundation.org (Postfix) with ESMTP id 656B2C002A for ; Thu, 11 May 2023 16:49:08 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 3FBFB4046A for ; Thu, 11 May 2023 16:49:08 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 3FBFB4046A Authentication-Results: smtp2.osuosl.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=dhv0n32V X-Virus-Scanned: amavisd-new at osuosl.org X-Spam-Flag: NO X-Spam-Score: -4.402 X-Spam-Level: X-Spam-Status: No, score=-4.402 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, NICE_REPLY_A=-0.001, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id xlRh-2nZ4wpo for ; Thu, 11 May 2023 16:49:07 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 8579C401B7 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by smtp2.osuosl.org (Postfix) with ESMTPS id 8579C401B7 for ; Thu, 11 May 2023 16:49:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1683823747; x=1715359747; h=message-id:date:mime-version:subject:to:references:from: in-reply-to:content-transfer-encoding; bh=9MZF8kihbtYPWPWr6v5mvd46S5Vez+XbOXYufVDjkkk=; b=dhv0n32VKcLOLEWDRCBoNJ/FebCbhSAPArgs2k2fBltrXuyNY5qOE98u 7mrOSw238c8LyNbLWa4S2fC2k0qGeSF7AOxtOpDG+0raxuofvemOy/mHw RXkqtR8IrDVuPWG6ZICO7im8AWVrUPf3VAeVqwQmjz3UcOKV8dloJh12v 9fOm1z1Gd2dxFYve2Jmkd2gy3lC6WSk5Yb6RSGklKxhpNPXBu2+beiyxc zjbaDIGSdg7SkY4lBkIzG+02h4lPFXmfm9Qp90jgx+51pnKunf93X3ePE pi0i4oVRVbIpWjwZBAJXWlSJR5wdVZeUsKTF4RXCFn9xfJuVxKtUllymH g==; X-IronPort-AV: E=McAfee;i="6600,9927,10707"; a="349400176" X-IronPort-AV: E=Sophos;i="5.99,268,1677571200"; d="scan'208";a="349400176" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 May 2023 09:48:58 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10707"; a="764819305" X-IronPort-AV: E=Sophos;i="5.99,268,1677571200"; d="scan'208";a="764819305" Received: from djiang5-mobl3.amr.corp.intel.com (HELO [10.212.95.11]) ([10.212.95.11]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 May 2023 09:48:57 -0700 Message-ID: <22e933d1-2657-aa89-c491-38fcd7b7822b@intel.com> Date: Thu, 11 May 2023 09:48:57 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Firefox/102.0 Thunderbird/102.10.0 Content-Language: en-US To: Rex Zhang , fenghua.yu@intel.com, ramesh.thomas@intel.com, tony.zhu@intel.com, accel-config@lists.linuxfoundation.org References: <20230511081306.3907992-1-rex.zhang@intel.com> <20230511081306.3907992-2-rex.zhang@intel.com> From: Dave Jiang In-Reply-To: <20230511081306.3907992-2-rex.zhang@intel.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Accel-config] [PATCH v2 2/2] accel-config/test: Fix bug about finding a mismatched wq X-BeenThere: accel-config@lists.linuxfoundation.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: accel-config List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 May 2023 16:49:08 -0000 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 > --- > 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;