Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp1881840ybg; Thu, 24 Oct 2019 01:21:40 -0700 (PDT) X-Google-Smtp-Source: APXvYqwo0GRTCXG3w6c1gPtkXeiwZqKm4Gs48l+nsk7RxaYK4cN53O9j3w9Hzw1ZIRL3fXJj3Bhy X-Received: by 2002:aa7:de1a:: with SMTP id h26mr41862016edv.289.1571905300294; Thu, 24 Oct 2019 01:21:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571905300; cv=none; d=google.com; s=arc-20160816; b=PlR6gUZB0d8vrhCLW8F6T8PxENHrK5uT1Y6biraauc9ToFLfLzL+rj8lSqgfWnLqSn xu+MXWPM9ONhWf02LiZHMvNtnmWzatoXllKMaPdmcGmrUb3RegCYE27eV+Q1iuFxJKRQ M0HTI5ssMq1lnHtbjiamYOHKukzKGY3C0L7StHGg5uvEn/Z0mmDuF9f5ux/oSm//ZMLq HEy8RGBLdIhxt1SMoxLIqKkiysolpGpfC+LjtglN7/1oL8832iNN45YRBKQLJe3+Osa/ Qhm6SJ3t/WROJR2u3zoaO5jahqxX3MLuCMxQKKbuAJLPizHAF5Ly4bJgo4PYCQQJoUrE PzqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition :content-transfer-encoding:user-agent:in-reply-to:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=hL1kplXLC+ueQfopd2mykU/6xLsfKNYy9p+amPVfFVA=; b=PFQ5wbOcbbzRiGlZgbJbPd4O8v8UfwWbtjOGbCOHU0vY2y9L/+Gyy/jFAx5VJbYaqD WnUjMc1dNN+ng41R6jPaLr43X8wa9DHLBgFUwzS0uOuKGsAyW4Le/T5MkFZObJR9IIVS ATzWfOn1LKloas1CkQCj1zDJSVl+LtqwfyY8E3D85nJ6+YDTed7Ljq4zfxn0BCdcaRU/ w865ksp+99JtVDWNFB54pmYWSwGOjm+fmEHXPyjmq80MbYFLcbWSTWtLwM+x43cEJApa Dt3amTDTZRXJ5kuhhMxRuSr7ZCMwKgnoLQJgwHp/bJPpwddJmODYvdfkZWXBOblpMtc7 Sw8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=UGplGApx; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h91si18142076edd.270.2019.10.24.01.21.14; Thu, 24 Oct 2019 01:21:40 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=UGplGApx; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726831AbfJWRDT (ORCPT + 99 others); Wed, 23 Oct 2019 13:03:19 -0400 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:38631 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726497AbfJWRDT (ORCPT ); Wed, 23 Oct 2019 13:03:19 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1571850198; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hL1kplXLC+ueQfopd2mykU/6xLsfKNYy9p+amPVfFVA=; b=UGplGApx3GTROkZ/kqj1pOsV+1zvSdAQCcJhtB+yVWXMoUU0A4Co/te6jJZEJZVsYHOqqF JurrG6QAz3ZROhoxzuOeg11tmaOo1htMr/+myFE9yaMIixvU0kQd41PjlpeDAUfDbU2PA4 2k8VOW56phVRjbxbmxW/FcCbeDGdYhg= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-241-JMqWU3XDM3WOQ86NKjFRPQ-1; Wed, 23 Oct 2019 13:03:12 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 939FA800D49; Wed, 23 Oct 2019 17:03:09 +0000 (UTC) Received: from redhat.com (ovpn-124-105.rdu2.redhat.com [10.10.124.105]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 039751001B07; Wed, 23 Oct 2019 17:03:07 +0000 (UTC) Date: Wed, 23 Oct 2019 13:03:06 -0400 From: Jerome Glisse To: Jean-Philippe Brucker Cc: "zhangfei.gao@foxmail.com" , francois.ozog@linaro.org, Herbert Xu , Arnd Bergmann , Greg Kroah-Hartman , Zaibo Xu , ilias.apalodimas@linaro.org, linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org, Wangzhou , grant.likely@arm.com, "haojian . zhuang" , Zhangfei Gao , Kenneth Lee , linux-accelerators@lists.ozlabs.org, kenneth-lee-2012@foxmail.com Subject: Re: [PATCH v6 2/3] uacce: add uacce driver Message-ID: <20191023170306.GC4163@redhat.com> References: <1571214873-27359-1-git-send-email-zhangfei.gao@linaro.org> <1571214873-27359-3-git-send-email-zhangfei.gao@linaro.org> <20191016172802.GA1533448@lophozonia> <5da9a9cd.1c69fb81.9f8e8.60faSMTPIN_ADDED_BROKEN@mx.google.com> <20191023074227.GA264888@lophozonia> MIME-Version: 1.0 In-Reply-To: <20191023074227.GA264888@lophozonia> User-Agent: Mutt/1.12.1 (2019-06-15) X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-MC-Unique: JMqWU3XDM3WOQ86NKjFRPQ-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset=WINDOWS-1252 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org 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_stru= ct *vma) > > > > +{ > > > > +=09struct uacce_queue *q =3D filep->private_data; > > > > +=09struct uacce_device *uacce =3D q->uacce; > > > > +=09struct uacce_qfile_region *qfr; > > > > +=09enum uacce_qfrt type =3D 0; > > > > +=09unsigned int flags =3D 0; > > > > +=09int ret; > > > > + > > > > +=09if (vma->vm_pgoff < UACCE_QFRT_MAX) > > > > +=09=09type =3D vma->vm_pgoff; > > > > + > > > > +=09vma->vm_flags |=3D VM_DONTCOPY | VM_DONTEXPAND; > > > > + > > > > +=09mutex_lock(&uacce_mutex); >=20 > 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=E9r=F4me