All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lu Baolu <baolu.lu@linux.intel.com>
To: Keqian Zhu <zhukeqian1@huawei.com>,
	Shenming Lu <lushenming@huawei.com>,
	"Tian, Kevin" <kevin.tian@intel.com>,
	Alex Williamson <alex.williamson@redhat.com>
Cc: baolu.lu@linux.intel.com, Cornelia Huck <cohuck@redhat.com>,
	"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Jean-Philippe Brucker <jean-philippe@linaro.org>,
	Eric Auger <eric.auger@redhat.com>,
	"wanghaibin.wang@huawei.com" <wanghaibin.wang@huawei.com>,
	"yuzenghui@huawei.com" <yuzenghui@huawei.com>,
	"Liu, Yi L" <yi.l.liu@intel.com>,
	"Pan, Jacob jun" <jacob.jun.pan@intel.com>
Subject: Re: [RFC PATCH v1 0/4] vfio: Add IOPF support for VFIO passthrough
Date: Sat, 20 Mar 2021 09:35:55 +0800	[thread overview]
Message-ID: <993b34b0-a68e-87eb-854d-ce926db8702b@linux.intel.com> (raw)
In-Reply-To: <4327b3ac-858d-30d0-9fe4-bd4ccc0fbd40@huawei.com>

On 3/19/21 9:30 AM, Keqian Zhu wrote:
> Hi Baolu,
> 
> On 2021/3/19 8:33, Lu Baolu wrote:
>> On 3/18/21 7:53 PM, Shenming Lu wrote:
>>> On 2021/3/18 17:07, Tian, Kevin wrote:
>>>>> From: Shenming Lu<lushenming@huawei.com>
>>>>> Sent: Thursday, March 18, 2021 3:53 PM
>>>>>
>>>>> On 2021/2/4 14:52, Tian, Kevin wrote:>>> In reality, many
>>>>>>>> devices allow I/O faulting only in selective contexts. However, there
>>>>>>>> is no standard way (e.g. PCISIG) for the device to report whether
>>>>>>>> arbitrary I/O fault is allowed. Then we may have to maintain device
>>>>>>>> specific knowledge in software, e.g. in an opt-in table to list devices
>>>>>>>> which allows arbitrary faults. For devices which only support selective
>>>>>>>> faulting, a mediator (either through vendor extensions on vfio-pci-core
>>>>>>>> or a mdev wrapper) might be necessary to help lock down non-faultable
>>>>>>>> mappings and then enable faulting on the rest mappings.
>>>>>>> For devices which only support selective faulting, they could tell it to the
>>>>>>> IOMMU driver and let it filter out non-faultable faults? Do I get it wrong?
>>>>>> Not exactly to IOMMU driver. There is already a vfio_pin_pages() for
>>>>>> selectively page-pinning. The matter is that 'they' imply some device
>>>>>> specific logic to decide which pages must be pinned and such knowledge
>>>>>> is outside of VFIO.
>>>>>>
>>>>>>   From enabling p.o.v we could possibly do it in phased approach. First
>>>>>> handles devices which tolerate arbitrary DMA faults, and then extends
>>>>>> to devices with selective-faulting. The former is simpler, but with one
>>>>>> main open whether we want to maintain such device IDs in a static
>>>>>> table in VFIO or rely on some hints from other components (e.g. PF
>>>>>> driver in VF assignment case). Let's see how Alex thinks about it.
>>>>> Hi Kevin,
>>>>>
>>>>> You mentioned selective-faulting some time ago. I still have some doubt
>>>>> about it:
>>>>> There is already a vfio_pin_pages() which is used for limiting the IOMMU
>>>>> group dirty scope to pinned pages, could it also be used for indicating
>>>>> the faultable scope is limited to the pinned pages and the rest mappings
>>>>> is non-faultable that should be pinned and mapped immediately? But it
>>>>> seems to be a little weird and not exactly to what you meant... I will
>>>>> be grateful if you can help to explain further.:-)
>>>>>
>>>> The opposite, i.e. the vendor driver uses vfio_pin_pages to lock down
>>>> pages that are not faultable (based on its specific knowledge) and then
>>>> the rest memory becomes faultable.
>>> Ahh...
>>> Thus, from the perspective of VFIO IOMMU, if IOPF enabled for such device,
>>> only the page faults within the pinned range are valid in the registered
>>> iommu fault handler...
>> Isn't it opposite? The pinned pages will never generate any page faults.
>> I might miss some contexts here.
> It seems that vfio_pin_pages() just pin some pages and record the pinned scope to pfn_list of vfio_dma.
> No mapping is established, so we still has page faults.

Make sense. Thanks a lot for the explanation.

> 
> IIUC, vfio_pin_pages() is used to
> 1. pin pages for non-iommu backed devices.
> 2. mark dirty scope for non-iommu backed devices and iommu backed devices.

Best regards,
baolu

      reply	other threads:[~2021-03-20  1:46 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-25  9:03 [RFC PATCH v1 0/4] vfio: Add IOPF support for VFIO passthrough Shenming Lu
2021-01-25  9:03 ` [RFC PATCH v1 1/4] vfio/type1: Add a bitmap to track IOPF mapped pages Shenming Lu
2021-01-29 22:58   ` Alex Williamson
2021-01-30  9:31     ` Shenming Lu
2021-01-25  9:04 ` [RFC PATCH v1 2/4] vfio: Add a page fault handler Shenming Lu
2021-01-27 17:42   ` Christoph Hellwig
2021-01-28  6:10     ` Shenming Lu
2021-01-25  9:04 ` [RFC PATCH v1 3/4] vfio: Try to enable IOPF for VFIO devices Shenming Lu
2021-01-26 14:33   ` kernel test robot
2021-01-27  6:31   ` kernel test robot
2021-01-29 22:42   ` Alex Williamson
2021-01-30  9:31     ` Shenming Lu
2021-01-25  9:04 ` [RFC PATCH v1 4/4] vfio: Allow to pin and map dynamically Shenming Lu
2021-01-29 22:57 ` [RFC PATCH v1 0/4] vfio: Add IOPF support for VFIO passthrough Alex Williamson
2021-01-30  9:30   ` Shenming Lu
2021-02-01  7:56   ` Tian, Kevin
2021-02-02  6:41     ` Shenming Lu
2021-02-04  6:52       ` Tian, Kevin
2021-02-05 10:37         ` Jean-Philippe Brucker
2021-02-07  8:20           ` Tian, Kevin
2021-02-07 11:47             ` Shenming Lu
2021-02-09 11:06         ` Liu, Yi L
2021-02-10  8:02           ` Shenming Lu
2021-03-18  7:53         ` Shenming Lu
2021-03-18  9:07           ` Tian, Kevin
2021-03-18 11:53             ` Shenming Lu
2021-03-18 12:32               ` Tian, Kevin
2021-03-18 12:47                 ` Shenming Lu
2021-03-19  0:33               ` Lu Baolu
2021-03-19  1:30                 ` Keqian Zhu
2021-03-20  1:35                   ` Lu Baolu [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=993b34b0-a68e-87eb-854d-ce926db8702b@linux.intel.com \
    --to=baolu.lu@linux.intel.com \
    --cc=alex.williamson@redhat.com \
    --cc=cohuck@redhat.com \
    --cc=eric.auger@redhat.com \
    --cc=jacob.jun.pan@intel.com \
    --cc=jean-philippe@linaro.org \
    --cc=kevin.tian@intel.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lushenming@huawei.com \
    --cc=wanghaibin.wang@huawei.com \
    --cc=yi.l.liu@intel.com \
    --cc=yuzenghui@huawei.com \
    --cc=zhukeqian1@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.