Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp5214188pxb; Tue, 28 Sep 2021 13:08:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz/jwWGlT2rWH2cZGJsfO0LayzqqxlJOjnuZ5E5Uu6OpE/fBVOFLj8YzXuJIysBQv1YYeFO X-Received: by 2002:a63:798f:: with SMTP id u137mr6235987pgc.321.1632859692286; Tue, 28 Sep 2021 13:08:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632859692; cv=none; d=google.com; s=arc-20160816; b=HeG7LvjkVFEYHDLkCyEOaQK00G/mUti82OPyqdypUYNQUhr4U5i3hknBdilBWNEXFK yDOEAzSUDNb5b+2bPhQTGu8PvQ7PDqyyAtrGp5rb+oOfzVCQvzlHHHqf6cQGE7wVx0T6 /M/IfkdWmdi6A9OP97aTkJtAwoGKn4/Of7NKMYxINXAB/eElC7Os2CVDs/67UKMswgXj H3rOgczwvt4dD9CaZSaEGSGozxEQxKTnGQYTO4zndXuq5bUi9khGGmjZXyWQwpC8jhom AtyUX5OEDSvty3Ho69tVQUtYQVaO9KskqWsHJl5HVK8fKi6HdGlXzB6iKWbTuAjYe+Kp g82w== 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=cW8g3RMiiX7YozMyBpzJQ3i0X8a1a6uo52SxjKINHuA=; b=yoRmfOFVu7knhX7Vyw/W3yblLJUEfd6fmragGMskNJh+lj3R3doWQIQ9LXwKc4Rmj2 iAeZSwm1y7GaMqGtUjpOErpEi34049KGrdNTk8lvmJV38O/3/6UYsPQWIPpBqL2uqXbv YZWZDFkuRE+MzUqwFv8qXveSHtZV7hHrDky5weQIQtEt9HlntguGv1fmZz/dDrKYIxqT xo/Hnb4aMScMdj3W0iXUW8X33Hqfl+kTLMFi/gWsEiYzdWWA4z3PMP8MCGjWqzgvOpA0 bZZdTPyNmwibzytcOWDVvd7wdIozarYlpwMiHCLCtuEuG9guOFNytqtg4IvyUmbN347J jL4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ziepe.ca header.s=google header.b="mXg4nC/0"; 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 p15si23801228pll.322.2021.09.28.13.07.59; Tue, 28 Sep 2021 13:08:12 -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="mXg4nC/0"; 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 S242612AbhI1UGu (ORCPT + 99 others); Tue, 28 Sep 2021 16:06:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46206 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242568AbhI1UGt (ORCPT ); Tue, 28 Sep 2021 16:06:49 -0400 Received: from mail-qv1-xf33.google.com (mail-qv1-xf33.google.com [IPv6:2607:f8b0:4864:20::f33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7E0F9C06161C for ; Tue, 28 Sep 2021 13:05:09 -0700 (PDT) Received: by mail-qv1-xf33.google.com with SMTP id o15so87810qvq.4 for ; Tue, 28 Sep 2021 13:05:09 -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=cW8g3RMiiX7YozMyBpzJQ3i0X8a1a6uo52SxjKINHuA=; b=mXg4nC/0EIy5mcGZgRBdVGh4+PtQ/R7qKfJdIHvckLXvlCgA6RG20VZtoVAC7XwA0/ 1Q9jV1hRPeuiqNHTfiF2xEDf/GmdCrABm9VW4FZUzunFeWsbqWbu0OIpkB0K7pTzfgbd 6AZsXvNDXNRBaOqQHwB6uloUHcpht9y8ZbZWcpcNkXzVJmyDxhAzyVOeTC4gm52ORmXN mB9dfyB6upC6rckPem/56kkVq6mMDb0monvwsJpjKud0G8lLORhrGaRbWZcJi7ULZ9Wj 5fjO0VyJ8XxtZ4Gi+c3kBFto+M+PTYIof3BPLlQNFsws5BUO2HFuvQyKhOfpgnkZotGZ sdyw== 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=cW8g3RMiiX7YozMyBpzJQ3i0X8a1a6uo52SxjKINHuA=; b=qxo+qvIYqiUmAmdUI2JPI7pFiQhfu5U2ofC0eSnWKB25mCfU1yV+iaqEP5yLmtzLye keqkjvuUL3Vi9BxRlHuU62e8k2RXvxeR71O+vhVe8MrFbys46E18knQN6Fhv3oPTiWOK aizgMlGhNodeZMzdZxPLZ2fBOrfnILiRmZNy09GswyR8y8G2K0M0PiaD6t52TcdUfXM1 JN4tYbqiWVrB4mZxmqyAqIYL78ozvirEuN19ojgXmFHt11qot46o5FixWenOf98JtfKi Dro1C3fD4+grRkDKt5iw5aN0Ad3YkVei+awKQh4OoPgTk7pfk4OQIzVnE3DQDjQAp9h7 uq9g== X-Gm-Message-State: AOAM533T86YaEEJQa8bLqmkN8hUQKWHuQbAHTvZQLIaSPrxEtbv/HTya 2DVCKv+gAqUWsitCJLBrRrmb/w== X-Received: by 2002:a0c:9043:: with SMTP id o61mr7850968qvo.54.1632859508704; Tue, 28 Sep 2021 13:05:08 -0700 (PDT) Received: from ziepe.ca ([206.223.160.26]) by smtp.gmail.com with ESMTPSA id x125sm118440qkd.8.2021.09.28.13.05.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Sep 2021 13:05:07 -0700 (PDT) Received: from jgg by mlx with local (Exim 4.94) (envelope-from ) id 1mVJLe-007GuE-T8; Tue, 28 Sep 2021 17:05:06 -0300 Date: Tue, 28 Sep 2021 17:05:06 -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: <20210928200506.GX3544071@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: > +static void pci_p2pdma_unmap_mappings(void *data) > +{ > + struct pci_dev *pdev = data; > + struct pci_p2pdma *p2pdma = rcu_dereference_protected(pdev->p2pdma, 1); > + > + p2pdma->active = false; > + synchronize_rcu(); > + unmap_mapping_range(p2pdma->inode->i_mapping, 0, 0, 1); > + pci_p2pdma_free_mappings(p2pdma->inode->i_mapping); > +} If this is going to rely on unmap_mapping_range then GUP should also reject this memory for FOLL_LONGTERM.. What along this control flow: > + error = devm_add_action_or_reset(&pdev->dev, pci_p2pdma_unmap_mappings, > + pdev); Waits for all the page refcounts to go to zero? Jason