Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp7119240ioo; Thu, 2 Jun 2022 23:21:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyfdATLB5WGWpFFl+EFuQ4U2QlfNtEcuAXvHbA1JEVcLYZzNOkc5TLy/3OY0oMUKVaHlrhy X-Received: by 2002:a17:907:96ab:b0:6fe:ec87:cd90 with SMTP id hd43-20020a17090796ab00b006feec87cd90mr7490001ejc.620.1654237317347; Thu, 02 Jun 2022 23:21:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654237317; cv=none; d=google.com; s=arc-20160816; b=ZeMxAq/cai+P746PK8XgM6HWgjRuGPxZ7UgQQDWY2WIPO9vf6+hxOkJdOM6sLAfUJf PZ4DYnfIPddJ6z6V2YhjawpU2ssq+G/jjyMvKLA+iqC+CYLkPHT9jGiFRDk3WoIkm4LB TRkpaA5/S80xpBWXSVNW21e3yokw1ZCsrF3EGDQxRCpnzMOfQE+v6ZgOrwpSj/Qg07GT BOnhVfQSnWfh7R+yisKo0mtlq6jY6LIs4cftK7o78q2G0eaLh31l00qMDAs5XfE/kjXl G9dkHUUzugVG4M4yK1oLnsW87/WVPVYvyAj0xS4FAeDrm1tgnrcOX2pztE0rX06RnaXK mw7w== 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=yHMITh+N130iuSnYvU2I4WotSms4ADBqIIhjmWEL4ZQ=; b=ruP5ea4+KyGonTuYTkuwDVaI9l+5epcOD5qvwTR2lxhrA9IsI8DfVyMGEReqARX/Yt NUUf6cRrqm3vgB372CD5leAXOnIcW/lALI0lKp/tN1NrmcuV9dRewztlbxF2U5+787Jz XyUXo7BY21RLggAZ33ixbUooFmaaOOVaVGyWdXKqU0uH/CZEus6wECetXDupe3dcbo7l IoD2521OSiMXrMlW8apf19MR9gtnk7LiPixrrDt4RNsNjVqMnFHF/JqbV5vU+2OKXBrD Sl922M8UteHbgNi80JOLz9zBj6E8xqkuDT2UfTA9Q2Vpzw5dQIbYQ+RcwW4w+ci2fLyX t9lg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@deltatee.com header.s=20200525 header.b=O6Xl4kM8; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=deltatee.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w9-20020a056402268900b00425bb1f4712si8330321edd.103.2022.06.02.23.21.32; Thu, 02 Jun 2022 23:21:57 -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=@deltatee.com header.s=20200525 header.b=O6Xl4kM8; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=deltatee.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237211AbiFBQqP (ORCPT + 99 others); Thu, 2 Jun 2022 12:46:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53656 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237183AbiFBQqE (ORCPT ); Thu, 2 Jun 2022 12:46:04 -0400 Received: from ale.deltatee.com (ale.deltatee.com [204.191.154.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D6DCC2B12FC; Thu, 2 Jun 2022 09:46:02 -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=yHMITh+N130iuSnYvU2I4WotSms4ADBqIIhjmWEL4ZQ=; b=O6Xl4kM8MUO00BCgiQ9hWPp+gB 2m7ZVz8sHNAOQKpiy5iEU/brZWoHl9L3YI08j4vZrZwZONQy6WWyOSXW66i+Zcv9QKlOeesm8TgjQ pABnUdHP29eKXg17nEZ/MnWYIcmY/29mOmJme4RbBeYYarSUthGM7iOo3qpUFKlkgq37Ue76GJEjA MfSw6YBYC+/0IQghP6E8FIRiZlTGbFFCXvUfzWrCRinU718CfdX6Eh08/4ZrDvJWXnPQwmRp+4WdA 1qxJEJvrytnpdt9tHqZk0bsYRw6b+C0O39SAOTytYjPcg2eYDgsp57ejuIJbnxeryaQkNoi8uOxrW ueUPAsxQ==; Received: from s0106a84e3fe8c3f3.cg.shawcable.net ([24.64.144.200] helo=[192.168.0.10]) by ale.deltatee.com with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1nwnxQ-00EOAT-Fz; Thu, 02 Jun 2022 10:46:01 -0600 Message-ID: <28824558-4fd5-e054-6c8d-5e045d52f795@deltatee.com> Date: Thu, 2 Jun 2022 10:45:55 -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> <20220527190307.GG2960187@ziepe.ca> <20220602000038.GK2960187@ziepe.ca> <400baba7-1cd6-09d4-4de9-2a73f08afc79@deltatee.com> <20220602163059.GL2960187@ziepe.ca> From: Logan Gunthorpe In-Reply-To: <20220602163059.GL2960187@ziepe.ca> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-SA-Exim-Connect-IP: 24.64.144.200 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.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,SPF_HELO_PASS, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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-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. This is not my experience. All the drivers I've worked with do not block unbind with open file descriptors (at least for char devices). I know, for example, that having a file descriptor open of /dev/nvmeX does not cause unbinding to block. I figured this was the expectation as the userspace process doing the unbind won't be able to be interrupted seeing there's no way to fail on that path. Though, it certainly would make things a lot easier if the unbind can block indefinitely as it usually requires some complicated locking. Do you have an example of this? What mechanisms are developers using to block unbind with open file descriptors? Logan