Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp3558877pxb; Sun, 7 Feb 2021 14:04:18 -0800 (PST) X-Google-Smtp-Source: ABdhPJwdJeLOftfZvLzYdxudxvY4eVjQ6na959W34P2nEU0SybnxtSzEoFZsjIFj7/585Wm2Akd2 X-Received: by 2002:a05:6402:289:: with SMTP id l9mr236233edv.218.1612735458488; Sun, 07 Feb 2021 14:04:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612735458; cv=none; d=google.com; s=arc-20160816; b=dg7lMa35K/0o/UkTF36w1fg/Z/6Qus94TuQE4xGwbyXtlCqMFUQCUP6Ew2bCcpTFpl C5gv62sroinbcmCgP5q5qKGYGgsk13zl1n4ium8NB+Ugx7k3cQHfQ0FtwpRDKq0XX9lV bH69B6kKFn1cqQvl5TJ0RF60GkP1mYrJcnI0o56ZMSdUECGMr907Q5/5vPvy261x1JhZ c1cHa+/WV+46c+V9NUxTZQVC+NAbhjcrBH1zxJ14r1Bqj38pa8VV2P5/TSTv03uDdYVI uN7M2hwDCSmx/Bysvr9VNFmN9VdsiB5h3gbhEU3hF9Uq3bW7dfCKHc3HHzDUmEnGXzhg aVjA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:in-reply-to:cc:references:message-id:date :subject:mime-version:from:content-transfer-encoding:dkim-signature; bh=rF9rOEV9Q8WVIOH0rqIWO7EqANQSyBnp1ft+vyl9KF0=; b=ZhrjYju6A8coH7QBpp92qzEu9Iy7XpvVX0E9HU6WLESFj72Ex21QJJnhZtXC5u1K+w 3FPk1n/mJw0AbUcGXG17vpapgkQgPIDMsNa7p7JBdi/hA+gilx5SJFP3k64oD+xMp/Uv xhNz37rOwIeiMtycPPn7yR2tIGt8FdwD8wS9P5WUWPwaSsDietMAdWWGuUdqoU76S6r8 ZeI1jRtMgcmWY3/feA/SNEnlGPEDCOgIbb2duri3aTWH4lE2mJHZVX1W62HaBNy+RP3p y4decwTHpFLb2HwGIUNLcQEXgGZQoEkozCcPCa5lWwm0Yk78hXZzTymkkhilFGKSe8u2 DW6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amacapital-net.20150623.gappssmtp.com header.s=20150623 header.b=QANXs0Ex; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w20si4224813edc.273.2021.02.07.14.03.55; Sun, 07 Feb 2021 14:04:18 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@amacapital-net.20150623.gappssmtp.com header.s=20150623 header.b=QANXs0Ex; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229581AbhBGWDW (ORCPT + 99 others); Sun, 7 Feb 2021 17:03:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57616 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229570AbhBGWDS (ORCPT ); Sun, 7 Feb 2021 17:03:18 -0500 Received: from mail-pl1-x62b.google.com (mail-pl1-x62b.google.com [IPv6:2607:f8b0:4864:20::62b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7C2F2C06174A for ; Sun, 7 Feb 2021 14:02:38 -0800 (PST) Received: by mail-pl1-x62b.google.com with SMTP id j11so6772051plt.11 for ; Sun, 07 Feb 2021 14:02:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amacapital-net.20150623.gappssmtp.com; s=20150623; h=content-transfer-encoding:from:mime-version:subject:date:message-id :references:cc:in-reply-to:to; bh=rF9rOEV9Q8WVIOH0rqIWO7EqANQSyBnp1ft+vyl9KF0=; b=QANXs0Ex159+byJKUEaE28kl3Xh1NJ9WQlAArBMiqR/LE0uHG9IpHhfqWrVmJbho7R zP1u0EqWhELbEmtTGccuSGqB1fhJqbp8L6ZAFLx9BsWQEpn7+9fUeq7ZlknoiHHfRYsV yCiSNhT/oz/MSrVIf+6C3avuFCznOmT2MIzTiHTudXkJ3md/uaNKYTp7OcY+zyFWUdx3 t2hI93ykFPrRg/ziGbbX6FfZAddsJEzERu6Jadvk5KI3v/9ZrpWsV/zrUDO5Y59dlxde zHUljpHpBinHt9TpnJyq7p6CZXtVOCBYq6uXD8Si3ujOPNxK8fpJ1Q0naopg0iRuSxBm +jGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:content-transfer-encoding:from:mime-version :subject:date:message-id:references:cc:in-reply-to:to; bh=rF9rOEV9Q8WVIOH0rqIWO7EqANQSyBnp1ft+vyl9KF0=; b=akbvt0hbjL9kUaIpO2SC+BwU6l8sXHKim2SUUhB7zGidigLVpI+4t3mPEOGJHIUn8A 2vZz9yC2Nfe6t/heIy2LKeWChxNAi9BCc9UVIzcgrhRJsuCE3GTqeNLWlCd+NJAj7sNI BDIu34PKJ11W7RWBb2NgGTbkEZT6TGKCJnhJvcuwoDNPYi14Klj+1GOmX2snwVe+fpa3 1Pwsj5rYatJDybckF6puI3DbgTEBwjdeH8hfXpIw8bY9/7eEJrQgRdzMogj84YISrN4s +LzHdRjAHme4qGv0ZupXx41mo13Kw+Vfw82kY6W1Wpg2yzkDx/RiyOP7euszH/Q5AflE aSnw== X-Gm-Message-State: AOAM532YH1fc//rU9uYWOUOv4E1rhVflSyrdRhOwQ2j8vAG3CHn80te6 TZU8fIMU6RDZTnoXqU++9Y4meA== X-Received: by 2002:a17:90a:184:: with SMTP id 4mr13919868pjc.87.1612735358046; Sun, 07 Feb 2021 14:02:38 -0800 (PST) Received: from ?IPv6:2601:646:c200:1ef2:8e8:e217:43e7:e032? ([2601:646:c200:1ef2:8e8:e217:43e7:e032]) by smtp.gmail.com with ESMTPSA id i25sm16435713pgb.33.2021.02.07.14.02.37 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 07 Feb 2021 14:02:37 -0800 (PST) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: Andy Lutomirski Mime-Version: 1.0 (1.0) Subject: Re: [RFC PATCH v3 1/2] mempinfd: Add new syscall to provide memory pin Date: Sun, 7 Feb 2021 14:02:36 -0800 Message-Id: References: <1612685884-19514-2-git-send-email-wangzhou1@hisilicon.com> Cc: linux-kernel@vger.kernel.org, iommu@lists.linux-foundation.org, linux-mm@kvack.org, linux-arm-kernel@lists.infradead.org, linux-api@vger.kernel.org, Andrew Morton , Alexander Viro , gregkh@linuxfoundation.org, song.bao.hua@hisilicon.com, jgg@ziepe.ca, kevin.tian@intel.com, jean-philippe@linaro.org, eric.auger@redhat.com, liguozhu@hisilicon.com, zhangfei.gao@linaro.org, Sihang Chen In-Reply-To: <1612685884-19514-2-git-send-email-wangzhou1@hisilicon.com> To: Zhou Wang X-Mailer: iPhone Mail (18D52) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > On Feb 7, 2021, at 12:31 AM, Zhou Wang wrote: >=20 > =EF=BB=BFSVA(share virtual address) offers a way for device to share proce= ss virtual > address space safely, which makes more convenient for user space device > driver coding. However, IO page faults may happen when doing DMA > operations. As the latency of IO page fault is relatively big, DMA > performance will be affected severely when there are IO page faults. > =46rom a long term view, DMA performance will be not stable. >=20 > In high-performance I/O cases, accelerators might want to perform > I/O on a memory without IO page faults which can result in dramatically > increased latency. Current memory related APIs could not achieve this > requirement, e.g. mlock can only avoid memory to swap to backup device, > page migration can still trigger IO page fault. >=20 > Various drivers working under traditional non-SVA mode are using > their own specific ioctl to do pin. Such ioctl can be seen in v4l2, > gpu, infiniband, media, vfio, etc. Drivers are usually doing dma > mapping while doing pin. >=20 > But, in SVA mode, pin could be a common need which isn't necessarily > bound with any drivers, and neither is dma mapping needed by drivers > since devices are using the virtual address of CPU. Thus, It is better > to introduce a new common syscall for it. >=20 > This patch leverages the design of userfaultfd and adds mempinfd for pin > to avoid messing up mm_struct. A fd will be got by mempinfd, then user > space can do pin/unpin pages by ioctls of this fd, all pinned pages under > one file will be unpinned in file release process. Like pin page cases in > other places, can_do_mlock is used to check permission and input > parameters. Can you document what the syscall does? Userfaultfd is an fd because one program controls another. Is mempinfd like= this?=