Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp3061823imj; Mon, 11 Feb 2019 13:10:39 -0800 (PST) X-Google-Smtp-Source: AHgI3IY/5eAP27b/cvkwng7bXD5YFPNp8RJcXgugMZNnPyvXZnX01V9TP58Ew4JFjhnfRIBeEfL4 X-Received: by 2002:a17:902:a588:: with SMTP id az8mr236163plb.77.1549919438925; Mon, 11 Feb 2019 13:10:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549919438; cv=none; d=google.com; s=arc-20160816; b=C8wJxNXzjhj+Sm8ZtLdg+1Dv2yAUhruRMPbI6+p59ZGwqbuabY70jXa2FJICYU26sK Tw5wApKLN7I8VnNzohukkFvSQ7GB0rNP+NY72my67GPlkxRE0xqT/OyzZjGCg5Q0kDty ruoejshdXdHnC0VyscNd2ZFVSulZ6RpG7iYbtA6G2bH+NQ6t7ddDbHdixYfd/j4whcwo 8elwpsFQhChh9r9vPINp1Z5hAntvT6HCvxD583aoEqfTpx7Z5vnxYiJLsxmnXnngIz87 OZRhc2rwZZDPeupyLaUmvpg4NpC2lOG8NbpjKgz/0kVe7IkYHHPbNLMHe0DA5OppqX8Z 4KQQ== 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=uYu8fhGrCPe5ORQZnf2SfiOVoXmG+qDHSpTQJMH4p34=; b=molLD6fUrkDz+AzIxDuXApHIunEZtQ6txB8YqjnW9JszklUlZ3Os5xcrmSybYXJP/E 847NM8ftLpi/fK0qZpOHOCnfdmlkMKOQGb5F19lnpbZ2JQJ7aCJC2fj5juXMOFzzwlUJ to2N9H3zTHhdCkHBKTaMssEakvGNoeY/2qlgGxcrrS9YM481D4FpKkYey7drIC2cP+Fj ZFcnz8PEyy+mSG1b7IFvIaUePnf642W7vljFScrlRTFy9MnVJOUpSUahD2/IH4eMBF0a HZvbHa1a/TUD8Sit6ZzKiHyt03p1z85wGRdxXC22wYtpQx1T7hcj85oo7ZTvsGPfFNbs HINg== 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 n7si10858079plk.18.2019.02.11.13.09.59; Mon, 11 Feb 2019 13:10:38 -0800 (PST) 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 S1727106AbfBKVIb (ORCPT + 99 others); Mon, 11 Feb 2019 16:08:31 -0500 Received: from mx1.redhat.com ([209.132.183.28]:6051 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726177AbfBKVIa (ORCPT ); Mon, 11 Feb 2019 16:08:30 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 092C65D61C; Mon, 11 Feb 2019 21:08:30 +0000 (UTC) Received: from redhat.com (ovpn-123-21.rdu2.redhat.com [10.10.123.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8DE6A60A9A; Mon, 11 Feb 2019 21:08:27 +0000 (UTC) Date: Mon, 11 Feb 2019 16:08:24 -0500 From: Jerome Glisse To: Ira Weiny Cc: Jason Gunthorpe , Dan Williams , Jan Kara , Dave Chinner , Christopher Lameter , Doug Ledford , Matthew Wilcox , lsf-pc@lists.linux-foundation.org, linux-rdma , Linux MM , Linux Kernel Mailing List , John Hubbard , Michal Hocko Subject: Re: [LSF/MM TOPIC] Discuss least bad options for resolving longterm-GUP usage by RDMA Message-ID: <20190211210824.GH3908@redhat.com> References: <01000168c8e2de6b-9ab820ed-38ad-469c-b210-60fcff8ea81c-000000@email.amazonses.com> <20190208044302.GA20493@dastard> <20190208111028.GD6353@quack2.suse.cz> <20190211102402.GF19029@quack2.suse.cz> <20190211180654.GB24692@ziepe.ca> <20190211181921.GA5526@iweiny-DESK2.sc.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20190211181921.GA5526@iweiny-DESK2.sc.intel.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Mon, 11 Feb 2019 21:08:30 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Feb 11, 2019 at 10:19:22AM -0800, Ira Weiny wrote: > On Mon, Feb 11, 2019 at 11:06:54AM -0700, Jason Gunthorpe wrote: > > On Mon, Feb 11, 2019 at 09:22:58AM -0800, Dan Williams wrote: > > > > > I honestly don't like the idea that random subsystems can pin down > > > file blocks as a side effect of gup on the result of mmap. Recall that > > > it's not just RDMA that wants this guarantee. It seems safer to have > > > the file be in an explicit block-allocation-immutable-mode so that the > > > fallocate man page can describe this error case. Otherwise how would > > > you describe the scenarios under which FALLOC_FL_PUNCH_HOLE fails? > > > > I rather liked CL's version of this - ftruncate/etc is simply racing > > with a parallel pwrite - and it doesn't fail. > > > > But it also doesnt' trucate/create a hole. Another thread wrote to it > > right away and the 'hole' was essentially instantly reallocated. This > > is an inherent, pre-existing, race in the ftrucate/etc APIs. > > I kind of like it as well, except Christopher did not answer my question: > > What if user space then writes to the end of the file with a regular write? > Does that write end up at the point they truncated to or off the end of the > mmaped area (old length)? > > To make this work I think it has to be the later. And as you say the semantic > is as if another thread wrote to the file first (but in this case the other > thread is the RDMA device). > > In addition I'm not sure what the overall work is for this case? > > John's patches will indicate to the FS that the page is gup pinned. But they > will not indicate longterm vs not "shorterm". A shortterm pin could be handled > as a "real truncate". So, are we back to needing a longterm "bit" in struct > page to indicate a longterm pin and allow the FS to perform this "virtual > write" after truncate? > > Or is it safe to consider all gup pinned pages this way? So i have been working on several patchset to convert all user that can abide to mmu notifier to HMM mirror which does not pin pages ie does not take reference on the page. So all the left over GUP users would be the long term problematic one with few exceptions: direct I/O, KVM (i think xen too but i am less familiar with that), virtio. For direct I/O i believe the ignore the truncate solution would work too. For KVM and virtio i think it only does GUP on anonymous memory. So the answer would be that it is safe to consider all pin pages as being longterm pin. Cheers, J?r?me