Received: by 2002:a05:6358:bb9e:b0:b9:5105:a5b4 with SMTP id df30csp4150706rwb; Tue, 6 Sep 2022 03:25:26 -0700 (PDT) X-Google-Smtp-Source: AA6agR5faKBNN/B5DSkdYKr1uaE6jA3QVYujHplsv6xZZqjU2RAQHZFj79ZndPQW51DmqyTmbDP6 X-Received: by 2002:a17:90b:1d88:b0:1fd:e032:78bb with SMTP id pf8-20020a17090b1d8800b001fde03278bbmr23748698pjb.126.1662459925802; Tue, 06 Sep 2022 03:25:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662459925; cv=none; d=google.com; s=arc-20160816; b=MmDC63HQx4fKHRWCHyNBLu4Fj4EqEdAsWJsuis/HEbPrQlqZPCE3PsmZ0n+kpCh+LJ brYconVYphdWwW6L20ElTOYfEd7hTSDEv8FSW5Yyj34m/1G066kQ9af4MRSOaBRhvoy7 s1uPKby+4iIWBQJ5aV0+gLNKk2dsRP2+B0jIEBJf+nLSB+/L+RybHKe9ZpYdGNSrUoJv pxFF8cu4DS+JQFZShFhRhO38bRltqZGPHCDAglAhk0k46ssYiGM951Ka0KaCpsqK43/D E5CRvC4Vq0ZBIyL2EGtPayezHhuOZus9t8BKcaGLgOoWnZWfr6I8BwDqPTR9x9hrk7Hd oxDA== 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-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature :dkim-signature; bh=JRzzxJnv5MaykTq7esKm/SId3jWkWiPAdjMo5oqrhRE=; b=GGPpzeEOB5jublYPJQ1ouDio0Q/EhSh+OaPJ5UCLwwzCkA8yijgdMZvtgBYP98EGJz sI6V/gBJ7F9HqL7c6UR8Mt54iOYogRB6M/4fghcl9s02AcWQx9CLfw/vReYr67nXEatb tzz6ZqFLgGuLz5OCZua4GbfjgxsjuM2IHdA/4TItJa7q27BdZsGaBJ7TKNyoV4o9x32Z bRjkFiX133APxosOpB34ymfG05aaDDzicYuI5zDJikLmvWWFpIH2l3MnWRR2+EwF7tiT x3IyT4GydZO5UOtXu95/NseC3CmqQAdxZSgbwBIpv+QCMURkvUaiklHE/E+oiy84csGa pkOw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=KxJvAYQm; dkim=neutral (no key) header.i=@suse.cz; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q12-20020a170902dacc00b001754bb3be28si14532922plx.415.2022.09.06.03.25.04; Tue, 06 Sep 2022 03:25:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=KxJvAYQm; dkim=neutral (no key) header.i=@suse.cz; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239279AbiIFKVR (ORCPT + 99 others); Tue, 6 Sep 2022 06:21:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56254 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232752AbiIFKVM (ORCPT ); Tue, 6 Sep 2022 06:21:12 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D4A5B41D28; Tue, 6 Sep 2022 03:21:08 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 8B1691F9B8; Tue, 6 Sep 2022 10:21:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1662459667; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=JRzzxJnv5MaykTq7esKm/SId3jWkWiPAdjMo5oqrhRE=; b=KxJvAYQmECJdKHflrlphoK6jMea5m356jipctQWsyyBn2mXvuIKqE/JpJczXYmkvoH9nO8 NoOB88iSwiI2Ub8MVRt1ql+V2Du8naLMoby+IJylMg9zSLiTlT9sPsRaZXQbR44F6irWgs wfZCT1dxVKV4e5PjvHq5w10DQUscpmI= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1662459667; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=JRzzxJnv5MaykTq7esKm/SId3jWkWiPAdjMo5oqrhRE=; b=plZXEtxGbS1qVODpVEpx1mvVcKzPPQXJbGzq02JAcGOhoP0DN1kZuv58cv4wa0hVHaZblC 6/YkhJlMFnkIsNAA== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 6F33D13A7A; Tue, 6 Sep 2022 10:21:07 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id M/EfGxMfF2POBgAAMHmgww (envelope-from ); Tue, 06 Sep 2022 10:21:07 +0000 Received: by quack3.suse.cz (Postfix, from userid 1000) id 053EBA067E; Tue, 6 Sep 2022 12:21:06 +0200 (CEST) Date: Tue, 6 Sep 2022 12:21:06 +0200 From: Jan Kara To: Christoph Hellwig Cc: John Hubbard , Andrew Morton , Jens Axboe , Alexander Viro , Miklos Szeredi , "Darrick J . Wong" , Trond Myklebust , Anna Schumaker , Jan Kara , David Hildenbrand , Logan Gunthorpe , linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-xfs@vger.kernel.org, linux-nfs@vger.kernel.org, linux-mm@kvack.org, LKML Subject: Re: [PATCH v2 4/7] iov_iter: new iov_iter_pin_pages*() routines Message-ID: <20220906102106.q23ovgyjyrsnbhkp@quack3> References: <20220831041843.973026-1-jhubbard@nvidia.com> <20220831041843.973026-5-jhubbard@nvidia.com> <103fe662-3dc8-35cb-1a68-dda8af95c518@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org On Tue 06-09-22 00:48:49, Christoph Hellwig wrote: > On Tue, Sep 06, 2022 at 12:44:28AM -0700, John Hubbard wrote: > > OK, that part is clear. > > > > > - for the pin case don't use the existing bvec helper at all, but > > > copy the logic for the block layer for not pinning. > > > > I'm almost, but not quite sure I get the idea above. Overall, what > > happens to bvec pages? Leave the get_page() pin in place for FOLL_GET > > (or USE_FOLL_GET), I suppose, but do...what, for FOLL_PIN callers? > > Do not change anyhing for FOLL_GET callers, as they are on the way out > anyway. > > For FOLL_PIN callers, never pin bvec and kvec pages: For file systems > not acquiring a reference is obviously safe, and the other callers will > need an audit, but I can't think of why it woul ever be unsafe. Are you sure about "For file systems not acquiring a reference is obviously safe"? I can see places e.g. in orangefs, afs, etc. which create bvec iters from pagecache pages. And then we have iter_file_splice_write() which creates bvec from pipe pages (which can also be pagecache pages if vmsplice() is used). So perhaps there are no lifetime issues even without acquiring a reference (but looking at the code I would not say it is obvious) but I definitely don't see how it would be safe to not get a pin to signal to filesystem backing the pagecache page that there is DMA happening to/from the page. Honza -- Jan Kara SUSE Labs, CR