Re: [PATCH] uio/uio_pci_generic: Introduce refcnt on open/release

From: Greg KH
Date: Fri Apr 01 2022 - 02:17:50 EST


On Thu, Mar 31, 2022 at 04:29:23PM -0400, Michael S. Tsirkin wrote:
> On Thu, Mar 31, 2022 at 10:06:24AM +0800, Yao Hongbo wrote:
> > If two userspace programs both open the PCI UIO fd, when one
> > of the program exits uncleanly, the other will cause IO hang
> > due to bus-mastering disabled.
>
> With two programs poking at the same device, how is this ever
> supposed to work even while both are alive?
>
> > It's a common usage for spdk/dpdk to use UIO.
>
> Except people really should just use vfio ...

Yes they should, the kernel should not care if multiple programs open
the same UIO device node, it can not prevent that and userspace is on
it's own here as it _should_ know what it is doing.

thanks,

greg k-h