Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1510195

Re: [Qemu-devel] [PATCH v9 04/12] vfio iommu: Add support for mediated devices

From Kirti Wankhede <kwankhede@nvidia.com>
Newsgroups linux.kernel
Subject Re: [Qemu-devel] [PATCH v9 04/12] vfio iommu: Add support for mediated devices
Date 2016-10-27 16:00 +0200
Message-ID <swTnS-2Bn-133@gated-at.bofh.it> (permalink)
References <stnDQ-JF-5@gated-at.bofh.it> <stnDQ-JF-25@gated-at.bofh.it> <swNiq-7bf-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw



On 10/27/2016 12:50 PM, Alexey Kardashevskiy wrote:
> On 18/10/16 08:22, Kirti Wankhede wrote:
>> VFIO IOMMU drivers are designed for the devices which are IOMMU capable.
>> Mediated device only uses IOMMU APIs, the underlying hardware can be
>> managed by an IOMMU domain.
>>
>> Aim of this change is:
>> - To use most of the code of TYPE1 IOMMU driver for mediated devices
>> - To support direct assigned device and mediated device in single module
>>
>> Added two new callback functions to struct vfio_iommu_driver_ops. Backend
>> IOMMU module that supports pining and unpinning pages for mdev devices
>> should provide these functions.
>> Added APIs for pining and unpining pages to VFIO module. These calls back
>> into backend iommu module to actually pin and unpin pages.
>>
>> This change adds pin and unpin support for mediated device to TYPE1 IOMMU
>> backend module. More details:
>> - When iommu_group of mediated devices is attached, task structure is
>>   cached which is used later to pin pages and page accounting.
> 
> 
> For SPAPR TCE IOMMU driver, I ended up caching mm_struct with
> atomic_inc(&container->mm->mm_count) (patches are on the way) instead of
> using @current or task as the process might be gone while VFIO container is
> still alive and @mm might be needed to do proper cleanup; this might not be
> an issue with this patchset now but still you seem to only use @mm from
> task_struct.
> 

Consider the example of QEMU process which creates VFIO container, QEMU
in its teardown path would release the container. How could container be
alive when process is gone?

Kirti

> 
> 
>> - It keeps track of pinned pages for mediated domain. This data is used to
>>   verify unpinning request and to unpin remaining pages while detaching, if
>>   there are any.
>> - Used existing mechanism for page accounting. If iommu capable domain
>>   exist in the container then all pages are already pinned and accounted.
>>   Accouting for mdev device is only done if there is no iommu capable
>>   domain in the container.
>> - Page accouting is updated on hot plug and unplug mdev device and pass
>>   through device.
>>
>> Tested by assigning below combinations of devices to a single VM:
>> - GPU pass through only
>> - vGPU device only
>> - One GPU pass through and one vGPU device
>> - Linux VM hot plug and unplug vGPU device while GPU pass through device
>>   exist
>> - Linux VM hot plug and unplug GPU pass through device while vGPU device
>>   exist
>>
>> Signed-off-by: Kirti Wankhede <kwankhede@nvidia.com>
>> Signed-off-by: Neo Jia <cjia@nvidia.com>
>> Change-Id: I295d6f0f2e0579b8d9882bfd8fd5a4194b97bd9a
> 
> 

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v9 00/12] Add Mediated device support Kirti Wankhede <kwankhede@nvidia.com> - 2016-10-17 23:30 +0200
  [PATCH v9 10/12] vfio: Add function to get device_api string from vfio_device_info.flags Kirti Wankhede <kwankhede@nvidia.com> - 2016-10-17 23:30 +0200
    Re: [PATCH v9 10/12] vfio: Add function to get device_api string  from vfio_device_info.flags Alex Williamson <alex.williamson@redhat.com> - 2016-10-20 21:40 +0200
      Re: [PATCH v9 10/12] vfio: Add function to get device_api string from  vfio_device_info.flags Kirti Wankhede <kwankhede@nvidia.com> - 2016-10-20 22:40 +0200
        Re: [PATCH v9 10/12] vfio: Add function to get device_api string  from vfio_device_info.flags Alex Williamson <alex.williamson@redhat.com> - 2016-10-20 23:10 +0200
          Re: [PATCH v9 10/12] vfio: Add function to get device_api string from  vfio_device_info.flags Kirti Wankhede <kwankhede@nvidia.com> - 2016-10-20 23:20 +0200
            Re: [PATCH v9 10/12] vfio: Add function to get device_api string  from vfio_device_info.flags Alex Williamson <alex.williamson@redhat.com> - 2016-10-20 23:30 +0200
              Re: [PATCH v9 10/12] vfio: Add function to get device_api string from  vfio_device_info.flags Kirti Wankhede <kwankhede@nvidia.com> - 2016-10-21 05:10 +0200
                Re: [PATCH v9 10/12] vfio: Add function to get device_api string  from vfio_device_info.flags Alex Williamson <alex.williamson@redhat.com> - 2016-10-21 05:30 +0200
  [PATCH v9 02/12] vfio: VFIO based driver for Mediated devices Kirti Wankhede <kwankhede@nvidia.com> - 2016-10-17 23:30 +0200
    RE: [PATCH v9 02/12] vfio: VFIO based driver for Mediated devices "Tian, Kevin" <kevin.tian@intel.com> - 2016-10-26 09:00 +0200
      Re: [PATCH v9 02/12] vfio: VFIO based driver for Mediated devices Kirti Wankhede <kwankhede@nvidia.com> - 2016-10-26 17:10 +0200
  [PATCH v9 08/12] vfio_pci: Updated to use vfio_set_irqs_validate_and_prepare() Kirti Wankhede <kwankhede@nvidia.com> - 2016-10-17 23:30 +0200
  [PATCH v9 11/12] docs: Add Documentation for Mediated devices Kirti Wankhede <kwankhede@nvidia.com> - 2016-10-17 23:30 +0200
    Re: [PATCH v9 11/12] docs: Add Documentation for Mediated devices Alex Williamson <alex.williamson@redhat.com> - 2016-10-25 18:20 +0200
  [PATCH v9 09/12] vfio_platform: Updated to use vfio_set_irqs_validate_and_prepare() Kirti Wankhede <kwankhede@nvidia.com> - 2016-10-17 23:30 +0200
  [PATCH v9 04/12] vfio iommu: Add support for mediated devices Kirti Wankhede <kwankhede@nvidia.com> - 2016-10-17 23:30 +0200
    Re: [PATCH v9 04/12] vfio iommu: Add support for mediated devices Alex Williamson <alex.williamson@redhat.com> - 2016-10-19 23:10 +0200
      Re: [PATCH v9 04/12] vfio iommu: Add support for mediated devices Kirti Wankhede <kwankhede@nvidia.com> - 2016-10-20 22:20 +0200
        Re: [PATCH v9 04/12] vfio iommu: Add support for mediated devices Alex Williamson <alex.williamson@redhat.com> - 2016-10-24 04:40 +0200
          RE: [PATCH v9 04/12] vfio iommu: Add support for mediated devices "Tian, Kevin" <kevin.tian@intel.com> - 2016-10-26 09:30 +0200
            Re: [PATCH v9 04/12] vfio iommu: Add support for mediated devices Kirti Wankhede <kwankhede@nvidia.com> - 2016-10-26 17:10 +0200
      RE: [PATCH v9 04/12] vfio iommu: Add support for mediated devices "Tian, Kevin" <kevin.tian@intel.com> - 2016-10-26 10:00 +0200
        Re: [PATCH v9 04/12] vfio iommu: Add support for mediated devices Alex Williamson <alex.williamson@redhat.com> - 2016-10-26 17:30 +0200
      RE: [PATCH v9 04/12] vfio iommu: Add support for mediated devices "Tian, Kevin" <kevin.tian@intel.com> - 2016-10-26 10:00 +0200
        Re: [PATCH v9 04/12] vfio iommu: Add support for mediated devices Alex Williamson <alex.williamson@redhat.com> - 2016-10-26 17:20 +0200
    Re: [PATCH v9 04/12] vfio iommu: Add support for mediated devices Jike Song <jike.song@intel.com> - 2016-10-21 10:00 +0200
      Re: [PATCH v9 04/12] vfio iommu: Add support for mediated devices Alex Williamson <alex.williamson@redhat.com> - 2016-10-21 16:40 +0200
        Re: [PATCH v9 04/12] vfio iommu: Add support for mediated devices Kirti Wankhede <kwankhede@nvidia.com> - 2016-10-24 12:40 +0200
    Re: [Qemu-devel] [PATCH v9 04/12] vfio iommu: Add support for  mediated devices Alexey Kardashevskiy <aik@ozlabs.ru> - 2016-10-27 09:30 +0200
      Re: [Qemu-devel] [PATCH v9 04/12] vfio iommu: Add support for  mediated devices Kirti Wankhede <kwankhede@nvidia.com> - 2016-10-27 16:00 +0200
        Re: [Qemu-devel] [PATCH v9 04/12] vfio iommu: Add support for  mediated devices Alex Williamson <alex.williamson@redhat.com> - 2016-10-27 16:40 +0200
          Re: [Qemu-devel] [PATCH v9 04/12] vfio iommu: Add support for  mediated devices Kirti Wankhede <kwankhede@nvidia.com> - 2016-10-27 18:00 +0200
        Re: [Qemu-devel] [PATCH v9 04/12] vfio iommu: Add support for  mediated devices Alexey Kardashevskiy <aik@ozlabs.ru> - 2016-10-28 04:40 +0200
          Re: [Qemu-devel] [PATCH v9 04/12] vfio iommu: Add support for  mediated devices Kirti Wankhede <kwankhede@nvidia.com> - 2016-11-01 15:10 +0100
            Re: [Qemu-devel] [PATCH v9 04/12] vfio iommu: Add support for  mediated devices Alexey Kardashevskiy <aik@ozlabs.ru> - 2016-11-02 02:30 +0100
              Re: [Qemu-devel] [PATCH v9 04/12] vfio iommu: Add support for  mediated devices Kirti Wankhede <kwankhede@nvidia.com> - 2016-11-02 04:40 +0100
                Re: [Qemu-devel] [PATCH v9 04/12] vfio iommu: Add support for  mediated devices Alexey Kardashevskiy <aik@ozlabs.ru> - 2016-11-02 05:20 +0100
                Re: [Qemu-devel] [PATCH v9 04/12] vfio iommu: Add support for mediated  devices Jike Song <jike.song@intel.com> - 2016-11-02 13:30 +0100
                Re: [Qemu-devel] [PATCH v9 04/12] vfio iommu: Add support for  mediated devices Kirti Wankhede <kwankhede@nvidia.com> - 2016-11-02 13:50 +0100
                Re: [Qemu-devel] [PATCH v9 04/12] vfio iommu: Add support for mediated  devices Jike Song <jike.song@intel.com> - 2016-11-02 14:10 +0100
                Re: [Qemu-devel] [PATCH v9 04/12] vfio iommu: Add support for  mediated devices Kirti Wankhede <kwankhede@nvidia.com> - 2016-11-02 14:30 +0100
                Re: [Qemu-devel] [PATCH v9 04/12] vfio iommu: Add support for mediated  devices Jike Song <jike.song@intel.com> - 2016-11-02 14:40 +0100
                Re: [Qemu-devel] [PATCH v9 04/12] vfio iommu: Add support for  mediated devices Alexey Kardashevskiy <aik@ozlabs.ru> - 2016-11-03 05:40 +0100
  [PATCH v9 06/12] vfio_pci: Update vfio_pci to use vfio_info_add_capability() Kirti Wankhede <kwankhede@nvidia.com> - 2016-10-17 23:30 +0200
    Re: [PATCH v9 06/12] vfio_pci: Update vfio_pci to use  vfio_info_add_capability() Alex Williamson <alex.williamson@redhat.com> - 2016-10-20 21:30 +0200
      Re: [PATCH v9 06/12] vfio_pci: Update vfio_pci to use  vfio_info_add_capability() Kirti Wankhede <kwankhede@nvidia.com> - 2016-10-24 23:30 +0200
        Re: [PATCH v9 06/12] vfio_pci: Update vfio_pci to use  vfio_info_add_capability() Alex Williamson <alex.williamson@redhat.com> - 2016-10-24 23:40 +0200
  [PATCH v9 03/12] vfio: Rearrange functions to get vfio_group from dev Kirti Wankhede <kwankhede@nvidia.com> - 2016-10-17 23:30 +0200
    Re: [PATCH v9 03/12] vfio: Rearrange functions to get vfio_group  from dev Alex Williamson <alex.williamson@redhat.com> - 2016-10-19 19:30 +0200
  [PATCH v9 05/12] vfio: Introduce common function to add capabilities Kirti Wankhede <kwankhede@nvidia.com> - 2016-10-17 23:30 +0200
    Re: [PATCH v9 05/12] vfio: Introduce common function to add  capabilities Alex Williamson <alex.williamson@redhat.com> - 2016-10-20 21:30 +0200
      Re: [PATCH v9 05/12] vfio: Introduce common function to add  capabilities Kirti Wankhede <kwankhede@nvidia.com> - 2016-10-24 23:30 +0200
        Re: [PATCH v9 05/12] vfio: Introduce common function to add  capabilities Alex Williamson <alex.williamson@redhat.com> - 2016-10-24 23:40 +0200
  [PATCH v9 01/12] vfio: Mediated device Core driver Kirti Wankhede <kwankhede@nvidia.com> - 2016-10-17 23:30 +0200
    Re: [PATCH v9 01/12] vfio: Mediated device Core driver Alex Williamson <alex.williamson@redhat.com> - 2016-10-19 01:20 +0200
      Re: [PATCH v9 01/12] vfio: Mediated device Core driver Kirti Wankhede <kwankhede@nvidia.com> - 2016-10-19 21:20 +0200
        Re: [PATCH v9 01/12] vfio: Mediated device Core driver Alex Williamson <alex.williamson@redhat.com> - 2016-10-20 00:30 +0200
    Re: [PATCH v9 01/12] vfio: Mediated device Core driver Jike Song <jike.song@intel.com> - 2016-10-20 09:30 +0200
      Re: [PATCH v9 01/12] vfio: Mediated device Core driver Alex Williamson <alex.williamson@redhat.com> - 2016-10-20 19:20 +0200
        Re: [PATCH v9 01/12] vfio: Mediated device Core driver Jike Song <jike.song@intel.com> - 2016-10-21 04:50 +0200
        Re: [PATCH v9 01/12] vfio: Mediated device Core driver Jike Song <jike.song@intel.com> - 2016-10-27 08:10 +0200
    RE: [PATCH v9 01/12] vfio: Mediated device Core driver "Tian, Kevin" <kevin.tian@intel.com> - 2016-10-26 09:00 +0200
      Re: [PATCH v9 01/12] vfio: Mediated device Core driver Kirti Wankhede <kwankhede@nvidia.com> - 2016-10-26 17:00 +0200
  Re: [PATCH v9 00/12] Add Mediated device support Alex Williamson <alex.williamson@redhat.com> - 2016-10-17 23:50 +0200
  Re: [PATCH v9 12/12] docs: Sample driver to demonstrate how to use  Mediated device framework. Alex Williamson <alex.williamson@redhat.com> - 2016-10-18 19:20 +0200
    Re: [PATCH v9 12/12] docs: Sample driver to demonstrate how to use  Mediated device framework. Kirti Wankhede <kwankhede@nvidia.com> - 2016-10-19 21:20 +0200
  Re: [PATCH v9 00/12] Add Mediated device support Jike Song <jike.song@intel.com> - 2016-10-24 09:20 +0200

csiph-web