Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp1059888pxb; Wed, 29 Sep 2021 16:08:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz43l2bxJpPY3Cmegiy8RWuLSBG6TaJVbBtl7sJhoa4j88k6hub9JdFmGTJLaIg1Ys7IsSr X-Received: by 2002:a17:906:5a43:: with SMTP id my3mr2967839ejc.473.1632956912816; Wed, 29 Sep 2021 16:08:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632956912; cv=none; d=google.com; s=arc-20160816; b=XA9xOPYe64JdUKBrrBwQ48nMK334Oxjk4Lg+bv8I8KO1+AVCc8BJR6SSu+2Xkcqjld fGk8pXm55ent1OB4vxnE8kCtOU8ax/DFmyZ+r1BRDjN2cLvSSfRysgA/+klfTdr7SoX8 GcsgeXXvcqNk/1JpvumXOAHWBpQWkH79dX+eghsRkDJUnVkVAyM3+JwtHqxdHgYz/Xg3 pqX51o7yLWCj384RK657zsYl5YWrT0hhKDtWJmzHeDP6fmHR4yRWGFdF0k8i6FvJCJDQ KH3eqVhPniopfLB2Xo5Q+uvZvTf85ecyi0OJck9kjZieY9kPGBnxh6TvCFNn54EJmAfa NLjg== 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; bh=Rb14cjSJqqt1iOg7v1WUt5AVmuRSH7cZOE8ujwxMcMg=; b=eeKaTwMsonENvWBaU8yaASSd7igNcoofFUaPkS5NpyAH0YCdMxLHMK3Jj9VasfK3Ba XT3zO+0QIrkzNecr8KjJ4aC7wU2gZDx7hPQQGylWAHk2qur/h0AfW6TWLkhwwHXPb5Yl CYogkX+ca8Hau1LnIAzOuac1K2qy8lXrNSBOr/HwxQN0I5EfYKXqZ+ger2kmNZeW2702 uMeij10MynHqh8qBI0KSImb3IF11kK5qKaIZqNlc5iOiClZk+HgGnXNDzj8NyjKg/X7x OTlp1EPC+ppnBUuktJTwhpjXX4GOAzNu3EhFGdGub0cWuyRpwVCXWhM4zedPsXJD9KJA m1hQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ziepe.ca header.s=google header.b=DIaskCn5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p10si1615736ejo.13.2021.09.29.16.08.01; Wed, 29 Sep 2021 16:08:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@ziepe.ca header.s=google header.b=DIaskCn5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347397AbhI2XH2 (ORCPT + 99 others); Wed, 29 Sep 2021 19:07:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50168 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347409AbhI2XH1 (ORCPT ); Wed, 29 Sep 2021 19:07:27 -0400 Received: from mail-qt1-x829.google.com (mail-qt1-x829.google.com [IPv6:2607:f8b0:4864:20::829]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D4915C061768 for ; Wed, 29 Sep 2021 16:05:45 -0700 (PDT) Received: by mail-qt1-x829.google.com with SMTP id e16so3898448qte.13 for ; Wed, 29 Sep 2021 16:05:45 -0700 (PDT) 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=Rb14cjSJqqt1iOg7v1WUt5AVmuRSH7cZOE8ujwxMcMg=; b=DIaskCn5WR5tA6jhdOqyO4JGz4+XatRitSbJTb+kmIqDsCr01GjZ0p3lPuKzblpDJT zhfIKMKyyPJmhP4fwKW9s1DOIPeWnXpgnGWww2ZsqZXMAXwagCxFkdbr/ZZNpdbvhNz6 yhMxNtaJ4799pZOw9yof96R6NI1pis1TXcHgXiz2OGYJ2JTRjUBWxNfY9Bnx4SBlBLHZ NOkoZJeyzIFho5nhxKuuBqHTm7LkOuC/VLVY0i+EnUBy4CEUt/GqO7FcsIRDEUISOa/r ebsfSg+Kyd8gPXIldmrnVbOFPyE5xD126E/0FnMFaQl4NuKh0l+VCCKdHBolF0rJnHvM E9AA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=Rb14cjSJqqt1iOg7v1WUt5AVmuRSH7cZOE8ujwxMcMg=; b=YFzDJR+tBDN0OVcXpJ6Fe5ZnHa1L3fUoSpUI76sv7E1FhP/728lh2Q+O/IziLndQKg 9RQYw+sguHYipg85sxCtoFkFnfGW89K934G3pfRp7vaDlEjwm1N3U5duJp/h6PiN1p/z BjbdBSh4rZ5znjC8scBxVNpV9Hkikyt5UzVdaHV5Aj0fe0CSzbbtA/MjJQ2TfriUCruy QEgpg+6Ake6U9hTfTuBYkAI8UPZhxj5tUH5fKjVBgqBfbtZ3mfN8KqlafwiYLg7jrBo2 UZdOdtXliLxUS2EUd7uPEIoeUOShVU+ohnQ4nUBEOJ1LfonVvkif7AMeic+PbH2xaZmR ZpPg== X-Gm-Message-State: AOAM531uzBy7C4lp3nCz1d1IfeWCki5yJnjPQzoJnyhSZVgPXEh7jrjH P1VMyoEzyDlb4DP/FRCI4/C0pg== X-Received: by 2002:ac8:7613:: with SMTP id t19mr2882513qtq.365.1632956745011; Wed, 29 Sep 2021 16:05:45 -0700 (PDT) Received: from ziepe.ca (hlfxns017vw-142-162-113-129.dhcp-dynamic.fibreop.ns.bellaliant.net. [142.162.113.129]) by smtp.gmail.com with ESMTPSA id h4sm645980qtj.83.2021.09.29.16.05.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Sep 2021 16:05:44 -0700 (PDT) Received: from jgg by mlx with local (Exim 4.94) (envelope-from ) id 1mVidz-007iU5-Sx; Wed, 29 Sep 2021 20:05:43 -0300 Date: Wed, 29 Sep 2021 20:05:43 -0300 From: Jason Gunthorpe To: Logan Gunthorpe Cc: linux-kernel@vger.kernel.org, linux-nvme@lists.infradead.org, linux-block@vger.kernel.org, linux-pci@vger.kernel.org, linux-mm@kvack.org, iommu@lists.linux-foundation.org, Stephen Bates , Christoph Hellwig , Dan Williams , Christian =?utf-8?B?S8O2bmln?= , John Hubbard , Don Dutile , Matthew Wilcox , Daniel Vetter , Jakowski Andrzej , Minturn Dave B , Jason Ekstrand , Dave Hansen , Xiong Jianxin , Bjorn Helgaas , Ira Weiny , Robin Murphy , Martin Oliveira , Chaitanya Kulkarni Subject: Re: [PATCH v3 19/20] PCI/P2PDMA: introduce pci_mmap_p2pmem() Message-ID: <20210929230543.GB3544071@ziepe.ca> References: <20210916234100.122368-1-logang@deltatee.com> <20210916234100.122368-20-logang@deltatee.com> <20210928195518.GV3544071@ziepe.ca> <8d386273-c721-c919-9749-fc0a7dc1ed8b@deltatee.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <8d386273-c721-c919-9749-fc0a7dc1ed8b@deltatee.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Sep 29, 2021 at 03:42:00PM -0600, Logan Gunthorpe wrote: > The main reason is probably this: if we don't use VM_MIXEDMAP, then we > can't set pte_devmap(). I think that is an API limitation in the fault routines.. finish_fault() should set the pte_devmap - eg by passing the PFN_DEV|PFN_MAP somehow through the vma->vm_page_prot to mk_pte() or otherwise signaling do_set_pte() that it should set those PTE bits when it creates the entry. (or there should be a vmf_* helper for this special case, but using the vmf->page seems righter to me) > If we don't set pte_devmap(), then every single page that GUP > processes needs to check if it's a ZONE_DEVICE page and also if it's > a P2PDMA page (thus dereferencing pgmap) in order to satisfy the > requirements of FOLL_PCI_P2PDMA. Definately not suggesting not to set pte_devmap(), only that VM_MIXEDMAP should not be set on VMAs that only contain struct pages. That is an abuse of what it is intended for. At the very least there should be a big comment above the usage explaining that this is just working around a limitation in finish_fault() where it cannot set the PFN_DEV|PFN_MAP bits today. Jason