Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1637283imm; Wed, 1 Aug 2018 21:09:11 -0700 (PDT) X-Google-Smtp-Source: AAOMgpc8xA33IKwQURai6hDMpIlgrIoX20UyPED5Jh0e20LyIpAQqwaeYIFlOsyozegjR2lhgNMz X-Received: by 2002:a17:902:6a83:: with SMTP id n3-v6mr926608plk.246.1533182951812; Wed, 01 Aug 2018 21:09:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533182951; cv=none; d=google.com; s=arc-20160816; b=oEpxjKh6jUnenqYkfcnH5AGVfXUZjNaVrMkf4ZNTZXQ8Ii7bKdBPmM7jpLdKykomF3 YklU51+JdiffYKxgllVTc6SPopJJr/wDZ+sczdcPm6LC8Ps2x5BtxkNbmL0vg8e3GOaR W4CADaMFGfWUx/QZo5iyJqNNfIJ8QFllGwv0EZnkIXpZIGKZwCBt9bmoPOkMdzsJ+X3N 97OMIFjjcZOVNt9xgEe+grddhyY4l3AhdevSCSlD40oJ41sC5+Be/esc2SGg9tjEYo4c 5Kc1eN+1Dxfcyi9MBcPJRosZp5kN+4wEsmd7dNBbLveSfIwrKH79fjC2C03urjRqj30b p9Aw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date :arc-authentication-results; bh=2Hj6wvYq3BWPSjTs6aQ7fzfwVyrg0xXWqEeIbskx96Q=; b=crrw8hiQUeM83zcMQIXmyICuGl2Uz9XYHJOpX1/b0K/GaJM0O0JW9z1cvudmEg+lF+ ajCuguqI7gWq1ihzIcSnXtYG1YWYfATQQqt8E9YlRwilkQ+IZ+Ta14ZQDzZ6TGZJqF2u /sNauGAIhymgEeuYySpWhdpArg1YQN8rVx8wVpAtEiptpG2QXupEKutqRbejn2KIL6D9 E13kR8NMEArq493cotMjxetrqYGlCT0b/07TUxKd6YJHVl+d0hfkR3I+U71FZBkUQPQt ++7ySAlkEvDRLrv/T9qTtmrXCj48EZhe5F6YcA1byjugB+5GjmfQzPR4X6NwPLq98QIJ J1sQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z6-v6si570169plo.503.2018.08.01.21.08.56; Wed, 01 Aug 2018 21:09:11 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726948AbeHBF4e (ORCPT + 99 others); Thu, 2 Aug 2018 01:56:34 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:59105 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725765AbeHBF4e (ORCPT ); Thu, 2 Aug 2018 01:56:34 -0400 Received: from DGGEMS412-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id A15245EE55BE4; Thu, 2 Aug 2018 12:07:21 +0800 (CST) Received: from localhost (10.67.212.75) by DGGEMS412-HUB.china.huawei.com (10.3.19.212) with Microsoft SMTP Server (TLS) id 14.3.399.0; Thu, 2 Aug 2018 12:07:15 +0800 Date: Thu, 2 Aug 2018 12:05:57 +0800 From: Kenneth Lee To: "Tian, Kevin" CC: Jerome Glisse , Kenneth Lee , "Hao Fang" , Herbert Xu , "kvm@vger.kernel.org" , Jonathan Corbet , Greg Kroah-Hartman , "linux-doc@vger.kernel.org" , "Kumar, Sanjay K" , "iommu@lists.linux-foundation.org" , "linux-kernel@vger.kernel.org" , "linuxarm@huawei.com" , Alex Williamson , Thomas Gleixner , "linux-crypto@vger.kernel.org" , Philippe Ombredanne , Zaibo Xu , "David S . Miller" , "linux-accelerators@lists.ozlabs.org" Subject: Re: [RFC PATCH 0/7] A General Accelerator Framework, WarpDrive Message-ID: <20180802040557.GL160746@Turing-Arch-b> References: <20180801102221.5308-1-nek.in.cn@gmail.com> <20180801165644.GA3820@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-Originating-IP: [10.67.212.75] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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" > To: Jerome Glisse , Kenneth Lee > CC: Hao Fang , Herbert Xu > , "kvm@vger.kernel.org" > , Jonathan Corbet , Greg > Kroah-Hartman , "linux-doc@vger.kernel.org" > , "Kumar, Sanjay K" , > "iommu@lists.linux-foundation.org" , > "linux-kernel@vger.kernel.org" , > "linuxarm@huawei.com" , Alex Williamson > , Thomas Gleixner , > "linux-crypto@vger.kernel.org" , Philippe > Ombredanne , Zaibo Xu , Kenneth > Lee , "David S . Miller" , > "linux-accelerators@lists.ozlabs.org" > > Subject: RE: [RFC PATCH 0/7] A General Accelerator Framework, WarpDrive > Message-ID: > > > From: Jerome Glisse > > Sent: Thursday, August 2, 2018 12:57 AM > > > > On Wed, Aug 01, 2018 at 06:22:14PM +0800, Kenneth Lee wrote: > > > From: Kenneth Lee > > > > > > WarpDrive is an accelerator framework to expose the hardware > > capabilities > > > 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 > > > 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. > > > > 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. > > 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. > > > > 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. > > > > 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!