Re: [PATCH v6 2/3] uacce: add uacce driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxx 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





[Index of Archives]     [Kernel]     [Gnu Classpath]     [Gnu Crypto]     [DM Crypt]     [Netfilter]     [Bugtraq]

  Powered by Linux