From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 042DAA046B for ; Fri, 23 Aug 2019 11:12:19 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 6ACD71BF98; Fri, 23 Aug 2019 11:12:18 +0200 (CEST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id D63A11BF91 for ; Fri, 23 Aug 2019 11:12:16 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 23 Aug 2019 02:12:15 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,420,1559545200"; d="scan'208";a="208488852" Received: from aburakov-mobl1.ger.corp.intel.com (HELO [10.237.220.108]) ([10.237.220.108]) by fmsmga002.fm.intel.com with ESMTP; 23 Aug 2019 02:12:14 -0700 To: "Chaitanya Babu, TalluriX" , "dev@dpdk.org" Cc: "Pattan, Reshma" , "Parthasarathy, JananeeX M" References: <1566392575-7965-1-git-send-email-tallurix.chaitanya.babu@intel.com> <1566474836-30480-4-git-send-email-tallurix.chaitanya.babu@intel.com> <55dcdf32-0c8a-0d0c-1b07-8619327be911@intel.com> <761FB0F2AB727F4FA9CE98D18810B0155B55F4A5@BGSMSX102.gar.corp.intel.com> From: "Burakov, Anatoly" Message-ID: Date: Fri, 23 Aug 2019 10:12:11 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <761FB0F2AB727F4FA9CE98D18810B0155B55F4A5@BGSMSX102.gar.corp.intel.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH v2 3/3] app/test: add unit tests for eal vfio X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On 23-Aug-19 8:57 AM, Chaitanya Babu, TalluriX wrote: > Hi Anatoly, > >> -----Original Message----- >> From: Burakov, Anatoly >> Sent: Thursday, August 22, 2019 5:45 PM >> To: Chaitanya Babu, TalluriX ; >> dev@dpdk.org >> Cc: Pattan, Reshma ; Parthasarathy, JananeeX M >> >> Subject: Re: [PATCH v2 3/3] app/test: add unit tests for eal vfio >> >> On 22-Aug-19 12:53 PM, Chaitanya Babu Talluri wrote: >>> Unit test cases are added for eal vfio library. >>> eal_vfio_autotest added to meson build file. >>> >>> Signed-off-by: Chaitanya Babu Talluri >>> >>> --- >> >> I think the suggestion to check if VFIO is enabled was a good one. There is an >> API to do that - i think you can do >> >> rte_vfio_is_enabled("vfio_pci") >> >> and if returns 0, you can return TEST_SKIPPED straight away. > > rte_vfio_is_enabled() checks whether vfio module is loaded and container fd is created. > > The below error occurs even when the iommu type of vfio_cfg is not set. > Ideally iommu _type is set only during device probe. > Since device is not binded, iommu type is not set. > > In order to skip the test in such scenario (vfio module is loaded but device not binded), > we need to check the device count/groups of the default container. > > Currently there is no RTE APIs to fetch the default vfio_cfg structure in order to check the active vfio_cfgs.vfio_active_groups / vfio_cfgs.vfio_iommu_type of the default container. > > Please let us know whether we can enhance any API in this regard. I don't quite like the idea of adding a new API just to enable pass/skip of unit tests. However, i don't think we have a choice here - i can't see any other way than to check if IOMMU type is set. So perhaps int rte_vfio_iommu_type_is_set() API could be added to enable graceful skipping for this test. >> >>> app/test/Makefile | 1 + >>> app/test/meson.build | 2 + >>> app/test/test_eal_vfio.c | 728 >> +++++++++++++++++++++++++++++++++++++++ >>> 3 files changed, 731 insertions(+) >>> create mode 100644 app/test/test_eal_vfio.c >>> >>> diff --git a/app/test/Makefile b/app/test/Makefile >> >> >> >>> +static int >>> +test_eal_vfio(void) >>> +{ >>> + printf("VFIO not supported, skipping test\n"); >>> + return TEST_SKIPPED; >>> +} >>> + >>> +#else >>> + >>> +#define PAGESIZE sysconf(_SC_PAGESIZE) #define >> INVALID_CONTAINER_FD >>> +-5 #define THREE_PAGES 3 #define UNMAPPED_ADDR 0x1500 >> >> UNMAPPED_ADDR is not 4K-aligned and will probably trigger other errors >> regarding page alignment checks. I suggest making it either 4K-aligned (e.g. >> 0x2000), or explicitly align it (e.g. RTE_ALIGN(0x1500, PAGESIZE)). > > Tests were added to check page un-aligned address. > The IOCTL fails as expected. > > Please let us know whether we need to remove this. Ah, so it's *intentionally* unaligned! In that case, maybe "UNALIGNED_ADDR" is a better name? >> >> >> -- >> Thanks, >> Anatoly -- Thanks, Anatoly