Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp2726165ybv; Mon, 24 Feb 2020 10:23:01 -0800 (PST) X-Google-Smtp-Source: APXvYqz+e4PoIA8bDBbFWlfzjArmZ6YIZAiE5B4OPeAp88FUjVXWhYBbZDYZ8WpfQK9XJNbTlarK X-Received: by 2002:a9d:67d7:: with SMTP id c23mr41553183otn.262.1582568581316; Mon, 24 Feb 2020 10:23:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582568581; cv=none; d=google.com; s=arc-20160816; b=bB7EwQWSAQe2TOMXiWgJOrqVvwUtwlvtBY59pp+AeXAAO+s/o+b+2bnFKYmaRR3RPO gFJ1njB9gn7OiUYf87yj7cz62lZH0evwtDCPk8SbCo3CLLUwvgssTHeI0e9UgtxapLzX evs6OKAdAjIyxQQbaZzqKTr+tU95bHaLgB7tJQHxmxJeJFKcdNunqSzFKG2fsLieDHxm FKKPcufH0xmRm1UQY/uLCo/F/cPtpYKPFPooHQSuG+uC7/P/Py2PSPHMpuZKFniP6pZa qzqyXT1w2JnfvECHDvN0suVdSS7EzgGqR6DSR++YdKGA/SK733ndpnHFZp+5eF2uysm6 PPTQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=M6HBASE0fHeriEKbR1g5+QaRcOG3VZ8P1X1mBngxEs8=; b=Xr1tFI3hkCBKeg7ZV8+ovjKz/Bv/sFfZGa2n0iCrGM3LFF11HkWo0m+z3GHcwV3T5D L7V4aQqDsuzAz9Tc1XI6sDfXCCNPYVf2i5w4YIcBwDZ+nuzqx/viSRORLbos5Rb2xpPr 51lzo1iihOGPhEsi2Yv1G82gj+KXvUhmpni/y1zUuGvqDSa6/ePoswUFVIQkZ73ICQPh 4BH2w9+wW2AZh02J8aOJGI9uPqJn1G7p81rqvmufhzCt+tzOuvEGey4WWmYhSI3ZE2+0 ZjWRjEeltyYxs24nUpCmFMI0DhdDr6LZABvPNPebMTRXouFESkOFwVPZaQTaAcloeg26 j92w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h138si5360378oib.6.2020.02.24.10.22.49; Mon, 24 Feb 2020 10:23:01 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727957AbgBXSWD (ORCPT + 99 others); Mon, 24 Feb 2020 13:22:03 -0500 Received: from mga17.intel.com ([192.55.52.151]:6019 "EHLO mga17.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727939AbgBXSWD (ORCPT ); Mon, 24 Feb 2020 13:22:03 -0500 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 24 Feb 2020 10:22:02 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,481,1574150400"; d="scan'208";a="284426587" Received: from araj-mobl1.jf.intel.com ([10.24.11.16]) by FMSMGA003.fm.intel.com with ESMTP; 24 Feb 2020 10:22:02 -0800 Date: Mon, 24 Feb 2020 10:22:02 -0800 From: "Raj, Ashok" To: Zhangfei Gao Cc: Greg Kroah-Hartman , Arnd Bergmann , Herbert Xu , jonathan.cameron@huawei.com, dave.jiang@intel.com, grant.likely@arm.com, jean-philippe , Jerome Glisse , ilias.apalodimas@linaro.org, francois.ozog@linaro.org, kenneth-lee-2012@foxmail.com, Wangzhou , "haojian . zhuang" , 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 , Zaibo Xu , Ashok Raj Subject: Re: [PATCH v12 2/4] uacce: add uacce driver Message-ID: <20200224182201.GA22668@araj-mobl1.jf.intel.com> References: <1579097568-17542-1-git-send-email-zhangfei.gao@linaro.org> <1579097568-17542-3-git-send-email-zhangfei.gao@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1579097568-17542-3-git-send-email-zhangfei.gao@linaro.org> User-Agent: Mutt/1.9.1 (2017-09-22) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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; > + } > +