Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp2409726ioo; Sat, 28 May 2022 12:43:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz+8Tnj9T1jwq/iR4BCqLDIEwaB8issfAyyJbeqimGzsdr1iWfHg5RNHc8X2dWHB/Lmurr4 X-Received: by 2002:a17:90a:55cc:b0:1e0:c4a7:4a59 with SMTP id o12-20020a17090a55cc00b001e0c4a74a59mr14969387pjm.127.1653766993001; Sat, 28 May 2022 12:43:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653766992; cv=none; d=google.com; s=arc-20160816; b=IUZDjxZBv9AXSJWCDa/ErnDxbJdB831IADP8Lu1pTcMcGQCZHSLtYJTeolsJ7KapsN O5xDKaMUTGgTlN1s6tKAV8DVIQLIiQNZkVLVrQ11uEl5kY2M+h40X4hHfAj+XV2Kvutu CsHGz79zdzDiQ54hOifcClvBIrd1duNS31IwMzp4gRIMbn9X9m2Hn6Uv/HF7RC99mTJc 8OFMSoD2A/zKuP8H6fS+thfGYbGTMAuX/5uiuYper5Jm3k6zzlBWn9pUuwTwiFBzqrTr z4L9UlDZoGlKVIyLfv7gaHkIoHj7BTxI+JZjWItVZCutpbXyAVGZhdJkOBgwM14bCWVE rlow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:subject:content-transfer-encoding:in-reply-to :from:references:cc:to:content-language:user-agent:mime-version:date :message-id:dkim-signature; bh=iVJ9fBLNdTiKEt9G340BRFfSyp3FLS4feBnXCUGEiYw=; b=bsUn6MTRFnEin10+Zp3XETFBCnDF8YU1Nz+5nwpGNUgw6JFZbinf48DH9sURxUQtXC wC4c3S77kqSSmI4aDBCzqgYL0PYEWcMJgR7IijZrW2rhfKLDDnu1EorfruFzeyugTK+E PjfIxpZMFvl++MumVBCMF5DIBTZmo1exRjFHFTkwfU1Nr4dhkZunwemN7waPn+M7piMk ncXALOxFzcgysTDa4Xjl6KbN/y/3XybihKKL5rKzTgoFD9LwinmGB4COenPIxk32xLbB mq0mCbOuMrd0DTj23J/1cwWHbpxPYGGqodTaYKX6Q/clq3T94zTCfymhvIHPVkWBhnL0 80kw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@deltatee.com header.s=20200525 header.b=LK0tOmWx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=deltatee.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id c15-20020a63350f000000b003f2470e8183si10969434pga.605.2022.05.28.12.43.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 May 2022 12:43:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@deltatee.com header.s=20200525 header.b=LK0tOmWx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=deltatee.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 5D53326DF; Sat, 28 May 2022 12:06:25 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353506AbiE0PfX (ORCPT + 99 others); Fri, 27 May 2022 11:35:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53748 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243719AbiE0PfU (ORCPT ); Fri, 27 May 2022 11:35:20 -0400 Received: from ale.deltatee.com (ale.deltatee.com [204.191.154.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F2E00FC4FA; Fri, 27 May 2022 08:35:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=deltatee.com; s=20200525; h=Subject:In-Reply-To:From:References:Cc:To: MIME-Version:Date:Message-ID:content-disposition; bh=iVJ9fBLNdTiKEt9G340BRFfSyp3FLS4feBnXCUGEiYw=; b=LK0tOmWxLk3f/jP34DJDcVbw9k 7FkvN62gBPKgtF5GHbzQjRxhicgPqm2Y0f6rnJC1wzsiq1VPMUwE7lbhyg2Wb2wmOtwdosFsCyBev C+pH6Z+zfZFV7DK2Lq/L4Fx9Tzo2Esnbtf4idNVxuPx/hUdAsdtZJB+bGTuxqU8ZC6esYn25HCHlP C7mzMuI1d9VM5EbOwJRlj828gX7M9YfiT/tDp8fR8eVX8rPBMx/i1jYJg8S3l83aYSY8Rbxegbl79 BKGvmLPOAVF+yorF40Wo/OhfP9diUw8Y3r/R2PGBoTMq+LtTE3+tHiLIwGLa7GSO7vvraU/8nFe0e 5weL+HIA==; Received: from guinness.priv.deltatee.com ([172.16.1.162]) by ale.deltatee.com with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1nubze-0093NF-Rc; Fri, 27 May 2022 09:35:15 -0600 Message-ID: Date: Fri, 27 May 2022 09:35:07 -0600 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.0 Content-Language: en-CA To: Jason 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 , =?UTF-8?Q?Christian_K=c3=b6nig?= , 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 , Ralph Campbell , Bjorn Helgaas References: <20220407154717.7695-1-logang@deltatee.com> <20220407154717.7695-21-logang@deltatee.com> <20220527125501.GD2960187@ziepe.ca> From: Logan Gunthorpe In-Reply-To: <20220527125501.GD2960187@ziepe.ca> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-SA-Exim-Connect-IP: 172.16.1.162 X-SA-Exim-Rcpt-To: jgg@ziepe.ca, 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, sbates@raithlin.com, hch@lst.de, dan.j.williams@intel.com, christian.koenig@amd.com, jhubbard@nvidia.com, ddutile@redhat.com, willy@infradead.org, daniel.vetter@ffwll.ch, andrzej.jakowski@intel.com, dave.b.minturn@intel.com, jason@jlekstrand.net, dave.hansen@linux.intel.com, jianxin.xiong@intel.com, helgaas@kernel.org, ira.weiny@intel.com, robin.murphy@arm.com, martin.oliveira@eideticom.com, ckulkarnilinux@gmail.com, rcampbell@nvidia.com, bhelgaas@google.com X-SA-Exim-Mail-From: logang@deltatee.com X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Spam-Level: X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,RDNS_NONE,SPF_HELO_NONE, T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 Subject: Re: [PATCH v6 20/21] PCI/P2PDMA: Introduce pci_mmap_p2pmem() X-SA-Exim-Version: 4.2.1 (built Sat, 13 Feb 2021 17:57:42 +0000) X-SA-Exim-Scanned: Yes (on ale.deltatee.com) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2022-05-27 06:55, Jason Gunthorpe wrote: > On Thu, Apr 07, 2022 at 09:47:16AM -0600, Logan Gunthorpe wrote: >> +static void pci_p2pdma_unmap_mappings(void *data) >> +{ >> + struct pci_dev *pdev = data; >> + struct pci_p2pdma *p2pdma = rcu_dereference_protected(pdev->p2pdma, 1); >> + >> + /* Ensure no new pages can be allocated in mappings */ >> + p2pdma->active = false; >> + synchronize_rcu(); >> + >> + unmap_mapping_range(p2pdma->inode->i_mapping, 0, 0, 1); >> + >> + /* >> + * On some architectures, TLB flushes are done with call_rcu() >> + * so to ensure GUP fast is done with the pages, call synchronize_rcu() >> + * before freeing them. >> + */ >> + synchronize_rcu(); >> + pci_p2pdma_free_mappings(p2pdma->inode->i_mapping); > > With the series from Felix getting close this should get updated to > not set pte_devmap and use proper natural refcounting without any of > this stuff. Can you send a link? I'm not sure what you are referring to. Thanks, Logan