From: Kenneth Lee <email@example.com> To: Jerome Glisse <firstname.lastname@example.org> Cc: Kenneth Lee <email@example.com>, "Tian, Kevin" <firstname.lastname@example.org>, Alex Williamson <email@example.com>, Herbert Xu <firstname.lastname@example.org>, "email@example.com" <firstname.lastname@example.org>, Jonathan Corbet <email@example.com>, Greg Kroah-Hartman <firstname.lastname@example.org>, Zaibo Xu <email@example.com>, "firstname.lastname@example.org" <email@example.com>, "Kumar, Sanjay K" <firstname.lastname@example.org>, Hao Fang <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>, "Philippe Ombredanne" <firstname.lastname@example.org>, Thomas Gleixner <email@example.com>, "David S . Miller" <firstname.lastname@example.org>, "email@example.com" <firstname.lastname@example.org> Subject: Re: [RFC PATCH 0/7] A General Accelerator Framework, WarpDrive Date: Fri, 10 Aug 2018 11:39:13 +0800 Message-ID: <20180810033913.GK91035@Turing-Arch-b> (raw) In-Reply-To: <20180809144613.GB3386@redhat.com> On Thu, Aug 09, 2018 at 10:46:13AM -0400, Jerome Glisse wrote: > Date: Thu, 9 Aug 2018 10:46:13 -0400 > From: Jerome Glisse <email@example.com> > To: Kenneth Lee <firstname.lastname@example.org> > CC: Kenneth Lee <email@example.com>, "Tian, Kevin" > <firstname.lastname@example.org>, Alex Williamson <email@example.com>, > Herbert Xu <firstname.lastname@example.org>, "email@example.com" > <firstname.lastname@example.org>, Jonathan Corbet <email@example.com>, Greg > Kroah-Hartman <firstname.lastname@example.org>, Zaibo Xu <email@example.com>, > "firstname.lastname@example.org" <email@example.com>, "Kumar, Sanjay K" > <firstname.lastname@example.org>, Hao Fang <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>, Philippe > Ombredanne <firstname.lastname@example.org>, Thomas Gleixner <email@example.com>, > "David S . Miller" <firstname.lastname@example.org>, > "email@example.com" > <firstname.lastname@example.org> > Subject: Re: [RFC PATCH 0/7] A General Accelerator Framework, WarpDrive > User-Agent: Mutt/1.10.0 (2018-05-17) > Message-ID: <20180809144613.GB3386@redhat.com> > > On Thu, Aug 09, 2018 at 04:03:52PM +0800, Kenneth Lee wrote: > > On Wed, Aug 08, 2018 at 11:18:35AM -0400, Jerome Glisse wrote: > > > On Wed, Aug 08, 2018 at 09:08:42AM +0800, Kenneth Lee wrote: > > > > 在 2018年08月06日 星期一 11:32 下午, Jerome Glisse 写道: > > > > > On Mon, Aug 06, 2018 at 11:12:52AM +0800, Kenneth Lee wrote: > > > > > > On Fri, Aug 03, 2018 at 10:39:44AM -0400, Jerome Glisse wrote: > > > > > > > On Fri, Aug 03, 2018 at 11:47:21AM +0800, Kenneth Lee wrote: > > > > > > > > On Thu, Aug 02, 2018 at 10:22:43AM -0400, Jerome Glisse wrote: > > > > > > > > > On Thu, Aug 02, 2018 at 12:05:57PM +0800, Kenneth Lee wrote: > > [...] > > > > > > > > > > your mechanisms the userspace must have a specific userspace > > > > > > > > > drivers for each hardware and thus there are virtually no > > > > > > > > > differences between having this userspace driver open a device > > > > > > > > > file in vfio or somewhere else in the device filesystem. This is > > > > > > > > > just a different path. > > > > > > > > > > > > > > > > > The basic problem WarpDrive want to solve it to avoid syscall. This is important > > > > > > > > to accelerators. We have some data here: > > > > > > > > https://www.slideshare.net/linaroorg/progress-and-demonstration-of-wrapdrive-a-accelerator-framework-sfo17317 > > > > > > > > > > > > > > > > (see page 3) > > > > > > > > > > > > > > > > The performance is different on using kernel and user drivers. > > > > > > > Yes and example i point to is exactly that. You have a one time setup > > > > > > > cost (creating command buffer binding PASID with command buffer and > > > > > > > couple other setup steps). Then userspace no longer have to do any > > > > > > > ioctl to schedule work on the GPU. It is all down from userspace and > > > > > > > it use a doorbell to notify hardware when it should go look at command > > > > > > > buffer for new thing to execute. > > > > > > > > > > > > > > My point stands on that. You have existing driver already doing so > > > > > > > with no new framework and in your scheme you need a userspace driver. > > > > > > > So i do not see the value add, using one path or the other in the > > > > > > > userspace driver is litteraly one line to change. > > > > > > > > > > > > > Sorry, I'd got confuse here. I partially agree that the user driver is > > > > > > redundance of kernel driver. (But for WarpDrive, the kernel driver is a full > > > > > > driver include all preparation and setup stuff for the hardware, the user driver > > > > > > is simply to send request and receive answer). Yes, it is just a choice of path. > > > > > > But the user path is faster if the request come from use space. And to do that, > > > > > > we need user land DMA support. Then why is it invaluable to let VFIO involved? > > > > > Some drivers in the kernel already do exactly what you said. The user > > > > > space emit commands without ever going into kernel by directly scheduling > > > > > commands and ringing a doorbell. They do not need VFIO either and they > > > > > can map userspace address into the DMA address space of the device and > > > > > again they do not need VFIO for that. > > > > Could you please directly point out which driver you refer to here? Thank > > > > you. > > > > > > drivers/gpu/drm/amd/ > > > > > > Sub-directory of interest is amdkfd > > > > > > Because it is a big driver here is a highlevel overview of how it works > > > (this is a simplification): > > > - Process can allocate GPUs buffer (through ioclt) and map them into > > > its address space (through mmap of device file at buffer object > > > specific offset). > > > - Process can map any valid range of virtual address space into device > > > address space (IOMMU mapping). This must be regular memory ie not an > > > mmap of a device file or any special file (this is the non PASID > > > path) > > > - Process can create a command queue and bind its process to it aka > > > PASID, this is done through an ioctl. > > > - Process can schedule commands onto queues it created from userspace > > > without ioctl. For that it just write command into a ring buffer > > > that it mapped during the command queue creation process and it > > > rings a doorbell when commands are ready to be consume by the > > > hardware. > > > - Commands can reference (access) all 3 types of object above ie > > > either full GPUs buffer, process regular memory maped as object > > > (non PASID) and PASID memory all at the same time ie you can > > > mix all of the above in same commands queue. > > > - Kernel can evict, unbind any process command queues, unbind commands > > > queue are still valid from process point of view but commands > > > process schedules on them will not be executed until kernel re-bind > > > the queue. > > > - Kernel can schedule commands itself onto its dedicated command > > > queues (kernel driver create its own command queues). > > > - Kernel can control priorities between all the queues ie it can > > > decides which queues should the hardware executed first next. > > > > > > > Thank you. Now I think I understand the point. Indeed, I can see some drivers, > > such GPU and IB, attach their own iommu_domain to their iommu_group and do their > > own iommu_map(). > > > > But we have another requirement which is to combine some device together to > > share the same address space. This is a little like these kinds of solution: > > > > http://tce.technion.ac.il/wp-content/uploads/sites/8/2015/06/SC-7.2-M.-Silberstein.pdf > > > > With that, the application can directly pass the NiC packet pointer to the > > decryption accelerator, and get the bare data in place. This is the feature that > > the VFIO container can provide. > > Yes and GPU would very much like do the same. There is already out of > tree solution that allow NiC to stream into GPU memory or GPU to stream > its memory to a NiC. I am sure we will want to use more accelerator in > conjunction with GPU in the future. > > > > > > I believe all of the above are the aspects that matters to you. The main > > > reason i don't like creating a new driver infrastructure is that a lot > > > of existing drivers will want to use some of the new features that are > > > coming (memory topology, where to place process memory, pipeline devices, > > > ...) and thus existing drivers are big (GPU drivers are the biggest of > > > all the kernel drivers). > > > > > > > I think it is not necessarily to rewrite the GPU driver if they don't need to > > share their space with others. But if they do, no matter how, they have to create > > some facility similar to VFIO container. Then why not just create them in VFIO? > > No they do not, nor does anyone needs to. We already have that. If you want > device to share memory object you have either: > - PASID and everything is just easy no need to create anything, as > all valid virtual address will work > - no PASID or one of the device does not support PASID then use the > existing kernel infrastructure aka dma buffer see Documentation/ > driver-api/dma-buf.rst > > Everything you want to do is already happening upstream and they are allready > working example. OK, I accept it. > > > Actually, some GPUs have already used mdev to manage the resource by different > > users, it is already part of VFIO. > > The current use of mdev with GPU is to "emulate" the SR_IOV of PCIE in > software so that a single device can be share between multiple guests. > For this using VFIO make sense, as we want to expose device as a single > entity that can be manage without the userspace (QEMU) having to know > or learn about each individual devices. > > QEMU just has a well define API to probe and attach device to guest. > It is the guest that have dedicated drivers for each of those mdev > devices. > Agree > > What you are trying to do is recreate a whole driver API inside the > VFIO subsystem and i do not see any valid reasons for that. Moreover > you want to restrict future use to only drivers that are part of this > new driver subsystem and again i do not see any good reasons to > mandate any of the existing driver to be rewritten inside a new VFIO > infrastructure. > I think you have persuaded me now. I thought VFIO was the only unified place to do user land DMA operations. So I tried to make use of it even there was facility I needed not. Thank you very much for the help. > > You can achieve everything you want to achieve with existing upstream > solution. Re-inventing a whole new driver infrastructure should really > be motivated with strong and obvious reasons. I want to understand better of your idea. If I create some unified helper APIs in drivers/iommu/, say: wd_create_dev(parent_dev, wd_dev) wd_release_dev(wd_dev) The API create chrdev to take request from user space for open(resource allocation), iomap, epoll (irq), and dma_map(with pasid automatically). Do you think it is acceptable? I agree that these all can be done with the driver itself. But without a unified interface, it is hard to create a user land ecosystem for accelerator to cooperate. > > Cheers, > Jérôme -- -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 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 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 [this message] 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=20180810033913.GK91035@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 \ /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 \ firstname.lastname@example.org email@example.com public-inbox-index lkml 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