Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp5206210pxb; Tue, 28 Sep 2021 12:56:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzAI0QssaXdCOgxSXVAJLway/t5+Hk5CcJ2vBxvEILAU4Dpg4BnazQyoHfJZLi3xoyl2jar X-Received: by 2002:a63:5a62:: with SMTP id k34mr641286pgm.8.1632858991354; Tue, 28 Sep 2021 12:56:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632858991; cv=none; d=google.com; s=arc-20160816; b=V/8PIHLuQKM4TyR1DeSwfev+nxyAqTXnvGK8YmC31MD0KVcn8zNoIP1STayptfXM6Y rS7jRnUBLv6E860QPanI6BGM/nKhNfWJtLDfh9kqaEglWA2Vri+k7DrMyF8ijNXJetG3 Crcnrju6LRQOlcLZAukWnLQS62Z6+ipmiBi6uj/8n21cyBR/AF2hGb40UIZG3kbIpyWC RMR1TBDKTDVG0ryZSPATJ43FAndbXn30oPzkjvSi3GVS45mw0jdOThFt0vHRyg3Gj7MP pTpbNEyNYPiAbDxmhLuedhiDyYV0D7FbuqLTvIHRGuaKdzT8Dt0eZuI7X0rAj6Q+PwGz nQZg== 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=1dkOoEowsVEai15whHpEaoKklD3em5dZIMAiSQ/NBXA=; b=gL9LQ70cteM6O2wOlhe26BWefbA9ZXH3gjUhN5tjyrt4jUbcsRnNkXBq3wSv3Mc9Ui 9TAd7eprvvgDKwN6TTrlnJSG8Owy+BBN/9xCbWiDVfVob8Gex0Tu49joHDvS2SkLcNhO t72M3BxCVZH9+SVMIcQTMlPu8ruOAPVNhZIFutxbqF8OYTdWiTiu7b6hSDhI+cBbcclO qDkAx8ITEoZ+aD9j29VGXH0v2n8f7kRSOFcrnQ6Q600oOoBd9gxA1Q48Ovf/IDzryGxS X7RKEByMFhveY4fibaQyCx/7KoWC9EX3hL41eD6QjNQImpGZpBU2Y+H5cOhEe71AkWaM Ae0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ziepe.ca header.s=google header.b=ZeD06VES; 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 q4si26581424pln.411.2021.09.28.12.56.18; Tue, 28 Sep 2021 12:56:31 -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=ZeD06VES; 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 S242533AbhI1T5B (ORCPT + 99 others); Tue, 28 Sep 2021 15:57:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43896 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242470AbhI1T5B (ORCPT ); Tue, 28 Sep 2021 15:57:01 -0400 Received: from mail-io1-xd2a.google.com (mail-io1-xd2a.google.com [IPv6:2607:f8b0:4864:20::d2a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 60358C061746 for ; Tue, 28 Sep 2021 12:55:21 -0700 (PDT) Received: by mail-io1-xd2a.google.com with SMTP id s20so124679ioa.4 for ; Tue, 28 Sep 2021 12:55:21 -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=1dkOoEowsVEai15whHpEaoKklD3em5dZIMAiSQ/NBXA=; b=ZeD06VESIVwTz1xeRXSBHGWRRwsuqhJZqQwA7cS8w7S36OQJ9M42GPOt60GoPm4LLN EhyE/ygXrJFIONCKDGKyPvXji5TLlEPtth9nQsRZuy/IeYGcjbWWP7tWPdZ/g49vlVEV D4ziTYxHr8njp8La9hvWgYGQygcfX8fs0pN+lyR+t1RqdyHwC/7j9ctRh39DBoSxrCAF W7fZNVt8JY3zn5Gg4p3VkhBgFht+DBRN4Umj8cH8EE9Lo3YE6taSK+G2eOxlcDNL8a69 u/eiBSoiyJw8GFFxy3BA4RXuA7thqLvfHkJROM11lKZey1rvl8Ml9UFTDNyZ2L/Vl66Z 9YzA== 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=1dkOoEowsVEai15whHpEaoKklD3em5dZIMAiSQ/NBXA=; b=zb4W0lj7xGkEcGcgNH9wRiyi14EnCRv9M8O88K/QmPF0UVdvDICU0k+rm0lCTqhL55 OHmMwTy30wLvbNqRZBgD4iRtzaTy1fc9kSVfiS9K8I80Bvg+k0kqmF1VB0e9HiwBM5fF HH9knuIugGkDFnIqZJzZxItOFxYTwia97Rk0ldkyYQLlj7xzNdCwZIjwG1wOVc875BeJ b+TYd+5uk0JyKmaZSoQZyjuLm29qqkzw+zSvfrasDQUnyyVGMMhalgmEV9WuTvJF+XI5 av6KZhrB9TSGl4ika/UCth2MpEG1eWvweNR2r6ZkpmX3dt2Abjag8p3PKCt+qDXMUm6N 9u9A== X-Gm-Message-State: AOAM531iO6e7fmsCSRs2U5VSJfNuiDGjLHdBXgYry5nWAwDmoq5oF/jS 3ysLE/DAuzE9fXo2rrdYG7+npQ== X-Received: by 2002:a5e:c018:: with SMTP id u24mr5346781iol.129.1632858920781; Tue, 28 Sep 2021 12:55:20 -0700 (PDT) Received: from ziepe.ca ([206.223.160.26]) by smtp.gmail.com with ESMTPSA id r20sm30511ioh.19.2021.09.28.12.55.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Sep 2021 12:55:20 -0700 (PDT) Received: from jgg by mlx with local (Exim 4.94) (envelope-from ) id 1mVJCA-007Gjs-VN; Tue, 28 Sep 2021 16:55:18 -0300 Date: Tue, 28 Sep 2021 16:55:18 -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: <20210928195518.GV3544071@ziepe.ca> References: <20210916234100.122368-1-logang@deltatee.com> <20210916234100.122368-20-logang@deltatee.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210916234100.122368-20-logang@deltatee.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Sep 16, 2021 at 05:40:59PM -0600, Logan Gunthorpe wrote: > +int pci_mmap_p2pmem(struct pci_dev *pdev, struct vm_area_struct *vma) > +{ > + struct pci_p2pdma_map *pmap; > + struct pci_p2pdma *p2pdma; > + int ret; > + > + /* prevent private mappings from being established */ > + if ((vma->vm_flags & VM_MAYSHARE) != VM_MAYSHARE) { > + pci_info_ratelimited(pdev, > + "%s: fail, attempted private mapping\n", > + current->comm); > + return -EINVAL; > + } > + > + pmap = pci_p2pdma_map_alloc(pdev, vma->vm_end - vma->vm_start); > + if (!pmap) > + return -ENOMEM; > + > + rcu_read_lock(); > + p2pdma = rcu_dereference(pdev->p2pdma); > + if (!p2pdma) { > + ret = -ENODEV; > + goto out; > + } > + > + ret = simple_pin_fs(&pci_p2pdma_fs_type, &pci_p2pdma_fs_mnt, > + &pci_p2pdma_fs_cnt); > + if (ret) > + goto out; > + > + ihold(p2pdma->inode); > + pmap->inode = p2pdma->inode; > + rcu_read_unlock(); > + > + vma->vm_flags |= VM_MIXEDMAP; Why is this a VM_MIXEDMAP? Everything fault sticks in here has a struct page, right? Jason