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=-3.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED 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 CF21AC433E0 for ; Tue, 9 Feb 2021 12:02:00 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 3F2CD64EBC for ; Tue, 9 Feb 2021 12:02:00 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3F2CD64EBC Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linuxfoundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id B6F196B0005; Tue, 9 Feb 2021 07:01:59 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id AF8996B006C; Tue, 9 Feb 2021 07:01:59 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9E63F6B006E; Tue, 9 Feb 2021 07:01:59 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0122.hostedemail.com [216.40.44.122]) by kanga.kvack.org (Postfix) with ESMTP id 817BB6B0005 for ; Tue, 9 Feb 2021 07:01:59 -0500 (EST) Received: from smtpin17.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 420628248D52 for ; Tue, 9 Feb 2021 12:01:59 +0000 (UTC) X-FDA: 77798590758.17.A1762B8 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf04.hostedemail.com (Postfix) with ESMTP id E0D7412E for ; Tue, 9 Feb 2021 12:01:57 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id C2DDC64E16; Tue, 9 Feb 2021 12:01:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1612872117; bh=KXnFUWkeE3RzAL45lDxdFx/y1wzKceAzbuyX52i4TsI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=DOTJHzzs0FAsJ9XZl1aGZ5cH8m8J6FlrUnzLTsv+HQsJPyoVjmCXhXEjUCceVUmNA mm29z79OAsLiQ013RWN+KhCvGh3r5fqgAyfLkqw+sPpEldf1l3bGpk7z8NvUTcBD9x gD47PEY6W2LOY6R2YitBTaNoniiO/UE5cclIXM40= Date: Tue, 9 Feb 2021 13:01:23 +0100 From: Greg KH To: Zhou Wang Cc: Andy Lutomirski , 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 , 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 Subject: Re: [RFC PATCH v3 1/2] mempinfd: Add new syscall to provide memory pin Message-ID: References: <1612685884-19514-2-git-send-email-wangzhou1@hisilicon.com> <2e6cf99f-beb6-9bef-1316-5e58fb0aa86e@hisilicon.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: E0D7412E X-Stat-Signature: 653echfi5kpdqnbesdrsoqradmt17nie Received-SPF: none (kernel.org>: No applicable sender policy available) receiver=imf04; identity=mailfrom; envelope-from=""; helo=mail.kernel.org; client-ip=198.145.29.99 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1612872117-252123 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 Tue, Feb 09, 2021 at 07:58:15PM +0800, Zhou Wang wrote: > 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 w= rote: > >>>> > >>>> =EF=BB=BFSVA(share virtual address) offers a way for device to sha= re process virtual > >>>> address space safely, which makes more convenient for user space d= evice > >>>> 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 fault= s. > >>>> 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 dramati= cally > >>>> increased latency. Current memory related APIs could not achieve t= his > >>>> requirement, e.g. mlock can only avoid memory to swap to backup de= vice, > >>>> 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 necessari= ly > >>>> bound with any drivers, and neither is dma mapping needed by drive= rs > >>>> since devices are using the virtual address of CPU. Thus, It is be= tter > >>>> to introduce a new common syscall for it. > >>>> > >>>> This patch leverages the design of userfaultfd and adds mempinfd f= or 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 page= s under > >>>> one file will be unpinned in file release process. Like pin page c= ases 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 :) >=20 > manpage is maintained in another repo. Do you mean add a manpage > patch in this series? It's good to show how it will be used, don't you think? thanks, greg k-h