linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kenneth Lee <liguozhu@hisilicon.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: zhangfei <zhangfei.gao@linaro.org>, Arnd Bergmann <arnd@arndb.de>,
	<linux-accelerators@lists.ozlabs.org>,
	<linux-kernel@vger.kernel.org>, "Zaibo Xu" <xuzaibo@huawei.com>,
	Zhou Wang <wangzhou1@hisilicon.com>
Subject: Re: [PATCH 2/2] uacce: add uacce module
Date: Mon, 26 Aug 2019 12:10:42 +0800	[thread overview]
Message-ID: <20190826041042.GB27955@Turing-Arch-b> (raw)
In-Reply-To: <20190821160542.GA14760@kroah.com>

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 <gregkh@linuxfoundation.org>
> To: zhangfei <zhangfei.gao@linaro.org>
> CC: Arnd Bergmann <arnd@arndb.de>, linux-accelerators@lists.ozlabs.org,
>  linux-kernel@vger.kernel.org, Kenneth Lee <liguozhu@hisilicon.com>, Zaibo
>  Xu <xuzaibo@huawei.com>, Zhou Wang <wangzhou1@hisilicon.com>
> 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)


  reply	other threads:[~2019-08-26  4:12 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-14  9:34 [PATCH 0/2] A General Accelerator Framework, WarpDrive Zhangfei Gao
2019-08-14  9:34 ` [PATCH 1/2] uacce: Add documents for WarpDrive/uacce Zhangfei Gao
2019-08-14  9:34 ` [PATCH 2/2] uacce: add uacce module Zhangfei Gao
2019-08-15 14:12   ` Greg Kroah-Hartman
     [not found]     ` <5d5a6757.1c69fb81.e0678.2ab2SMTPIN_ADDED_BROKEN@mx.google.com>
2019-08-19 10:22       ` Greg Kroah-Hartman
2019-08-20 12:38         ` zhangfei
2019-08-20 14:31           ` Greg Kroah-Hartman
2019-08-15 14:13   ` Greg Kroah-Hartman
2019-08-20 13:08     ` zhangfei
2019-08-20 16:59       ` Greg Kroah-Hartman
     [not found]         ` <5d5cf0fc.1c69fb81.ec57f.b853SMTPIN_ADDED_BROKEN@mx.google.com>
2019-08-21  9:17           ` Greg Kroah-Hartman
2019-08-21 14:30             ` zhangfei
2019-08-21 16:05               ` Greg Kroah-Hartman
2019-08-26  4:10                 ` Kenneth Lee [this message]
2019-08-26  4:29                   ` Greg Kroah-Hartman
2019-08-27 11:42                     ` Kenneth Lee
2019-08-27 18:48                       ` Greg Kroah-Hartman
2019-08-15 14:20   ` Greg Kroah-Hartman
     [not found]     ` <5d5a6f5b.1c69fb81.9d35e.5303SMTPIN_ADDED_BROKEN@mx.google.com>
2019-08-19 10:24       ` Greg Kroah-Hartman
2019-08-20 12:36         ` zhangfei
2019-08-20 14:33           ` Greg Kroah-Hartman
2019-08-24 12:53             ` zhangfei
2019-08-24 15:40               ` Greg Kroah-Hartman
2019-08-15 16:54   ` Jonathan Cameron
2019-08-23  9:21     ` zhangfei
2019-08-23 16:36       ` Jonathan Cameron
2019-08-23 16:42       ` Jonathan Cameron
2019-08-15 17:04 ` [PATCH 0/2] A General Accelerator Framework, WarpDrive Jerome Glisse
2019-08-20 14:26   ` zhangfei
2019-08-26  4:14   ` Kenneth Lee

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190826041042.GB27955@Turing-Arch-b \
    --to=liguozhu@hisilicon.com \
    --cc=arnd@arndb.de \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-accelerators@lists.ozlabs.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=wangzhou1@hisilicon.com \
    --cc=xuzaibo@huawei.com \
    --cc=zhangfei.gao@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).