Received: by 2002:ac0:8c9a:0:0:0:0:0 with SMTP id r26csp163843ima; Fri, 1 Feb 2019 01:10:40 -0800 (PST) X-Google-Smtp-Source: ALg8bN5+FtHBbzZhFEX0Mjl2E7fCuEKDZz29VfH4+4cBVDARyxVol6nD9KCOMtdhTX3BIw+DK7Pw X-Received: by 2002:a62:5b44:: with SMTP id p65mr38030183pfb.47.1549012240933; Fri, 01 Feb 2019 01:10:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549012240; cv=none; d=google.com; s=arc-20160816; b=qtrdzT9DbUN7vteNDwlh5Yg1NXqd4bjOt60k3OjBPo7yAxgU+fKdnHjd7pQSepV9pd c6VUyNIcIflkmyySeIqgPpZoZA6I3XcX420kPPmRviwyOWDSMlG9thMaeOM9XqS0qmFx Bg/253V9L9+NH6mIR0wPQODD2l4zsxTlpzMOBHmIEE9j/X+R4YtSu51cwpWxFfKm5t93 ZlpNQZnaUKCRxOmSXYui2em1+S2oL1Y6CvI273QpoRkjoj+5J+dBWaIK12WjnqK+7QZw SeO4PhGReijYhfNSoE0g+fiGm5m+zee7/k+q0OrScc1R5bfGJ2M7CXw4JtcCta5+rOYy qiLQ== 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-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=5nrVkZimXeTwVuWnC4BSRMaaURrvjA2qrxLLlySyrDY=; b=V59UYmm5Tc+JQlle4ixG9R0eOYFaY7V189TFrlOta5Nir+0xB3iPutGLHxvQwqh75C ZuiCdYUlopB9HMTcPzCmp8lvlWTI1exjjOwrNbmyRIFsx8fK/q39h0QrlGkO+1y7bL5N z1svbLSqHeOscMf7aJUlA40UepVPQYl6uxrDPHhq2UwEmmYDsX5pCO1Cu8psG9Nhrg/K zG9X99BCHiNy2yjIIt7x4LEblkre7EgLtJgzXnUS8Sr2PRhvxIUoulTgLQKLKAgoepo5 XqsNLipHfB5jnk/asNf47qw5QHVmadBRPMTVYSDfTCv0MqSTxJ0FOMt1gOSFa/NSkg+c 9z6A== 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 p80si6656484pfi.124.2019.02.01.01.10.24; Fri, 01 Feb 2019 01:10:40 -0800 (PST) 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 S1728774AbfBAJKC (ORCPT + 99 others); Fri, 1 Feb 2019 04:10:02 -0500 Received: from szxga06-in.huawei.com ([45.249.212.32]:37932 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726628AbfBAJKC (ORCPT ); Fri, 1 Feb 2019 04:10:02 -0500 Received: from DGGEMS402-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 56DCC67A0A162710358D; Fri, 1 Feb 2019 17:10:00 +0800 (CST) Received: from localhost (10.67.212.75) by DGGEMS402-HUB.china.huawei.com (10.3.19.202) with Microsoft SMTP Server (TLS) id 14.3.408.0; Fri, 1 Feb 2019 17:09:56 +0800 Date: Fri, 1 Feb 2019 17:10:40 +0800 From: Kenneth Lee To: Olof Johansson CC: , , Greg Kroah-Hartman , , Andrew Donnellan , Frederic Barrat , , , Subject: Re: [PATCH/RFC 0/5] HW accel subsystem Message-ID: <20190201091040.GA159470@Turing-Arch-b> References: <20190125181616.62609-1-olof@lixom.net> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <20190125181616.62609-1-olof@lixom.net> 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 Fri, Jan 25, 2019 at 10:16:11AM -0800, Olof Johansson wrote: > Date: Fri, 25 Jan 2019 10:16:11 -0800 > From: Olof Johansson > To: linux-kernel@vger.kernel.org > CC: ogabbay@habana.ai, Greg Kroah-Hartman , > jglisse@redhat.com, Andrew Donnellan , > Frederic Barrat , airlied@redhat.com, > linux-accelerators@lists.ozlabs.org > Subject: [PATCH/RFC 0/5] HW accel subsystem > X-Mailer: git-send-email 2.11.0 > Message-ID: <20190125181616.62609-1-olof@lixom.net> > > Per discussion in on the Habana Labs driver submission > (https://lore.kernel.org/lkml/20190123000057.31477-1-oded.gabbay@gmail.com/), > there seems to be time to create a separate subsystem for hw accellerators > instead of letting them proliferate around the tree (and/or in misc). > > There's difference in opinion on how stringent the requirements are for > a fully open stack for these kind of drivers. I've documented the middle > road approach in the first patch (requiring some sort of open low-level > userspace for the kernel interaction, and a way to use/test it). > > Comments and suggestions for better approaches are definitely welcome. Dear Olof, How are you? Let me introduce myself. My name is Kenenth Lee, working for Hisilicon. Our company provide server, AI, networking and terminal SoCs to the market. We tried to create an accelerator framework a year back and now we are working on the branch here (There is document in Documentation/warpdrive directory): https://github.com/Kenneth-Lee/linux-kernel-warpdrive/tree/wdprd-v1 The user space framework is here: https://github.com/Kenneth-Lee/warpdrive/tree/wdprd-v1 We have tried to create it on VFIO at the very beginning. The RFCv1 is here: https://lwn.net/Articles/763990/ But it seems it is not fit. There are two major issues: 1. The VFIO framework enforces the concept of separating the resource into devices before using it. This is not an accelerator style. Accelerator is another CPU to let the others to share it. 2. The way VFIO used to pin memory in place, has some flaw. In the current kernel, if you fork a sub-rpcess after pin the dma memory, you may lost the physical pages. (You can get more detail in the threads) So we tried RFCv2 and build the solution directly on IOMMU. We call our solution as WarpDrive and the kernel module is called uacce. Our assumption is that: 1. Most of users of the accelerator are in user space. 2. An accelerator is always another heterogeneous processor. It is waiting and processing work load sent from CPU. 3. The data structure in the CPU may be complex. It is no good to wrap the data and send it to hardware again and again. The better way is to keep the data in place and give a pointer to the accelerator, leaving it to finish the job. So we create a pipe (we called it queue) between the user process and the hardware directly. It is presented as a file to the user space. The user process mmap the queue file to address the mmio space of the hardware, share memory and so on. With the capability of IOMMU, we can share the whole or part of process space with the hardware. This can make the software solution easier. After the RFCv2 was sent to the lkml, we do not get much feedback. But the Infini-band guys said they did not like it. They think the solution is re-invention of ib-verbs. But we do not think so. ib-verbs maintains semantics of "REMOTE memory". But UACCE maintains semantics of "LOCAL memory". We don't need to send, or sync memory with other parties. We share those memory with all processes who share the local bus. But we know we need more "complete" solution to let people understand and accept our idea. So now we are working on it with our Compression and RSA accelerator on Hi1620 Server SoC. We are also planning to port our AI framework on it. Do you think we can cooperate to create an framework in Linux together? Please feel free to ask for more information. We are happy to answer it. Cheers -- -Kenneth(Hisilicon)