From: Kenneth Lee <email@example.com> To: Alex Williamson <firstname.lastname@example.org> Cc: Kenneth Lee <email@example.com>, "Tian, Kevin" <firstname.lastname@example.org>, Kenneth Lee <email@example.com>, Jonathan Corbet <firstname.lastname@example.org>, Herbert Xu <email@example.com>, "David S . Miller" <firstname.lastname@example.org>, Joerg Roedel <email@example.com>, Hao Fang <firstname.lastname@example.org>, Zhou Wang <email@example.com>, Zaibo Xu <firstname.lastname@example.org>, Philippe Ombredanne <email@example.com>, "Greg Kroah-Hartman" <firstname.lastname@example.org>, Thomas Gleixner <email@example.com>, "firstname.lastname@example.org" <email@example.com>, "firstname.lastname@example.org" <email@example.com>, "firstname.lastname@example.org" <email@example.com>, "firstname.lastname@example.org" <email@example.com>, "firstname.lastname@example.org" <email@example.com>, "firstname.lastname@example.org" <email@example.com>, Lu Baolu <firstname.lastname@example.org>, <email@example.com>, <firstname.lastname@example.org>, Cornelia Huck <email@example.com> Subject: Re: [RFC PATCH 3/7] vfio: add spimdev support Date: Mon, 6 Aug 2018 09:40:04 +0800 Message-ID: <20180806014004.GF91035@Turing-Arch-b> (raw) In-Reply-To: <firstname.lastname@example.org> On Thu, Aug 02, 2018 at 12:43:27PM -0600, Alex Williamson wrote: > Date: Thu, 2 Aug 2018 12:43:27 -0600 > From: Alex Williamson <email@example.com> > To: Cornelia Huck <firstname.lastname@example.org> > CC: Kenneth Lee <email@example.com>, "Tian, Kevin" > <firstname.lastname@example.org>, Kenneth Lee <email@example.com>, Jonathan Corbet > <firstname.lastname@example.org>, Herbert Xu <email@example.com>, "David S . > Miller" <firstname.lastname@example.org>, Joerg Roedel <email@example.com>, Hao Fang > <firstname.lastname@example.org>, Zhou Wang <email@example.com>, Zaibo Xu > <firstname.lastname@example.org>, Philippe Ombredanne <email@example.com>, "Greg > Kroah-Hartman" <firstname.lastname@example.org>, Thomas Gleixner > <email@example.com>, "firstname.lastname@example.org" > <email@example.com>, "firstname.lastname@example.org" > <email@example.com>, "firstname.lastname@example.org" > <email@example.com>, "firstname.lastname@example.org" > <email@example.com>, "firstname.lastname@example.org" > <email@example.com>, "firstname.lastname@example.org\" > <email@example.com>, Lu Baolu > <firstname.lastname@example.org>, Kumar", <Sanjay K " > <email@example.com>, " firstname.lastname@example.org " > <email@example.com>"> > Subject: Re: [RFC PATCH 3/7] vfio: add spimdev support > Message-ID: <firstname.lastname@example.org> > > On Thu, 2 Aug 2018 10:35:28 +0200 > Cornelia Huck <email@example.com> wrote: > > > On Thu, 2 Aug 2018 15:34:40 +0800 > > Kenneth Lee <firstname.lastname@example.org> wrote: > > > > > On Thu, Aug 02, 2018 at 04:24:22AM +0000, Tian, Kevin wrote: > > > > > > > From: Kenneth Lee [mailto:email@example.com] > > > > > Sent: Thursday, August 2, 2018 11:47 AM > > > > > > > > > > > > > > > > > > From: Kenneth Lee > > > > > > > Sent: Wednesday, August 1, 2018 6:22 PM > > > > > > > > > > > > > > From: Kenneth Lee <firstname.lastname@example.org> > > > > > > > > > > > > > > SPIMDEV is "Share Parent IOMMU Mdev". It is a vfio-mdev. But differ > > > > > from > > > > > > > the general vfio-mdev: > > > > > > > > > > > > > > 1. It shares its parent's IOMMU. > > > > > > > 2. There is no hardware resource attached to the mdev is created. The > > > > > > > hardware resource (A `queue') is allocated only when the mdev is > > > > > > > opened. > > > > > > > > > > > > Alex has concern on doing so, as pointed out in: > > > > > > > > > > > > https://www.spinics.net/lists/kvm/msg172652.html > > > > > > > > > > > > resource allocation should be reserved at creation time. > > > > > > > > > > Yes. That is why I keep telling that SPIMDEV is not for "VM", it is for "many > > > > > processes", it is just an access point to the process. Not a device to VM. I > > > > > hope > > > > > Alex can accept it:) > > > > > > > > > > > > > VFIO is just about assigning device resource to user space. It doesn't care > > > > whether it's native processes or VM using the device so far. Along the direction > > > > which you described, looks VFIO needs to support the configuration that > > > > some mdevs are used for native process only, while others can be used > > > > for both native and VM. I'm not sure whether there is a clean way to > > > > enforce it... > > > > > > I had the same idea at the beginning. But finally I found that the life cycle > > > of the virtual device for VM and process were different. Consider you create > > > some mdevs for VM use, you will give all those mdevs to lib-virt, which > > > distribute those mdev to VMs or containers. If the VM or container exits, the > > > mdev is returned to the lib-virt and used for next allocation. It is the > > > administrator who controlled every mdev's allocation. > > Libvirt currently does no management of mdev devices, so I believe > this example is fictitious. The extent of libvirt's interaction with > mdev is that XML may specify an mdev UUID as the source for a hostdev > and set the permissions on the device files appropriately. Whether > mdevs are created in advance and re-used or created and destroyed > around a VM instance (for example via qemu hooks scripts) is not a > policy that libvirt imposes. > > > > But for process, it is different. There is no lib-virt in control. The > > > administrator's intension is to grant some type of application to access the > > > hardware. The application can get a handle of the hardware, send request and get > > > the result. That's all. He/She dose not care which mdev is allocated to that > > > application. If it crashes, it should be the kernel's responsibility to withdraw > > > the resource, the system administrator does not want to do it by hand. > > Libvirt is also not a required component for VM lifecycles, it's an > optional management interface, but there are also VM lifecycles exactly > as you describe. A VM may want a given type of vGPU, there might be > multiple sources of that type and any instance is fungible to any > other. Such an mdev can be dynamically created, assigned to the VM, > and destroyed later. Why do we need to support "empty" mdevs that do > not reserve reserve resources until opened? The concept of available > instances is entirely lost with that approach and it creates an > environment that's difficult to support, resources may not be available > at the time the user attempts to access them. > > > I don't think that you should distinguish the cases by the presence of > > a management application. How can the mdev driver know what the > > intention behind using the device is? > > Absolutely, vfio is a userspace driver interface, it's not tailored to > VM usage and we cannot know the intentions of the user. > > > Would it make more sense to use a different mechanism to enforce that > > applications only use those handles they are supposed to use? Maybe > > cgroups? I don't think it's a good idea to push usage policy into the > > kernel. > > I agree, this sounds like a userspace problem, mdev supports dynamic > creation and removal of mdev devices, if there's an issue with > maintaining a set of standby devices that a user has access to, this > sounds like a userspace broker problem. It makes more sense to me to > have a model where a userspace application can make a request to a > broker and the broker can reply with "none available" rather than > having a set of devices on standby that may or may not work depending > on the system load and other users. Thanks, > > Alex I am sorry, I used a wrong mutt command when reply to Cornelia's last mail. The last reply dose not stay within this thread. So please let me repeat my point here. I should not have use libvirt as the example. But WarpDrive works in such scenario: 1. It supports thousands of processes. Take zip accelerator as an example, any application need data compression/decompression will need to interact with the accelerator. To support that, you have to create tens of thousands of mdev for their usage. I don't think it is a good idea to have so many devices in the system. 2. The application does not want to own the mdev for long. It just need an access point for the hardware service. If it has to interact with an management agent for allocation and release, this makes the problem complex. 3. The service is bound with the process. When the process exit, the resource should be released automatically. Kernel is the best place to monitor the state of the process. I agree this extending the concept of mdev. But again, it is cleaner than creating another facility for user land DMA. We just need to take mdev as an access point of the device: when it is open, the resource is given. It is not a device for a particular entity or instance. But it is still a device which can provide service of the hardware. Cornelia is worrying about resource starving. I think that can be solved by set restriction on the mdev itself. Mdev management agent dose not help much here. Management on the mdev itself can still lead to the status of running out of resource. Thanks -- -Kenneth(Hisilicon) ================================================================================ 本邮件及其附件含有华为公司的保密信息，仅限于发送给上面地址中列出的个人或群组。禁 止任何其他人以任何形式使用（包括但不限于全部或部分地泄露、复制、或散发）本邮件中 的信息。如果您错收了本邮件，请您立即电话或邮件通知发件人并删除本邮件！ This e-mail and its attachments contain confidential information from HUAWEI, which is intended only for the person or entity whose address is listed above. Any use of the information contained herein in any way (including, but not limited to, total or partial disclosure, reproduction, or dissemination) by persons other than the intended recipient(s) is prohibited. If you receive this e-mail in error, please notify the sender by phone or email immediately and delete it!
next prev parent reply index Thread overview: 61+ messages / expand[flat|nested] mbox.gz Atom feed top 2018-08-01 10:22 [RFC PATCH 0/7] A General Accelerator Framework, WarpDrive Kenneth Lee 2018-08-01 10:22 ` [RFC PATCH 1/7] vfio/spimdev: Add documents for WarpDrive framework Kenneth Lee 2018-08-02 3:14 ` Tian, Kevin 2018-08-02 4:22 ` Kenneth Lee 2018-08-02 4:41 ` Tian, Kevin 2018-08-06 12:27 ` Pavel Machek 2018-08-08 1:43 ` Kenneth Lee 2018-08-01 10:22 ` [RFC PATCH 2/7] iommu: Add share domain interface in iommu for spimdev Kenneth Lee 2018-08-02 3:17 ` Tian, Kevin 2018-08-02 4:15 ` Kenneth Lee 2018-08-02 4:39 ` Tian, Kevin 2018-08-08 9:13 ` Joerg Roedel 2018-08-09 1:09 ` Kenneth Lee 2018-08-01 10:22 ` [RFC PATCH 3/7] vfio: add spimdev support Kenneth Lee 2018-08-01 16:23 ` Randy Dunlap 2018-08-02 3:07 ` Kenneth Lee 2018-08-02 3:21 ` Tian, Kevin 2018-08-02 3:47 ` Kenneth Lee 2018-08-02 4:24 ` Tian, Kevin 2018-08-02 7:34 ` Kenneth Lee [not found] ` <email@example.com> [not found] ` <firstname.lastname@example.org> 2018-08-06 1:40 ` Kenneth Lee [this message] 2018-08-06 15:49 ` Alex Williamson 2018-08-06 16:34 ` Raj, Ashok 2018-08-06 17:05 ` Alex Williamson 2018-08-08 1:32 ` Kenneth Lee 2018-08-01 10:22 ` [RFC PATCH 4/7] crypto: add hisilicon Queue Manager driver Kenneth Lee 2018-08-01 10:22 ` [RFC PATCH 5/7] crypto: Add Hisilicon Zip driver Kenneth Lee 2018-08-01 10:22 ` [RFC PATCH 6/7] crypto: add spimdev support to Hisilicon QM Kenneth Lee 2018-08-01 10:22 ` [RFC PATCH 7/7] vfio/spimdev: add user sample for spimdev Kenneth Lee 2018-08-01 16:56 ` [RFC PATCH 0/7] A General Accelerator Framework, WarpDrive Jerome Glisse 2018-08-02 2:33 ` Tian, Kevin 2018-08-02 4:05 ` Kenneth Lee 2018-08-02 14:22 ` Jerome Glisse 2018-08-03 3:47 ` Kenneth Lee 2018-08-03 14:39 ` Jerome Glisse 2018-08-06 3:12 ` Kenneth Lee 2018-08-06 15:32 ` Jerome Glisse 2018-08-08 1:08 ` Kenneth Lee 2018-08-08 15:18 ` Jerome Glisse 2018-08-09 8:03 ` Kenneth Lee 2018-08-09 8:31 ` Tian, Kevin 2018-08-10 1:37 ` Kenneth Lee 2018-08-09 14:46 ` Jerome Glisse 2018-08-10 3:39 ` Kenneth Lee 2018-08-10 13:12 ` Jean-Philippe Brucker 2018-08-11 15:26 ` Kenneth Lee 2018-08-13 9:29 ` Kenneth Lee 2018-08-13 19:23 ` Jerome Glisse 2018-08-14 3:46 ` Kenneth Lee 2018-08-10 14:32 ` Jerome Glisse 2018-08-11 14:44 ` Kenneth Lee 2018-08-02 10:10 ` Alan Cox 2018-08-02 12:24 ` Xu Zaibo 2018-08-02 14:46 ` Jerome Glisse 2018-08-03 14:20 ` Alan Cox 2018-08-03 14:55 ` Jerome Glisse 2018-08-06 1:26 ` Kenneth Lee 2018-08-02 2:59 ` Tian, Kevin 2018-08-02 3:40 ` Kenneth Lee 2018-08-02 4:36 ` Tian, Kevin 2018-08-02 5:35 ` Kenneth Lee
Reply instructions: You may reply publically 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=20180806014004.GF91035@Turing-Arch-b \ --email@example.com \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ /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
LKML Archive on lore.kernel.org Archives are clonable: git clone --mirror https://lore.kernel.org/lkml/0 lkml/git/0.git git clone --mirror https://lore.kernel.org/lkml/1 lkml/git/1.git git clone --mirror https://lore.kernel.org/lkml/2 lkml/git/2.git git clone --mirror https://lore.kernel.org/lkml/3 lkml/git/3.git git clone --mirror https://lore.kernel.org/lkml/4 lkml/git/4.git git clone --mirror https://lore.kernel.org/lkml/5 lkml/git/5.git git clone --mirror https://lore.kernel.org/lkml/6 lkml/git/6.git git clone --mirror https://lore.kernel.org/lkml/7 lkml/git/7.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 lkml lkml/ https://lore.kernel.org/lkml \ email@example.com public-inbox-index lkml Example config snippet for mirrors Newsgroup available over NNTP: nntp://nntp.lore.kernel.org/org.kernel.vger.linux-kernel AGPL code for this site: git clone https://public-inbox.org/public-inbox.git