Received: by 2002:ac0:950c:0:0:0:0:0 with SMTP id f12csp3244926imc; Wed, 13 Mar 2019 12:35:10 -0700 (PDT) X-Google-Smtp-Source: APXvYqzv2/e3U/FeAuJ65tmQzp3WtZSdBvwDXfDnbFcr1ZN6KADYic7WJCQUk5rZzq2eOF59HPCA X-Received: by 2002:a17:902:a40d:: with SMTP id p13mr45949730plq.144.1552505709985; Wed, 13 Mar 2019 12:35:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552505709; cv=none; d=google.com; s=arc-20160816; b=eX5XKQsSK+CNB6tRVI+ngBs7ufLE0uTEM0wG4CMgF42GLCo9l9yE4ijamOjwhWxtTo lmUXW9yyqrZzaWLIi9+IpPRFd2QrjJbcCWVOnVexQYBCW3GprJZ0J7BDdhI2f6IBrlCx UAue2Sc/z5J1MqVJMHhtQzrKLPuSpY+YFRq1rB1KmRNtSILTlc+VFdaN3Kevh2neQDVA YBpWmu3ihYOdB2Ozcs1/pgMuIJt8i5dUpHgzVFMjtITXV/vMxUrhnD0qwwkK84yGrmT+ KObBnzCjsQQ6x3krKRdcphHV2lkKYb7feRbsFMrIey4w/cN8zwDT4vBU2sTtkrSytOUF Aqlw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=/BSwW1LdD9SAPcWqiUczSSFz4KPA6Esz9jiu7oqG/Uw=; b=1AeHv4118o7rRL78vIJEppsZllfLeH8DuKib7bcoji/0a7wcEOSC/idIHAyLmXgU8i K2dXe7lbcjtuoYzVzIAdIQbCLT0B1yZqVDYS7vtROE6k/urSl3HjPqKyDM9sZjdtjTy8 /Newpfjssg9RJX6jCbLuzGNGNT94jh5ISntzFLuYIYvSsMXowilUU+qsHVo+OfVS6mBt jkH6e0QqRgMDMoJ96T4ArJ4LNneyR53Vp09Ds1R7I4MZpjNi/iyIC256DJXcd8rCnC4M Poof11X3ptba7qsLMj+lu08CFzK6DikbHdjG7+9zNiSJq69Z/waHYr4sv+QpY7qhUf8r KPTw== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s4si10639616pgm.426.2019.03.13.12.34.53; Wed, 13 Mar 2019 12:35:09 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727591AbfCMTdf (ORCPT + 99 others); Wed, 13 Mar 2019 15:33:35 -0400 Received: from mx1.redhat.com ([209.132.183.28]:51580 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727073AbfCMTdd (ORCPT ); Wed, 13 Mar 2019 15:33:33 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 279E53092669; Wed, 13 Mar 2019 19:33:33 +0000 (UTC) Received: from redhat.com (ovpn-125-95.rdu2.redhat.com [10.10.125.95]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9F62F5ED2B; Wed, 13 Mar 2019 19:33:30 +0000 (UTC) Date: Wed, 13 Mar 2019 15:33:28 -0400 From: Jerome Glisse To: Christopher Lameter Cc: john.hubbard@gmail.com, Andrew Morton , linux-mm@kvack.org, Al Viro , Christian Benvenuti , Christoph Hellwig , Dan Williams , Dave Chinner , Dennis Dalessandro , Doug Ledford , Ira Weiny , Jan Kara , Jason Gunthorpe , Matthew Wilcox , Michal Hocko , Mike Rapoport , Mike Marciniszyn , Ralph Campbell , Tom Talpey , LKML , linux-fsdevel@vger.kernel.org, John Hubbard Subject: Re: [PATCH v3 0/1] mm: introduce put_user_page*(), placeholder versions Message-ID: <20190313193328.GA4785@redhat.com> References: <20190306235455.26348-1-jhubbard@nvidia.com> <010001695b4631cd-f4b8fcbf-a760-4267-afce-fb7969e3ff87-000000@email.amazonses.com> <20190308190704.GC5618@redhat.com> <01000169703e5495-2815ba73-34e8-45d5-b970-45784f653a34-000000@email.amazonses.com> <20190312153528.GB3233@redhat.com> <01000169787c61d0-cbc5486e-960a-492f-9ac9-9f6a466efeed-000000@email.amazonses.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <01000169787c61d0-cbc5486e-960a-492f-9ac9-9f6a466efeed-000000@email.amazonses.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]); Wed, 13 Mar 2019 19:33:33 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Mar 13, 2019 at 07:16:51PM +0000, Christopher Lameter wrote: > On Tue, 12 Mar 2019, Jerome Glisse wrote: > > > > > This has been discuss extensively already. GUP usage is now widespread in > > > > multiple drivers, removing that would regress userspace ie break existing > > > > application. We all know what the rules for that is. > > You are still misstating the issue. In RDMA land GUP is widely used for > anonyous memory and memory based filesystems. *Not* for real filesystems. Then why are they bug report as one pointed out in cover letter ? It means someone is doing GUP on filesystem. Moreover looking at RDMA driver i do not see anything that check that VA for GUP belongs to a vma that is not back by a regular file. > > > > Because someone was able to get away with weird ways of abusing the system > > > it not an argument that we should continue to allow such things. In fact > > > we have repeatedly ensured that the kernel works reliably by improving the > > > kernel so that a proper failure is occurring. > > > > Driver doing GUP on mmap of regular file is something that seems to > > already have widespread user (in the RDMA devices at least). So they > > are active users and they were never told that what they are doing > > was illegal. > > Not true. Again please differentiate the use cases between regular > filesystem and anonyous mappings. Again where does the bug comes from ? Where in RDMA is the check that VA belong to a vma that is not back by a file ? > > > > Well swapout cannot occur if the page is pinned and those pages are also > > > often mlocked. > > > > I would need to check the swapout code but i believe the write to disk > > can happen before the pin checks happens. I believe the event flow is: > > map read only, allocate swap, write to disk, try to free page which > > checks for pin. So that you could write stale data to disk and the GUP > > going away before you perform the pin checks. > > Allocate swap is a separate step that associates a swap entry to an > anonymous page. > > > They are other thing to take into account and that need proper page > > dirtying, like soft dirtyness for instance. > > RDMA mapped pages are all dirty all the time. Point is the pte dirty bit might not be accurate nor the soft dirty bit because GUP user does not update those bits and thus GUP user need to call the set_page_dirty or similar to properly report page dirtyness. > > Well RDMA driver maintainer seems to report that this has been a valid > > and working workload for their users. > > No they dont. > > Could you please get up to date on the discussion before posting? Again why is there bug report ? Where is the code in RDMA that check that VA does not belong to vma that is back by a file ? As much as i would like that this use case did not exist i fear it does and it has been upstream for a while. This also very much apply to O_DIRECT wether you like it or not. Cheers, J?r?me