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.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,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 720E0C433E9 for ; Mon, 8 Feb 2021 21:30:27 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id B2BAF64EB6 for ; Mon, 8 Feb 2021 21:30:26 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B2BAF64EB6 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ziepe.ca Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 2397D6B0005; Mon, 8 Feb 2021 16:30:26 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 1E8D86B006C; Mon, 8 Feb 2021 16:30:26 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0B2746B006E; Mon, 8 Feb 2021 16:30:26 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0071.hostedemail.com [216.40.44.71]) by kanga.kvack.org (Postfix) with ESMTP id E7BD76B0005 for ; Mon, 8 Feb 2021 16:30:25 -0500 (EST) Received: from smtpin20.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id A7861BA02 for ; Mon, 8 Feb 2021 21:30:25 +0000 (UTC) X-FDA: 77796394410.20.6E8013C Received: from mail-qk1-f173.google.com (mail-qk1-f173.google.com [209.85.222.173]) by imf06.hostedemail.com (Postfix) with ESMTP id 60293C0001E3 for ; Mon, 8 Feb 2021 21:30:24 +0000 (UTC) Received: by mail-qk1-f173.google.com with SMTP id h8so5790285qkk.6 for ; Mon, 08 Feb 2021 13:30:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=9qkflY5nbnrf1GydCZmzRH2mO9Zc9djQTfZafbwHa/g=; b=n+Mx8XiSpZIp2bzSh2g6O0jcWjTGzzEPa5DiVzraCS1z3aCBR7wlO4ojyvJXShXJqo dErGhsLjKKXGxEO4udDchIYBWbjDTcQIGFEXN/foR//8dLWzKZFOSVsJPe9ZU60Gz3ku ALAVbytloLtwAOoVkuyDyiODB5zBwwa/R5CnRGsiJbwztjwgeQ0miNWzM368nevWNycx Z0eWTWRLO+N+Oz19f9i7ogGrDu3DLRq3e08oV4K7/TmaG0lH5CTxMMzdEtlcX8Jgplyz K6PyW8JX+anGM6F7IruuNGlOi7PcrSYVM9d2Cfb6AG3AzVpw85b7UgE0KO478IIrv4L7 2t9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=9qkflY5nbnrf1GydCZmzRH2mO9Zc9djQTfZafbwHa/g=; b=R3r2gwTEKn/a9C3rIJmAITVHoI7jQUJ/fvEKORqYq4DPjPFKtqQbiga77aXfQwmvHh k7wEAdo77SfebQlSplbCSIhPGpQ36EkCEkaIGTwX4quZJaWaDqb47qPe1RgkOrU8J1C/ 5zcCyq4J4Q7iBFeM6or3ULFEu44e6Qzdb0aqg2wzKIuvs9DiQlFB6rS7ug0ipY9LwOQA w28M8kB6ZL12t2jnxmIcK4xyRIGM4nj3/n2KTbeNNhHyPhhDkk9JS3crnn09vjNBC83D ik8LQyiBLA71ET9PbdfYRCbHRYq4E/Rwv0WBmi5jZhLoyzYQtDGH+BpTKndMIute20xr 5jhg== X-Gm-Message-State: AOAM53042VwyS2gu/FDhOkNTVngPgLZaprDt3C0Fz2MY6d/F708duYs8 0Pf2pY+GJb2MYDjGJmEjvtQ/AA== X-Google-Smtp-Source: ABdhPJzFdGa04wz/eyZ4j9hhnXsbH3wCkpiuKEtnZzgfxA85nq9G/2jkn8TOldhN5jopR+fvtidBWA== X-Received: by 2002:a37:bc45:: with SMTP id m66mr4594058qkf.86.1612819824350; Mon, 08 Feb 2021 13:30:24 -0800 (PST) Received: from ziepe.ca (hlfxns017vw-142-162-115-133.dhcp-dynamic.fibreop.ns.bellaliant.net. [142.162.115.133]) by smtp.gmail.com with ESMTPSA id c63sm14340966qkf.8.2021.02.08.13.30.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Feb 2021 13:30:23 -0800 (PST) Received: from jgg by mlx with local (Exim 4.94) (envelope-from ) id 1l9E6x-00560h-7w; Mon, 08 Feb 2021 17:30:23 -0400 Date: Mon, 8 Feb 2021 17:30:23 -0400 From: Jason Gunthorpe To: "Song Bao Hua (Barry Song)" Cc: David Hildenbrand , "Wangzhou (B)" , "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" , "kevin.tian@intel.com" , "jean-philippe@linaro.org" , "eric.auger@redhat.com" , "Liguozhu (Kenneth)" , "zhangfei.gao@linaro.org" , "chensihang (A)" Subject: Re: [RFC PATCH v3 1/2] mempinfd: Add new syscall to provide memory pin Message-ID: <20210208213023.GZ4718@ziepe.ca> References: <1612685884-19514-1-git-send-email-wangzhou1@hisilicon.com> <1612685884-19514-2-git-send-email-wangzhou1@hisilicon.com> <20210208183348.GV4718@ziepe.ca> <0dca000a6cd34d8183062466ba7d6eaf@hisilicon.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <0dca000a6cd34d8183062466ba7d6eaf@hisilicon.com> X-Stat-Signature: ch5g3nr59xudyez9myzajxkrbiwjrk8m X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 60293C0001E3 Received-SPF: none (ziepe.ca>: No applicable sender policy available) receiver=imf06; identity=mailfrom; envelope-from=""; helo=mail-qk1-f173.google.com; client-ip=209.85.222.173 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1612819824-83966 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 Mon, Feb 08, 2021 at 08:35:31PM +0000, Song Bao Hua (Barry Song) wrote: > > > > From: Jason Gunthorpe [mailto:jgg@ziepe.ca] > > Sent: Tuesday, February 9, 2021 7:34 AM > > To: David Hildenbrand > > Cc: Wangzhou (B) ; 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 (Barry Song) > > ; kevin.tian@intel.com; > > jean-philippe@linaro.org; eric.auger@redhat.com; Liguozhu (Kenneth) > > ; zhangfei.gao@linaro.org; chensihang (A) > > > > Subject: Re: [RFC PATCH v3 1/2] mempinfd: Add new syscall to provide memory > > pin > > > > On Mon, Feb 08, 2021 at 09:14:28AM +0100, David Hildenbrand wrote: > > > > > People are constantly struggling with the effects of long term pinnings > > > under user space control, like we already have with vfio and RDMA. > > > > > > And here we are, adding yet another, easier way to mess with core MM in the > > > same way. This feels like a step backwards to me. > > > > Yes, this seems like a very poor candidate to be a system call in this > > format. Much too narrow, poorly specified, and possibly security > > implications to allow any process whatsoever to pin memory. > > > > I keep encouraging people to explore a standard shared SVA interface > > that can cover all these topics (and no, uaccel is not that > > interface), that seems much more natural. > > > > I still haven't seen an explanation why DMA is so special here, > > migration and so forth jitter the CPU too, environments that care > > about jitter have to turn this stuff off. > > This paper has a good explanation: > https://ieeexplore.ieee.org/stamp/stamp.jsp?tp=&arnumber=7482091 > > mainly because page fault can go directly to the CPU and we have > many CPUs. But IO Page Faults go a different way, thus mean much > higher latency 3-80x slower than page fault: > events in hardware queue -> Interrupts -> cpu processing page fault > -> return events to iommu/device -> continue I/O. The justifications for this was migration scenarios and migration is short. If you take a fault on what you are migrating only then does it slow down the CPU. Are you also working with HW where the IOMMU becomes invalidated after a migration and doesn't reload? ie not true SVA but the sort of emulated SVA we see in a lot of places? It would be much better to work improve that to have closer sync with the CPU page table than to use pinning. Jason