[dpdk-dev] [PATCH v2 3/3] app/test: add unit tests for eal vfio
anatoly.burakov at intel.com
Fri Aug 23 11:12:11 CEST 2019
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 <tallurix.chaitanya.babu at intel.com>;
>> dev at dpdk.org
>> Cc: Pattan, Reshma <reshma.pattan at intel.com>; Parthasarathy, JananeeX M
>> <jananeex.m.parthasarathy at intel.com>
>> 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
>>> <tallurix.chaitanya.babu at intel.com>
>> 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
>> 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
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
>>> + printf("VFIO not supported, skipping test\n");
>>> + return TEST_SKIPPED;
>>> +#define PAGESIZE sysconf(_SC_PAGESIZE) #define
>>> +-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?
More information about the dev