Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp3669414ybl; Sun, 25 Aug 2019 21:38:08 -0700 (PDT) X-Google-Smtp-Source: APXvYqx2TbDbIcdT+jbOFbaRglSXCfr0m7S4AuFHUVVTWsuEjntTD/iIkJ3opumAT2uByW6Eya0u X-Received: by 2002:a17:90a:a40e:: with SMTP id y14mr17223688pjp.83.1566794288321; Sun, 25 Aug 2019 21:38:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566794288; cv=none; d=google.com; s=arc-20160816; b=eGx5A1gitISfXk00FBY/vEr9rPP/vPwucrrw7PP20+UcZJ3KvvdcIDcD5Sq5svS8ic rh0jOvYKF53R2oxTgJw8K+Qx5RZXk1tb0eqAz/yeyiLl2L5eYUP9sIgNi7QBAFRjRIbR zU1Vr+nqGPARSYMjVEEYeP3nT4LFPzgU048SCabe7Q3pUpXsn/5Dw5//OkckrijQQ66n ZDqGCuXHd1ea7+fNw2PTTUIza6kvwmU8llnPuZ9m2/bxHpjKQZPulkDmKDNjPrJXV8xe RzjBpedcKr3o54k7cFtvKos9BYe5gwEzjuqiV0L/bEP7zlaLnsqg9eX4Hl2NeLJRLZGH raag== 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=LIF/KWNSIdMtwQhK6wxzyoti/Rmm6Qn1dQiHCNPP/cw=; b=SMG2LXj6Mvx8TOlTIG045zmUJklFIjdo4PUYRR3b8M2efiP/9Za3rbav7x9hER6Qym Ba0vzoldxzAAQqXq83l9sH3ubAwLWHgzC9LOeY/J8bvazU/hGt2TR8K9CHbN0aypnvhk anu+UrtKYYDPgnzmITjGGU4mvp0B0LA1Hm0Vzafbf3eYWcPjbLM2d+ZVs/FSAgqbbiSR jaV9Gx7buUarZm0RZ01y2mSQ5haiYcl8qyA6V3oIA1D/eMhrEiyPRCxvkJLC/ofNaJ+q /tRK8PC1RwN9cEQoJSxJHLgUPgvVDdXc3Loy1ONTfdtrlfa/xUlRVI7WVxUVPrUHQmk1 CcOQ== 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 q23si8122761pjp.76.2019.08.25.21.37.52; Sun, 25 Aug 2019 21:38:08 -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 S1729604AbfHZEM4 (ORCPT + 99 others); Mon, 26 Aug 2019 00:12:56 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:59334 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729555AbfHZEM4 (ORCPT ); Mon, 26 Aug 2019 00:12:56 -0400 Received: from DGGEMS403-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 7AEAFC773479A9CCBB4A; Mon, 26 Aug 2019 12:12:54 +0800 (CST) Received: from localhost (10.67.212.75) by DGGEMS403-HUB.china.huawei.com (10.3.19.203) with Microsoft SMTP Server (TLS) id 14.3.439.0; Mon, 26 Aug 2019 12:12:47 +0800 Date: Mon, 26 Aug 2019 12:10:42 +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: <20190826041042.GB27955@Turing-Arch-b> References: <1565775265-21212-1-git-send-email-zhangfei.gao@linaro.org> <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> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20190821160542.GA14760@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 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. 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. Thanks. -- -Kenneth(Hisilicon)