Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp5433474ybl; Tue, 27 Aug 2019 04:45:33 -0700 (PDT) X-Google-Smtp-Source: APXvYqzdP8QU73e57lOvIBR9EV7J43Ia6oif7J4UYbh7XE6ILIzypQPnT5fg5TQswYcymU6iDZnG X-Received: by 2002:a17:90a:19c4:: with SMTP id 4mr25176706pjj.20.1566906333673; Tue, 27 Aug 2019 04:45:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566906333; cv=none; d=google.com; s=arc-20160816; b=RWZol6XAXX5MNbLLgzGAI56sH81QNka335b8a7sMDBeaVT1Gq4yyHQ1Ue6N6qVRWMq cMeHR2b+nvxBRxa1IbCZTf9PNvEqHhaPP74FfWe2/xxXBgKeX8pW63ys/X4BMtKjWnum iwauQJhKX5OVlu7xvTpBX/pgz37cWHiJG/FVeYLVP70gx8I6+gSPsLklbPDED2hUzT8q inmGUXll556b18dxOElD/UuqINjxzZDYpir3u10vQB2VGI+IsXErcrgCLpn1VKeBN8uy UXG/DjVQ8NogiN5uSv54gJMjM0G7h//vERx8deSON2bR71V/xfywrvDjOlUgfx80RQzB znqA== 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; bh=haE2C+6hwwkfy7a13L2suWKLdOLp84zRBweGhJsQTM0=; b=ev/4c1vCXHCqrzvQBQ47JOx0leE3ijbhBa6HIht/tv83PHF3YgMfx8svFdAvICxVEN F9BuuQ6jSQSYqKCL9zwn8Q/XRfgNT4kvMlbiggGx+Fl/YXxLBeg5qd7tp0sULTfUMmzU WzZUirK4CH21ls7zcVuAktvSKuplRwg/8vJ9Kgkg+BXsaFU5Y0DvpTk3OF8FwZMfDrsA vmIqGARzWfMv8wEbweGTe0ZcquK7lEUdYhu3R1UGj8rh/Te5ZtTd62cRg987OabJklH4 ly9sJajinjhe3P8aDLA0pw4GJsVIYDB0E9/zPsCfKwv5w031C4f/xEfkGJqJpTdwn9Vg IDvg== 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 t9si11815988pgv.225.2019.08.27.04.45.17; Tue, 27 Aug 2019 04:45:33 -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 S1728807AbfH0Lo1 (ORCPT + 99 others); Tue, 27 Aug 2019 07:44:27 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:44066 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726140AbfH0Lo1 (ORCPT ); Tue, 27 Aug 2019 07:44:27 -0400 Received: from DGGEMS410-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 342B896AE480CE040498; Tue, 27 Aug 2019 19:44:25 +0800 (CST) Received: from localhost (10.67.212.75) by DGGEMS410-HUB.china.huawei.com (10.3.19.210) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 27 Aug 2019 19:44:15 +0800 Date: Tue, 27 Aug 2019 19:42:08 +0800 From: Kenneth Lee To: Greg Kroah-Hartman CC: zhangfei , Arnd Bergmann , , , "Zaibo Xu" , Zhou Wang Subject: Re: [PATCH 2/2] uacce: add uacce module Message-ID: <20190827114208.GB116872@Turing-Arch-b> References: <1565775265-21212-3-git-send-email-zhangfei.gao@linaro.org> <20190815141351.GD23267@kroah.com> <6daab785-a8f9-684e-eb71-7a81604d3bb0@linaro.org> <20190820165947.GC3736@kroah.com> <5d5cf0fc.1c69fb81.ec57f.b853SMTPIN_ADDED_BROKEN@mx.google.com> <20190821091709.GA22914@kroah.com> <20190821160542.GA14760@kroah.com> <20190826041042.GB27955@Turing-Arch-b> <20190826042910.GA26547@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20190826042910.GA26547@kroah.com> 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 Mon, Aug 26, 2019 at 06:29:10AM +0200, Greg Kroah-Hartman wrote: > Date: Mon, 26 Aug 2019 06:29:10 +0200 > From: Greg Kroah-Hartman > To: Kenneth Lee > CC: zhangfei , Arnd Bergmann , > linux-accelerators@lists.ozlabs.org, linux-kernel@vger.kernel.org, Zaibo > Xu , Zhou Wang > Subject: Re: [PATCH 2/2] uacce: add uacce module > User-Agent: Mutt/1.12.1 (2019-06-15) > Message-ID: <20190826042910.GA26547@kroah.com> > > On Mon, Aug 26, 2019 at 12:10:42PM +0800, Kenneth Lee wrote: > > On Wed, Aug 21, 2019 at 09:05:42AM -0700, Greg Kroah-Hartman wrote: > > > Date: Wed, 21 Aug 2019 09:05:42 -0700 > > > From: Greg Kroah-Hartman > > > To: zhangfei > > > CC: Arnd Bergmann , linux-accelerators@lists.ozlabs.org, > > > linux-kernel@vger.kernel.org, Kenneth Lee , Zaibo > > > Xu , Zhou Wang > > > Subject: Re: [PATCH 2/2] uacce: add uacce module > > > User-Agent: Mutt/1.12.1 (2019-06-15) > > > Message-ID: <20190821160542.GA14760@kroah.com> > > > > > > On Wed, Aug 21, 2019 at 10:30:22PM +0800, zhangfei wrote: > > > > > > > > > > > > On 2019/8/21 下午5:17, Greg Kroah-Hartman wrote: > > > > > On Wed, Aug 21, 2019 at 03:21:18PM +0800, zhangfei.gao@foxmail.com wrote: > > > > > > Hi, Greg > > > > > > > > > > > > On 2019/8/21 上午12:59, Greg Kroah-Hartman wrote: > > > > > > > On Tue, Aug 20, 2019 at 09:08:55PM +0800, zhangfei wrote: > > > > > > > > On 2019/8/15 下午10:13, Greg Kroah-Hartman wrote: > > > > > > > > > On Wed, Aug 14, 2019 at 05:34:25PM +0800, Zhangfei Gao wrote: > > > > > > > > > > +int uacce_register(struct uacce *uacce) > > > > > > > > > > +{ > > > > > > > > > > + int ret; > > > > > > > > > > + > > > > > > > > > > + if (!uacce->pdev) { > > > > > > > > > > + pr_debug("uacce parent device not set\n"); > > > > > > > > > > + return -ENODEV; > > > > > > > > > > + } > > > > > > > > > > + > > > > > > > > > > + if (uacce->flags & UACCE_DEV_NOIOMMU) { > > > > > > > > > > + add_taint(TAINT_CRAP, LOCKDEP_STILL_OK); > > > > > > > > > > + dev_warn(uacce->pdev, > > > > > > > > > > + "Register to noiommu mode, which export kernel data to user space and may vulnerable to attack"); > > > > > > > > > > + } > > > > > > > > > THat is odd, why even offer this feature then if it is a major issue? > > > > > > > > UACCE_DEV_NOIOMMU maybe confusing here. > > > > > > > > > > > > > > > > In this mode, app use ioctl to get dma_handle from dma_alloc_coherent. > > > > > > > That's odd, why not use the other default apis to do that? > > > > > > > > > > > > > > > It does not matter iommu is enabled or not. > > > > > > > > In case iommu is disabled, it maybe dangerous to kernel, so we added warning here, is it required? > > > > > > > You should use the other documentated apis for this, don't create your > > > > > > > own. > > > > > > I am sorry, not understand here. > > > > > > Do you mean there is a standard ioctl or standard api in user space, it can > > > > > > get dma_handle from dma_alloc_coherent from kernel? > > > > > There should be a standard way to get such a handle from userspace > > > > > today. Isn't that what the ion interface does? DRM also does this, as > > > > > does UIO I think. > > > > Thanks Greg, > > > > Still not find it, will do more search. > > > > But this may introduce dependency in our lib, like depend on ion? > > > > > Do you have a spec somewhere that shows exactly what you are trying to > > > > > do here, along with example userspace code? It's hard to determine it > > > > > given you only have one "half" of the code here and no users of the apis > > > > > you are creating. > > > > > > > > > The purpose is doing dma in user space. > > > > > > Oh no, please no. Are you _SURE_ you want to do this? > > > > > > Again, look at how ION does this and how the DMAbuff stuff is replacing > > > it. Use that api please instead, otherwise you will get it wrong and we > > > don't want to duplicate efforts. > > > > > > thanks, > > > > > > greg k-h > > > > Dear Greg. I wrote a blog to explain the intention of WarpDrive here: > > https://zhuanlan.zhihu.com/p/79680889. > > Putting that information into the changelog and kernel documentation is > a much better idea than putting it there. Yes, will do. Thank you. > > > Sharing data is not our intention, Sharing address is. NOIOMMU mode is just a > > temporary solution to let some hardware which does not care the security issue > > to try WarpDrive for the first step. Some user do not care this much in embedded > > scenario. We saw VFIO use the same model so we also want to make a try. If you > > insist this is risky, we can remove it. > > Why not just use vfio then? We tried that in previous patches. But it needs to create unnecessary mdev to fulfill the requirement. So we discard it after the discussion in lkml. > > And yes, for now, please remove it, if you are not requiring it. > We do require it;) But surely we can kept it in our own branch but push only the main function. Thank you. > thanks, > > greg k-h -- -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!