vfio_group_fops_open does not allow multiple instances
Linux - KernelThis forum is for all discussion relating to the Linux kernel.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
vfio_group_fops_open does not allow multiple instances
Hi, I was trying to use VFIO to do IO and use MSIX interrupts, however I noticed that it is not supported to have multiple users. So I cannot have process A use IO region and process B use a different IO region because VFIO group/container/device cannot be opened by 2 processes. (It is possible to do a fork yes... but not 2 separate launched processes right?)
There is a comment in vfio_group_fops_open: /* Do we need multiple instances of the group open? Seems not. */
So no one else requires this functionality yet? Or has anyone looked into this use case already?
Using two VMs at the same time is indeed one use case for this situation. The generic use case is as follows: Process A (VM-A) does not know that Process B(VM-B) is running so it could or could not be using the device already. Process A should be able to use the same device than Process B as long as the IO region is different (can it even support using the same IO region?). I am currently not using a VM for this, I just have my own application which opens a device PCIe BAR 0 and maps offset X, and try to open a second application which also opens PCIe BAR0 and maps offset Y. The second application fails to open vfio as it is already opened.
It took me some time to check this but if I am looking correctly at vfio_group_get_device_fd, if the device is already opened it is reused not opened again so the bar is mapped once and can be reused by more than one "user". However, it seem like this extra user is limited to the same process because still it will not be possible to open the group from another process. So again I think this function vfio_group_fops_open is the one limiting this use case right?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.