Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp6781918ioo; Thu, 2 Jun 2022 13:39:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzgqsU1+X7zIHRkPd/D6HchV+vLVqxQzVtuKYU6HdI2Rqp6XLwMD791p15DcKs2EvfMz+JZ X-Received: by 2002:a05:6a00:170b:b0:51b:cf4b:9187 with SMTP id h11-20020a056a00170b00b0051bcf4b9187mr3780948pfc.15.1654202380496; Thu, 02 Jun 2022 13:39:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654202380; cv=none; d=google.com; s=arc-20160816; b=SbiP2vtVrY0g48y4yVaDJapHq5BmtKs/RmFgXWOH+VJ8azpCpAgPRWAE2ZnJxtxBV6 fr1QjcZOdoEIljuxSTyXeI/ws+TTjSguCT9ObcMUMHY4ReRSFWOqRH4t1QaVwguNIjhT 3a52iwJvHpNTiEv+CG4N8zFvS3XKpr1QlZ6mZjvOzNumhiYkynEkbRuz768yAu1y2g+F ze7Tmw/It9kff82A5Q2Z4OMK0+pUr/0j2AMKg+OhKA1zmx9OhUzJqa7wUbhTJe/mTCAK niySavmEK5F8tnWyamWLzSo7FRZmD5wA8w/ANfx78Ut6e5xSVn8S6924CrNvLbBohE+4 8ziA== 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=GuOinXdzP0oJ6BfwGVGRF9opnqUN4LYO3Y/RmknOScs=; b=y7S6EX/4b74TmGRgSIrv0R1C6rjTjetna7cAEkBwC8jfJyakNkkpu9QxR1EC++vEql cbQLkkjA2AePl6xP2IXAjP3WTOxaa6cLyz4uxUDob+F/cBF449Yu0/2Hq7nyb0TF+DXm E2u0CigaEfBnTbZVXqQK/QboA4rUZ52k99a4Qe8rYHIei6tidVEPIBA8neYd6o+qB5Zs 6XIvWUyjUQcSSVUlvT4mztUj3DqfOV+HC76NsU7bNxo7eQf1FM/heh9IGZxZA6oB3OMo mVDl1w+xxDGZLqQjljxb6z0UKHRSvfJVKmJZE4tyEL0c5VjJUQDzhUTRCcOt7fLBs6tI i9yA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ziepe.ca header.s=google header.b=nERzx0gJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-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 7-20020a630e47000000b003fc5c3403e3si7106986pgo.316.2022.06.02.13.39.27; Thu, 02 Jun 2022 13:39:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-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=@ziepe.ca header.s=google header.b=nERzx0gJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237561AbiFBR2S (ORCPT + 99 others); Thu, 2 Jun 2022 13:28:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32800 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237126AbiFBR2P (ORCPT ); Thu, 2 Jun 2022 13:28:15 -0400 Received: from mail-qk1-x729.google.com (mail-qk1-x729.google.com [IPv6:2607:f8b0:4864:20::729]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A0401220CA for ; Thu, 2 Jun 2022 10:28:13 -0700 (PDT) Received: by mail-qk1-x729.google.com with SMTP id o68so4129239qkf.13 for ; Thu, 02 Jun 2022 10:28:13 -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=GuOinXdzP0oJ6BfwGVGRF9opnqUN4LYO3Y/RmknOScs=; b=nERzx0gJZv2PpNEuSU7ZGuwa6QR4KAFkZQcX+7G15YcgRySvW6qb9+1khratoVExRd E2cV1E+y5eNUdrv7iEhYvw6adm9tR0J0w0Y5RG/qlzn3N/ExPpw5VFSVcBiyiAfseShj RtXbQnx/36eWCdWlBGeV1GIY74fg8syx0d0tBb6JCdM+OFqTrueuf3t4tmn+ivjrfwFi G+YqxQ/XoZIxp/zm5ZUgHxZvv3ENrre3J5G2iipdg5D6ioSBpapAVxA8rxNBc3hfH6JN xgR8Rb7bKKjuhDjx6rhbKloVBy4fbfQj9wlUkZziCVhgTTnOfjGMKfLsZNNy+YXFPJkc II8g== 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=GuOinXdzP0oJ6BfwGVGRF9opnqUN4LYO3Y/RmknOScs=; b=gQPVEhv+FHb4oesWl3eegSzkH5Ohbr1JWh7GQgrcrNwIsgUIFxJkdABiiTYhmL+Z8/ uGtehPSU34A/o2dLri5TMfupcyMpcYoXPtvHR5PjpBU5YWnqxXVfoj+vK8TbIX2l+Taq Q5p21CXkFes9Xg9IjSVmR2j/owpfsEvXKTDpnA5Sb9Pk1dRt3cFD4ijkWkKY6y+7B/yR MNNbuNetNhTWVdrTCAIWDpLPmdhIaXIpl/V8J6D/eYZ4XwUov1nf40VsZ6e0BN/tSPtg cBEm0kbAbrXgnqkn0tFk3pqfxX6B1wT213zLX81exXBCpuM6ZBzN9A9zwU3HCSZW0joD d9nA== X-Gm-Message-State: AOAM530rxaXC5SPT/F3a+fhpYPMBXPSqzjDzh7vg4lnyVyWQ8SRuM+0J udknAj52mbOM+9XOAtmpPZ04oQ== X-Received: by 2002:a05:620a:f0d:b0:67e:1c14:bc5e with SMTP id v13-20020a05620a0f0d00b0067e1c14bc5emr3899163qkl.502.1654190892765; Thu, 02 Jun 2022 10:28:12 -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 q188-20020ae9dcc5000000b0069fc13ce1f2sm3649937qkf.35.2022.06.02.10.28.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Jun 2022 10:28:12 -0700 (PDT) Received: from jgg by mlx with local (Exim 4.94) (envelope-from ) id 1nwocF-00GUaJ-Fg; Thu, 02 Jun 2022 14:28:11 -0300 Date: Thu, 2 Jun 2022 14:28:11 -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 , Ralph Campbell , Bjorn Helgaas Subject: Re: [PATCH v6 20/21] PCI/P2PDMA: Introduce pci_mmap_p2pmem() Message-ID: <20220602172811.GN2960187@ziepe.ca> References: <20220407154717.7695-1-logang@deltatee.com> <20220407154717.7695-21-logang@deltatee.com> <20220527125501.GD2960187@ziepe.ca> <20220527190307.GG2960187@ziepe.ca> <20220602000038.GK2960187@ziepe.ca> <400baba7-1cd6-09d4-4de9-2a73f08afc79@deltatee.com> <20220602163059.GL2960187@ziepe.ca> <51cc6645-2504-6d01-5626-238ed6ffff04@deltatee.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <51cc6645-2504-6d01-5626-238ed6ffff04@deltatee.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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-kernel@vger.kernel.org On Thu, Jun 02, 2022 at 10:49:15AM -0600, Logan Gunthorpe wrote: > > > On 2022-06-02 10:30, Jason Gunthorpe wrote: > > On Thu, Jun 02, 2022 at 10:16:10AM -0600, Logan Gunthorpe wrote: > > > >>> Just stuff the pages into the mmap, and your driver unprobe will > >>> automatically block until all the mmaps are closed - no different than > >>> having an open file descriptor or something. > >> > >> Oh is that what we want? > > > > Yes, it is the typical case - eg if you have a sysfs file open unbind > > hangs indefinitely. Many drivers can't unbind while they have open file > > descriptors/etc. > > > > A couple drivers go out of their way to allow unbinding while a live > > userspace exists but this can get complicated. Usually there should be > > a good reason. > > > > The module will already be refcounted anyhow because the mmap points > > to a char file which holds a module reference - meaning a simple rmmod > > of the driver shouldn't work already.. > > Also, I just tried it... If I open a sysfs file for an nvme device (ie. > /sys/class/nvme/nvme4/cntlid) and unbind the device, it does not block. > A subsequent read on that file descriptor returns ENODEV. Which is what > I would have expected. Oh interesting, this has been changed since years ago when I last looked, the kernfs_get_active() is now more narrowed than it once was. So manybe sysfs isn't the same concern it used to be! Thanks, Jason