All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jerome Glisse <jglisse@redhat.com>
To: Jean-Philippe Brucker <jean-philippe@linaro.org>
Cc: "zhangfei.gao@foxmail.com" <zhangfei.gao@foxmail.com>,
	francois.ozog@linaro.org,
	Herbert Xu <herbert@gondor.apana.org.au>,
	Arnd Bergmann <arnd@arndb.de>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Zaibo Xu <xuzaibo@huawei.com>,
	ilias.apalodimas@linaro.org, linux-kernel@vger.kernel.org,
	linux-crypto@vger.kernel.org, Wangzhou <wangzhou1@hisilicon.com>,
	grant.likely@arm.com,
	"haojian . zhuang" <haojian.zhuang@linaro.org>,
	Zhangfei Gao <zhangfei.gao@linaro.org>,
	Kenneth Lee <liguozhu@hisilicon.com>,
	linux-accelerators@lists.ozlabs.org,
	kenneth-lee-2012@foxmail.com
Subject: Re: [PATCH v6 2/3] uacce: add uacce driver
Date: Wed, 23 Oct 2019 13:03:06 -0400	[thread overview]
Message-ID: <20191023170306.GC4163@redhat.com> (raw)
In-Reply-To: <20191023074227.GA264888@lophozonia>

On Wed, Oct 23, 2019 at 09:42:27AM +0200, Jean-Philippe Brucker wrote:
> On Fri, Oct 18, 2019 at 08:01:44PM +0800, zhangfei.gao@foxmail.com wrote:

[...]

> > > > +static int uacce_fops_mmap(struct file *filep, struct vm_area_struct *vma)
> > > > +{
> > > > +	struct uacce_queue *q = filep->private_data;
> > > > +	struct uacce_device *uacce = q->uacce;
> > > > +	struct uacce_qfile_region *qfr;
> > > > +	enum uacce_qfrt type = 0;
> > > > +	unsigned int flags = 0;
> > > > +	int ret;
> > > > +
> > > > +	if (vma->vm_pgoff < UACCE_QFRT_MAX)
> > > > +		type = vma->vm_pgoff;
> > > > +
> > > > +	vma->vm_flags |= VM_DONTCOPY | VM_DONTEXPAND;
> > > > +
> > > > +	mutex_lock(&uacce_mutex);
> 
> By the way, lockdep detects a possible unsafe locking scenario here,
> because we're taking the uacce_mutex even though mmap called us with the
> mmap_sem held for writing. Conversely uacce_fops_release() takes the
> mmap_sem for writing while holding the uacce_mutex. I think it can be
> fixed easily, if we simply remove the use of mmap_sem in
> uacce_fops_release(), since it's only taken to do some accounting which
> doesn't look right.

I think you need to remove the RLIMIT_DATA accounting altogether. Assume
it is not an issue for now and revisit latter when it becomes one as i
am not sure we want to add this queue memory accounting to RLIMIT_DATA
in the first place. Maybe a memory cgroup. In anycases it is safer to
delay this discussion to latter.

Cheers,
Jérôme


  reply	other threads:[~2019-10-23 17:03 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-16  8:34 [PATCH v6 0/3] Add uacce module for Accelerator Zhangfei Gao
2019-10-16  8:34 ` [PATCH v6 1/3] uacce: Add documents for uacce Zhangfei Gao
2019-10-16 18:36   ` Jean-Philippe Brucker
     [not found]     ` <5da81d06.1c69fb81.395d6.c080SMTPIN_ADDED_BROKEN@mx.google.com>
2019-10-21 13:34       ` Jean-Philippe Brucker
2019-10-16  8:34 ` [PATCH v6 2/3] uacce: add uacce driver Zhangfei Gao
2019-10-16 17:28   ` Jean-Philippe Brucker
     [not found]     ` <5da9a9cd.1c69fb81.9f8e8.60faSMTPIN_ADDED_BROKEN@mx.google.com>
2019-10-23  7:42       ` Jean-Philippe Brucker
2019-10-23 17:03         ` Jerome Glisse [this message]
     [not found]         ` <5db25e56.1c69fb81.4fe57.380cSMTPIN_ADDED_BROKEN@mx.google.com>
2019-10-25  7:35           ` Jean-Philippe Brucker
2019-10-23 16:58     ` Jerome Glisse
     [not found]       ` <5db257c6.1c69fb81.bfe34.a4afSMTPIN_ADDED_BROKEN@mx.google.com>
2019-10-25  7:04         ` Jean-Philippe Brucker
2019-10-22 18:49   ` Jerome Glisse
     [not found]     ` <20191024064129.GB17723@kllp10>
2019-10-24 14:17       ` Jerome Glisse
2019-10-25  7:01     ` zhangfei
2019-10-16  8:34 ` [PATCH v6 3/3] crypto: hisilicon - register zip engine to uacce 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=20191023170306.GC4163@redhat.com \
    --to=jglisse@redhat.com \
    --cc=arnd@arndb.de \
    --cc=francois.ozog@linaro.org \
    --cc=grant.likely@arm.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=haojian.zhuang@linaro.org \
    --cc=herbert@gondor.apana.org.au \
    --cc=ilias.apalodimas@linaro.org \
    --cc=jean-philippe@linaro.org \
    --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@foxmail.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.