Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp999891pxb; Tue, 9 Feb 2021 19:30:43 -0800 (PST) X-Google-Smtp-Source: ABdhPJzxLobamXbEYN8kgK7cHhf0GXe1pxZFuTqIByH0rIVYz8X4JfoNVFvoJa1AMGCbq6lZaXnM X-Received: by 2002:aa7:da19:: with SMTP id r25mr1228061eds.1.1612927843283; Tue, 09 Feb 2021 19:30:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612927843; cv=none; d=google.com; s=arc-20160816; b=00aztHLMGeylUZdDeRChPDDV4MLUjNjGqNXwdGHPXJlQcOIuDLG9BYih0sAi2IwRlk 4OVmZFEK9Vt/0C5bp/LyClyraBIFveLrgfy47naCeEN1IxOrow/vLXmS6mvKs8zUyK5C Z3FIb58IL00D6U8G00T4gdDlQcCmV5DTPv09t4OKF7WfFLVNEp1R/IfNO5WnyhkvcbJG kcrW2tn9+fvdcczdSycu2t/8cx00j3UXLcPHnn+zf0xWrA7w1d/nfs6lfE/7NDQlQgtA kedDQ4gAhPman5Squ0ADCw0Z7AIkWjMXME32cUlN76ed+iBPIB3LN2BIuu+SwQezt3kM suwA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=W1qJJmaKqg1kJjNu1llIuQAnFRbbgcSDVtyHZN+OwJk=; b=WYrRysLMdWSd0JUS8no5yujplY6OK6PjgVExfqOvYbGITT+yoGk6tATWkXiI1e58El 3WYelZC220+25VkTX43x2oCdrR830sWHaATDvOi0u4qtpCL7L5zccLrj1CYR63tMmWWB Tc9KgzQhzx9GxUJHz8UsVVaMyIQxEXGKcaIB5uBgqbZ96QePEjW2WxQwUu3ovpg5GmRT unmEUbjBe8ros58W6Y7Sf7aMk2t6TwD9dzU7qtdIbL3cxnvyYQ6oRveJ3pYX2eswhygp 6dBTN1nno/eWJqftIsS+CcLkTyV7HG2ZhkM+t3V0o46G1YhHgYiJ55ZE+YnkQMg+M1uP cxqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=DOTJHzzs; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cc22si534925edb.80.2021.02.09.19.30.19; Tue, 09 Feb 2021 19:30:43 -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=@linuxfoundation.org header.s=korg header.b=DOTJHzzs; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230195AbhBIMEo (ORCPT + 99 others); Tue, 9 Feb 2021 07:04:44 -0500 Received: from mail.kernel.org ([198.145.29.99]:53234 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229742AbhBIMCo (ORCPT ); Tue, 9 Feb 2021 07:02:44 -0500 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 Content-Transfer-Encoding: 8bit In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 wrote: > >>>> > >>>> SVA(share virtual address) offers a way for device to share process 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. > >>>> 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 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. > >>>> > >>>> 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 better > >>>> 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 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? > >> > >> Will add related document in Documentation/vm. > > > > 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? It's good to show how it will be used, don't you think? thanks, greg k-h