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. Logan _______________________________________________ iommu mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/iommu
- [PATCH v6 20/21] PCI/P2PDMA: Introduce pci_mmap_p2pmem() Logan Gunthorpe
- Re: [PATCH v6 20/21] PCI/P2PDMA: Introduce pci_mmap_p... Jason Gunthorpe
- Re: [PATCH v6 20/21] PCI/P2PDMA: Introduce pci_mm... Logan Gunthorpe
- Re: [PATCH v6 20/21] PCI/P2PDMA: Introduce pc... Jason Gunthorpe
- Re: [PATCH v6 20/21] PCI/P2PDMA: Introduc... Logan Gunthorpe
- Re: [PATCH v6 20/21] PCI/P2PDMA: Int... Jason Gunthorpe
- Re: [PATCH v6 20/21] PCI/P2PDMA:... Logan Gunthorpe
- Re: [PATCH v6 20/21] PCI/P2PDMA:... Jason Gunthorpe
- Re: [PATCH v6 20/21] PCI/P2PDMA:... Logan Gunthorpe
- Re: [PATCH v6 20/21] PCI/P2PDMA:... Jason Gunthorpe
- Re: [PATCH v6 20/21] PCI/P2PDMA:... Logan Gunthorpe
- Re: [PATCH v6 20/21] PCI/P2PDMA:... Jason Gunthorpe
- Re: [PATCH v6 20/21] PCI/P2PDMA:... Logan Gunthorpe
- [PATCH v6 13/21] PCI/P2PDMA: Remove pci_p2pdma_[un]map_sg(... Logan Gunthorpe
- [PATCH v6 04/21] PCI/P2PDMA: Introduce helpers for dma_map... Logan Gunthorpe
- [PATCH v6 01/21] lib/scatterlist: add flag for indicating ... Logan Gunthorpe
- [PATCH v6 07/21] dma-mapping: add flags to dma_map_ops to ... Logan Gunthorpe
- [PATCH v6 08/21] iommu/dma: support PCI P2PDMA pages in dm... Logan Gunthorpe
- [PATCH v6 19/21] block: set FOLL_PCI_P2PDMA in bio_map_use... Logan Gunthorpe
- [PATCH v6 14/21] mm: introduce FOLL_PCI_P2PDMA to gate get... Logan Gunthorpe
- [PATCH v6 02/21] PCI/P2PDMA: Attempt to set map_type if it... Logan Gunthorpe
