[PATCH 00/10] Connect VFIO to IOMMUFD

Yi Liu yi.l.liu at intel.com
Mon Oct 31 12:25:39 UTC 2022


On 2022/10/31 20:18, Jason Gunthorpe wrote:
> On Mon, Oct 31, 2022 at 06:38:45PM +0800, Yi Liu wrote:
>> Hi Jason,
>>
>> On 2022/10/26 02:17, Jason Gunthorpe wrote:
>>> This series provides an alternative container layer for VFIO implemented
>>> using iommufd. This is optional, if CONFIG_IOMMUFD is not set then it will
>>> not be compiled in.
>>>
>>> At this point iommufd can be injected by passing in a iommfd FD to
>>> VFIO_GROUP_SET_CONTAINER which will use the VFIO compat layer in iommufd
>>> to obtain the compat IOAS and then connect up all the VFIO drivers as
>>> appropriate.
>>>
>>> This is temporary stopping point, a following series will provide a way to
>>> directly open a VFIO device FD and directly connect it to IOMMUFD using
>>> native ioctls that can expose the IOMMUFD features like hwpt, future
>>> vPASID and dynamic attachment.
>>>
>>> This series, in compat mode, has passed all the qemu tests we have
>>> available, including the test suites for the Intel GVT mdev. Aside from
>>> the temporary limitation with P2P memory this is belived to be fully
>>> compatible with VFIO.
>>>
>>> This is on github: https://github.com/jgunthorpe/linux/commits/vfio_iommufd
>>
>> In our side, we found the gvt-g test failed. Guest i915 driver stuck at
>> init phase. While with your former version  (commit ID
>> a249441ba6fd9d658f4a1b568453e3a742d12686), gvt-g test is passing.
> 
> Oh, I didn't realize you grabbed such an older version for this testing..

yeah, this was grabbed before your posting. :-)

>> noticed there a quite a few change in iommufd/pages.c from last version.
>> We are internally tracing in the gvt-g side, may also good to have your
>> attention.
> 
> syzkaller just ran into this that I was starting to investigate:
> 
> @@ -1505,7 +1505,7 @@ int iopt_pages_fill_xarray(struct iopt_pages *pages, unsigned long start_index,
>          int rc;
>   
>          pfn_reader_user_init(&user, pages);
> -       user.upages_len = last_index - start_index + 1;
> +       user.upages_len = (last_index - start_index + 1) * sizeof(*out_pages);
>          interval_tree_for_each_double_span(&span, &pages->access_itree,
> 
> It would certainly hit gvt - but you should get WARN_ON's not hangs
> 
> There is something wrong with the test suite that it isn't covering
> the above, I'm going to look into that today.

sounds to be the cause. I didn't see any significant change in vfio_main.c
that may fail gvt. So should the iommufd changes. Then we will re-run the
test after your update.:-)

-- 
Regards,
Yi Liu


More information about the dri-devel mailing list