Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp1140254imm; Fri, 5 Oct 2018 19:51:08 -0700 (PDT) X-Google-Smtp-Source: ACcGV63qcsjas/ymozO/11Q6l+oYlouwvX+wTfT0wCz+3kTZReq1OfKwB5o6AB/fOKVKnNHe8iCL X-Received: by 2002:a63:9e02:: with SMTP id s2-v6mr8104703pgd.302.1538794268166; Fri, 05 Oct 2018 19:51:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538794268; cv=none; d=google.com; s=arc-20160816; b=No3oZqjtYRek9PxtgfV4Ejn3S6vPq2qv5dF0wCgD/otAHkbRCx3cu4UDXnC4E3/YtZ iFmLU5ms/D+5kTgf5C2cV4429FW69klZSscM7LOoOCtnFVn6LzlKxrg4YE6rMUhKxvQe nZ1/8n20Qi1bxv/h3G/32QpAjfN+rkvwfYgGiKl888bDmdiXc7WNsRneSDwjxjj7t5qg ZL/htsJs8UzliXP2mocte+NCSb3Kojq6+Fitgdq82foH68PV+maiQ9zsGXBWpsBtbND0 adfxz/aQoIoxBadlukSqgTsw60vQvGm8DmKkBB2suCY2zNwaqsi4ON1joDP3lG8n/BnT bkQw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=NWVvB4KoMztN3RfvQsH7juqXZuH+ge8yGMOqZR0qLbk=; b=FPxKiCE2ZWxMw4wIFUOlI7YNJ1mUyX5u0Mj3qT2YLhvOUrawoEhdOjvDNSnnCI9j6G QYgst6DNzyNpTcu6TzI+JpexgAjI6vllszNfI3/AZpqXZSg80Yw1NQd11Fdcyy4R8OU1 5Lw/DBdjeVvrs7/WLjgGE8LPzZuVziDXFDGn461GyPcvKRGZEhdUNmhloCNlDCwgG6SJ cegVmbGNeRE+W/VxLVK3QxUoIKE6m3XZDPprXUQhTYDIEFchmnV8fdGk+89dNDyuT05l X2t1CRlW/UPzratNu1jFnHlwZIA/gmyjEDwiSV5n13PCVni+dueYWXZWB6ItGhkwl0a7 7x3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=tJHmpJuj; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b2-v6si8214105pgg.412.2018.10.05.19.50.53; Fri, 05 Oct 2018 19:51:08 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=tJHmpJuj; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729190AbeJFJvY (ORCPT + 99 others); Sat, 6 Oct 2018 05:51:24 -0400 Received: from mail-pf1-f196.google.com ([209.85.210.196]:35916 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726812AbeJFJvY (ORCPT ); Sat, 6 Oct 2018 05:51:24 -0400 Received: by mail-pf1-f196.google.com with SMTP id l81-v6so811142pfg.3; Fri, 05 Oct 2018 19:49:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=NWVvB4KoMztN3RfvQsH7juqXZuH+ge8yGMOqZR0qLbk=; b=tJHmpJuj6//bePZPXlSMexP3IqebnIh82gjuaIdBGQuaf+VL86X7SZ15++gk3CwHPc 2Fn1TDWsH+h/ITuZ02XSImb+GR0A0uCwdBO78ygB3cN1QcWg/2VrA0rrXYD57Vct+W+Z Oh+AdHlOZTPB7BOyRUPYT7yiqy7B/fNcYz4yQAH7E+QUJLifeYphwghxxU1ILUZbWRRD GmDYPJW+25ZQ/ItnugPeAOtjrwLrdHqTkJjdxvHcOcQvr4wA5HfglhdN2DwkJ9rXY864 VIhUcMRVGLHKExqG60rKheeDiqQWTe818BUxDy45QzIcs/FYVwnoAtVxRPSNGTwO8GdC Sddw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=NWVvB4KoMztN3RfvQsH7juqXZuH+ge8yGMOqZR0qLbk=; b=h7a6g6Npcf6D/XBzImyr2Bj/3IjMTN0b9alH5Q4jdpnQSobmoHh4P2lfQJT9fTEdLn Dyq7uoZfEvLQpQOUFcyoQRVQfbii/xSJy1gaLiIt7pYoCiFJJv1Q6fcR1uj5a7/wxNau Q1lLTe1IfT+OjAqNrMigbRxXvl/kjUscZ/GUEER9e35qoW88aBPtsqIKlmwZbTXaN6fJ 9VWCgMWdNVUz9ZiFjF94ddoDPBjTgoAygdjmIGT1t9bSlhTpcj/vSnxOnPpctgj2fSq6 YV5hpbEqcImPx2RBYPQFhXNFQyq7m68/13+SzZrubdkHnwjOzHo+FOgYyHr2yqzxt9D/ AS+Q== X-Gm-Message-State: ABuFfoggpRYDNc8ofJQszpX8za8Mg9Jfx1pP5QrIARItQCWHfET/MmtN c1i/eSVcarPSE/HwO6WSjyVxpTWl X-Received: by 2002:a63:1520:: with SMTP id v32-v6mr8273824pgl.150.1538794192307; Fri, 05 Oct 2018 19:49:52 -0700 (PDT) Received: from blueforge.nvidia.com (searspoint.nvidia.com. [216.228.112.21]) by smtp.gmail.com with ESMTPSA id n63-v6sm3962785pfn.9.2018.10.05.19.49.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 05 Oct 2018 19:49:51 -0700 (PDT) From: john.hubbard@gmail.com X-Google-Original-From: jhubbard@nvidia.com To: Matthew Wilcox , Michal Hocko , Christopher Lameter , Jason Gunthorpe , Dan Williams , Jan Kara Cc: linux-mm@kvack.org, LKML , linux-rdma , linux-fsdevel@vger.kernel.org, John Hubbard , Al Viro , Jerome Glisse , Christoph Hellwig , Ralph Campbell Subject: [PATCH v3 0/3] get_user_pages*() and RDMA: first steps Date: Fri, 5 Oct 2018 19:49:46 -0700 Message-Id: <20181006024949.20691-1-jhubbard@nvidia.com> X-Mailer: git-send-email 2.19.0 MIME-Version: 1.0 X-NVConfidentiality: public Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: John Hubbard Changes since v2: -- Absorbed more dirty page handling logic into the put_user_page*(), and handled some page releasing loops in infiniband more thoroughly, as per Jason Gunthorpe's feedback. -- Fixed a bug in the put_user_pages*() routines' loops (thanks to Ralph Campbell for spotting it). Changes since v1: -- Renamed release_user_pages*() to put_user_pages*(), from Jan's feedback. -- Removed the goldfish.c changes, and instead, only included a single user (infiniband) of the new functions. That is because goldfish.c no longer has a name collision (it has a release_user_pages() routine), and also because infiniband exercises both the put_user_page() and put_user_pages*() paths. -- Updated links to discussions and plans, so as to be sure to include bounce buffers, thanks to Jerome's feedback. Also: -- Dennis, thanks for your earlier review, and I have not yet added your Reviewed-by tag, because this revision changes the things that you had previously reviewed, thus potentially requiring another look. This short series prepares for eventually fixing the problem described in [1], and is following a plan listed in [2], [3], [4]. Patch 1, although not technically critical to do now, is still nice to have, because it's already been reviewed by Jan, and it's just one more thing on the long TODO list here, that is ready to be checked off. Patch 2 is required in order to allow me (and others, if I'm lucky) to start submitting changes to convert all of the callsites of get_user_pages*() and put_page(). I think this will work a lot better than trying to maintain a massive patchset and submitting all at once. Patch 3 converts infiniband drivers: put_page() --> put_user_page(), and also exercises put_user_pages_dirty_locked(). Once these are all in, then the floodgates can open up to convert the large number of get_user_pages*() callsites. [1] https://lwn.net/Articles/753027/ : "The Trouble with get_user_pages()" [2] https://lkml.kernel.org/r/20180709080554.21931-1-jhubbard@nvidia.com Proposed steps for fixing get_user_pages() + DMA problems. [3]https://lkml.kernel.org/r/20180710082100.mkdwngdv5kkrcz6n@quack2.suse.cz Bounce buffers (otherwise [2] is not really viable). [4] https://lkml.kernel.org/r/20181003162115.GG24030@quack2.suse.cz Follow-up discussions. CC: Matthew Wilcox CC: Michal Hocko CC: Christopher Lameter CC: Jason Gunthorpe CC: Dan Williams CC: Jan Kara CC: Al Viro CC: Jerome Glisse CC: Christoph Hellwig CC: Ralph Campbell John Hubbard (3): mm: get_user_pages: consolidate error handling mm: introduce put_user_page*(), placeholder versions infiniband/mm: convert put_page() to put_user_page*() drivers/infiniband/core/umem.c | 7 +-- drivers/infiniband/core/umem_odp.c | 2 +- drivers/infiniband/hw/hfi1/user_pages.c | 11 ++--- drivers/infiniband/hw/mthca/mthca_memfree.c | 6 +-- drivers/infiniband/hw/qib/qib_user_pages.c | 11 ++--- drivers/infiniband/hw/qib/qib_user_sdma.c | 8 ++-- drivers/infiniband/hw/usnic/usnic_uiom.c | 7 +-- include/linux/mm.h | 48 ++++++++++++++++++++- mm/gup.c | 37 +++++++++------- 9 files changed, 92 insertions(+), 45 deletions(-) -- 2.19.0