Thread (56 messages) 56 messages, 10 authors, 2018-08-14

Re: [RFC PATCH 0/7] A General Accelerator Framework, WarpDrive

From: Kenneth Lee <hidden>
Date: 2018-08-02 04:07:29
Also in: kvm, linux-crypto, linux-iommu, lkml

On Thu, Aug 02, 2018 at 02:33:12AM +0000, Tian, Kevin wrote:
Date: Thu, 2 Aug 2018 02:33:12 +0000
From: "Tian, Kevin" <kevin.tian@intel.com>
To: Jerome Glisse <redacted>, Kenneth Lee <redacted>
CC: Hao Fang <redacted>, Herbert Xu
 [off-list ref], "kvm@vger.kernel.org"
 [off-list ref], Jonathan Corbet [off-list ref], Greg
 Kroah-Hartman [off-list ref], "linux-doc@vger.kernel.org"
 [off-list ref], "Kumar, Sanjay K" [off-list ref],
 "iommu@lists.linux-foundation.org" [off-list ref],
 "linux-kernel@vger.kernel.org" [off-list ref],
 "linuxarm@huawei.com" [off-list ref], Alex Williamson
 [off-list ref], Thomas Gleixner [off-list ref],
 "linux-crypto@vger.kernel.org" [off-list ref], Philippe
 Ombredanne [off-list ref], Zaibo Xu [off-list ref], Kenneth
 Lee [off-list ref], "David S . Miller" [off-list ref],
 "linux-accelerators@lists.ozlabs.org"
 [off-list ref]
Subject: RE: [RFC PATCH 0/7] A General Accelerator Framework, WarpDrive
Message-ID: [ref]
quoted
From: Jerome Glisse
Sent: Thursday, August 2, 2018 12:57 AM

On Wed, Aug 01, 2018 at 06:22:14PM +0800, Kenneth Lee wrote:
quoted
From: Kenneth Lee <redacted>

WarpDrive is an accelerator framework to expose the hardware
capabilities
quoted
directly to the user space. It makes use of the exist vfio and vfio-mdev
facilities. So the user application can send request and DMA to the
hardware without interaction with the kernel. This remove the latency
of syscall and context switch.

The patchset contains documents for the detail. Please refer to it for
more
quoted
information.

This patchset is intended to be used with Jean Philippe Brucker's SVA
patch [1] (Which is also in RFC stage). But it is not mandatory. This
patchset is tested in the latest mainline kernel without the SVA patches.
So it support only one process for each accelerator.

With SVA support, WarpDrive can support multi-process in the same
accelerator device.  We tested it in our SoC integrated Accelerator (board
ID: D06, Chip ID: HIP08). A reference work tree can be found here: [2].
I have not fully inspected things nor do i know enough about
this Hisilicon ZIP accelerator to ascertain, but from glimpsing
at the code it seems that it is unsafe to use even with SVA due
to the doorbell. There is a comment talking about safetyness
in patch 7.

Exposing thing to userspace is always enticing, but if it is
a security risk then it should clearly say so and maybe a
kernel boot flag should be necessary to allow such device to
be use.
But doorbell is just a notification. Except for DOS (to make hardware busy) it
cannot actually take or change anything from the kernel space. And the DOS
problem can be always taken as the problem that a group of processes share the
same kernel entity.

In the coming HIP09 hardware, the doorbell will come with a random number so
only the process who allocated the queue can knock it correctly.
quoted
My more general question is do we want to grow VFIO to become
a more generic device driver API. This patchset adds a command
queue concept to it (i don't think it exist today but i have
not follow VFIO closely).
The thing is, VFIO is the only place to support DMA from user land. If we don't
put it here, we have to create another similar facility to support the same.
quoted
Why is that any better that existing driver model ? Where a
device create a device file (can be character device, block
device, ...). Such models also allow for direct hardware
access from userspace. For instance see the AMD KFD driver
inside drivers/gpu/drm/amd
One motivation I guess, is that most accelerators lack of a 
well-abstracted high level APIs similar to GPU side (e.g. OpenCL 
clearly defines Shared Virtual Memory models). VFIO mdev
might be an alternative common interface to enable SVA usages 
on various accelerators...
Yes.
quoted
So you can already do what you are doing with the Hisilicon
driver today without this new infrastructure. This only need
hardware that have command queue and doorbell like mechanisms.


Unlike mdev which unify a very high level concept, it seems
to me spimdev just introduce low level concept (namely command
queue) and i don't see the intrinsic value here.
As I have said, VFIO is the only place support DMA from user space now.
quoted
Cheers,
Jérôme
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu
-- 
			-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!

--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help