From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.5 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BE86FC433E0 for ; Tue, 9 Feb 2021 11:58:30 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 0772964E6F for ; Tue, 9 Feb 2021 11:58:29 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0772964E6F Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=hisilicon.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 1B27A6B006C; Tue, 9 Feb 2021 06:58:29 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 163CF6B006E; Tue, 9 Feb 2021 06:58:29 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 079306B0070; Tue, 9 Feb 2021 06:58:29 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0003.hostedemail.com [216.40.44.3]) by kanga.kvack.org (Postfix) with ESMTP id E6D436B006C for ; Tue, 9 Feb 2021 06:58:28 -0500 (EST) Received: from smtpin07.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id A4838180AD80F for ; Tue, 9 Feb 2021 11:58:28 +0000 (UTC) X-FDA: 77798581896.07.bike03_0d14ffe27607 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin07.hostedemail.com (Postfix) with ESMTP id 888CC1803F7B3 for ; Tue, 9 Feb 2021 11:58:28 +0000 (UTC) X-HE-Tag: bike03_0d14ffe27607 X-Filterd-Recvd-Size: 4168 Received: from szxga07-in.huawei.com (szxga07-in.huawei.com [45.249.212.35]) by imf11.hostedemail.com (Postfix) with ESMTP for ; Tue, 9 Feb 2021 11:58:27 +0000 (UTC) Received: from DGGEMS411-HUB.china.huawei.com (unknown [172.30.72.60]) by szxga07-in.huawei.com (SkyGuard) with ESMTP id 4DZhFm2lTgz7hpn; Tue, 9 Feb 2021 19:57:00 +0800 (CST) Received: from [127.0.0.1] (10.40.188.87) by DGGEMS411-HUB.china.huawei.com (10.3.19.211) with Microsoft SMTP Server id 14.3.498.0; Tue, 9 Feb 2021 19:58:15 +0800 Subject: Re: [RFC PATCH v3 1/2] mempinfd: Add new syscall to provide memory pin To: Greg KH References: <1612685884-19514-2-git-send-email-wangzhou1@hisilicon.com> <2e6cf99f-beb6-9bef-1316-5e58fb0aa86e@hisilicon.com> CC: Andy Lutomirski , , , , , , "Andrew Morton" , Alexander Viro , , , , , , , , Sihang Chen From: Zhou Wang Message-ID: Date: Tue, 9 Feb 2021 19:58:15 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.7.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8" X-Originating-IP: [10.40.188.87] X-CFilter-Loop: Reflected Content-Transfer-Encoding: quoted-printable X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On 2021/2/9 17:37, Greg KH wrote: > On Tue, Feb 09, 2021 at 05:17:46PM +0800, Zhou Wang wrote: >> On 2021/2/8 6:02, Andy Lutomirski wrote: >>> >>> >>>> On Feb 7, 2021, at 12:31 AM, Zhou Wang wro= te: >>>> >>>> =EF=BB=BFSVA(share virtual address) offers a way for device to share= process virtual >>>> address space safely, which makes more convenient for user space dev= ice >>>> 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. >>>> From a long term view, DMA performance will be not stable. >>>> >>>> In high-performance I/O cases, accelerators might want to perform >>>> I/O on a memory without IO page faults which can result in dramatica= lly >>>> increased latency. Current memory related APIs could not achieve thi= s >>>> requirement, e.g. mlock can only avoid memory to swap to backup devi= ce, >>>> page migration can still trigger IO page fault. >>>> >>>> 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. >>>> >>>> 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 bett= er >>>> to introduce a new common syscall for it. >>>> >>>> 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 us= er >>>> 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 cas= es in >>>> other places, can_do_mlock is used to check permission and input >>>> parameters. >>> >>> >>> Can you document what the syscall does? >> >> Will add related document in Documentation/vm. >=20 > A manpage is always good, and will be required eventually :) manpage is maintained in another repo. Do you mean add a manpage patch in this series? Best, Zhou >=20 > thanks, >=20 > greg k-h >=20 > . >=20