All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Raj, Ashok" <ashok.raj@linux.intel.com>
To: Zhangfei Gao <zhangfei.gao@linaro.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Arnd Bergmann <arnd@arndb.de>,
	Herbert Xu <herbert@gondor.apana.org.au>,
	jonathan.cameron@huawei.com, dave.jiang@intel.com,
	grant.likely@arm.com, jean-philippe <jean-philippe@linaro.org>,
	Jerome Glisse <jglisse@redhat.com>,
	ilias.apalodimas@linaro.org, francois.ozog@linaro.org,
	kenneth-lee-2012@foxmail.com, Wangzhou <wangzhou1@hisilicon.com>,
	"haojian . zhuang" <haojian.zhuang@linaro.org>,
	guodong.xu@linaro.org, linux-accelerators@lists.ozlabs.org,
	linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org,
	iommu@lists.linux-foundation.org,
	Kenneth Lee <liguozhu@hisilicon.com>,
	Zaibo Xu <xuzaibo@huawei.com>, Ashok Raj <ashok.raj@intel.com>
Subject: Re: [PATCH v12 2/4] uacce: add uacce driver
Date: Mon, 24 Feb 2020 10:22:02 -0800	[thread overview]
Message-ID: <20200224182201.GA22668@araj-mobl1.jf.intel.com> (raw)
In-Reply-To: <1579097568-17542-3-git-send-email-zhangfei.gao@linaro.org>

Hi Kenneth,

sorry for waking up late on this patchset.


On Wed, Jan 15, 2020 at 10:12:46PM +0800, Zhangfei Gao wrote:
[... trimmed]

> +
> +static int uacce_fops_open(struct inode *inode, struct file *filep)
> +{
> +	struct uacce_mm *uacce_mm = NULL;
> +	struct uacce_device *uacce;
> +	struct uacce_queue *q;
> +	int ret = 0;
> +
> +	uacce = xa_load(&uacce_xa, iminor(inode));
> +	if (!uacce)
> +		return -ENODEV;
> +
> +	q = kzalloc(sizeof(struct uacce_queue), GFP_KERNEL);
> +	if (!q)
> +		return -ENOMEM;
> +
> +	mutex_lock(&uacce->mm_lock);
> +	uacce_mm = uacce_mm_get(uacce, q, current->mm);

I think having this at open time is a bit unnatural. Since when a process
does fork, we do not inherit the PASID. Although it inherits the fd
but cannot use the mmaped address in the child.

If you move this to the mmap time, its more natural. The child could
do a mmap() get a new PASID + mmio space to work with the hardware.


> +	mutex_unlock(&uacce->mm_lock);
> +	if (!uacce_mm) {
> +		ret = -ENOMEM;
> +		goto out_with_mem;
> +	}
> +

WARNING: multiple messages have this Message-ID (diff)
From: "Raj, Ashok" <ashok.raj@linux.intel.com>
To: Zhangfei Gao <zhangfei.gao@linaro.org>
Cc: jean-philippe <jean-philippe@linaro.org>,
	dave.jiang@intel.com, Herbert Xu <herbert@gondor.apana.org.au>,
	Arnd Bergmann <arnd@arndb.de>,
	francois.ozog@linaro.org,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	ilias.apalodimas@linaro.org, iommu@lists.linux-foundation.org,
	linux-kernel@vger.kernel.org, Jerome Glisse <jglisse@redhat.com>,
	grant.likely@arm.com,
	"haojian . zhuang" <haojian.zhuang@linaro.org>,
	linux-accelerators@lists.ozlabs.org,
	linux-crypto@vger.kernel.org, Ashok Raj <ashok.raj@intel.com>,
	Kenneth Lee <liguozhu@hisilicon.com>,
	guodong.xu@linaro.org, kenneth-lee-2012@foxmail.com
Subject: Re: [PATCH v12 2/4] uacce: add uacce driver
Date: Mon, 24 Feb 2020 10:22:02 -0800	[thread overview]
Message-ID: <20200224182201.GA22668@araj-mobl1.jf.intel.com> (raw)
In-Reply-To: <1579097568-17542-3-git-send-email-zhangfei.gao@linaro.org>

Hi Kenneth,

sorry for waking up late on this patchset.


On Wed, Jan 15, 2020 at 10:12:46PM +0800, Zhangfei Gao wrote:
[... trimmed]

> +
> +static int uacce_fops_open(struct inode *inode, struct file *filep)
> +{
> +	struct uacce_mm *uacce_mm = NULL;
> +	struct uacce_device *uacce;
> +	struct uacce_queue *q;
> +	int ret = 0;
> +
> +	uacce = xa_load(&uacce_xa, iminor(inode));
> +	if (!uacce)
> +		return -ENODEV;
> +
> +	q = kzalloc(sizeof(struct uacce_queue), GFP_KERNEL);
> +	if (!q)
> +		return -ENOMEM;
> +
> +	mutex_lock(&uacce->mm_lock);
> +	uacce_mm = uacce_mm_get(uacce, q, current->mm);

I think having this at open time is a bit unnatural. Since when a process
does fork, we do not inherit the PASID. Although it inherits the fd
but cannot use the mmaped address in the child.

If you move this to the mmap time, its more natural. The child could
do a mmap() get a new PASID + mmio space to work with the hardware.


> +	mutex_unlock(&uacce->mm_lock);
> +	if (!uacce_mm) {
> +		ret = -ENOMEM;
> +		goto out_with_mem;
> +	}
> +
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

  parent reply	other threads:[~2020-02-24 18:22 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-15 14:12 [PATCH v12 0/4] Add uacce module for Accelerator Zhangfei Gao
2020-01-15 14:12 ` Zhangfei Gao
2020-01-15 14:12 ` [PATCH v12 1/4] uacce: Add documents for uacce Zhangfei Gao
2020-01-15 14:12   ` Zhangfei Gao
2020-01-15 14:12 ` [PATCH v12 2/4] uacce: add uacce driver Zhangfei Gao
2020-01-15 14:12   ` Zhangfei Gao
2020-02-10 23:37   ` Greg Kroah-Hartman
2020-02-10 23:37     ` Greg Kroah-Hartman
2020-02-11  7:59     ` zhangfei
2020-02-11  7:59       ` zhangfei
2020-02-13  9:15     ` Herbert Xu
2020-02-13  9:15       ` Herbert Xu
2020-02-13  9:42       ` zhangfei
2020-02-13  9:42         ` zhangfei
2020-02-13 13:00       ` Greg Kroah-Hartman
2020-02-13 13:00         ` Greg Kroah-Hartman
2020-02-24 18:22   ` Raj, Ashok [this message]
2020-02-24 18:22     ` Raj, Ashok
2020-02-25  8:36     ` zhangfei
2020-02-25  8:36       ` zhangfei
2020-03-03 11:45     ` Jean-Philippe Brucker
2020-03-03 11:45       ` Jean-Philippe Brucker
2020-01-15 14:12 ` [PATCH v12 3/4] crypto: hisilicon - Remove module_param uacce_mode Zhangfei Gao
2020-01-15 14:12   ` Zhangfei Gao
2020-01-15 14:12 ` [PATCH v12 4/4] crypto: hisilicon - register zip engine to uacce Zhangfei Gao
2020-01-15 14:12   ` Zhangfei Gao

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=20200224182201.GA22668@araj-mobl1.jf.intel.com \
    --to=ashok.raj@linux.intel.com \
    --cc=arnd@arndb.de \
    --cc=ashok.raj@intel.com \
    --cc=dave.jiang@intel.com \
    --cc=francois.ozog@linaro.org \
    --cc=grant.likely@arm.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=guodong.xu@linaro.org \
    --cc=haojian.zhuang@linaro.org \
    --cc=herbert@gondor.apana.org.au \
    --cc=ilias.apalodimas@linaro.org \
    --cc=iommu@lists.linux-foundation.org \
    --cc=jean-philippe@linaro.org \
    --cc=jglisse@redhat.com \
    --cc=jonathan.cameron@huawei.com \
    --cc=kenneth-lee-2012@foxmail.com \
    --cc=liguozhu@hisilicon.com \
    --cc=linux-accelerators@lists.ozlabs.org \
    --cc=linux-crypto@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.