LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices


Reply
  Search this Thread
Old 03-07-2022, 08:52 AM   #1
armandorl
LQ Newbie
 
Registered: Mar 2022
Posts: 3

Rep: Reputation: 0
Lightbulb 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?

Thanks,

Armando Ruiz
 
Old 03-07-2022, 01:08 PM   #2
smallpond
Senior Member
 
Registered: Feb 2011
Location: Massachusetts, USA
Distribution: Fedora
Posts: 4,157

Rep: Reputation: 1266Reputation: 1266Reputation: 1266Reputation: 1266Reputation: 1266Reputation: 1266Reputation: 1266Reputation: 1266Reputation: 1266
What is the use case? Are you running two different VMs at the same time?
 
Old 03-08-2022, 03:20 AM   #3
armandorl
LQ Newbie
 
Registered: Mar 2022
Posts: 3

Original Poster
Rep: Reputation: 0
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.
 
Old 03-08-2022, 08:14 AM   #4
smallpond
Senior Member
 
Registered: Feb 2011
Location: Massachusetts, USA
Distribution: Fedora
Posts: 4,157

Rep: Reputation: 1266Reputation: 1266Reputation: 1266Reputation: 1266Reputation: 1266Reputation: 1266Reputation: 1266Reputation: 1266Reputation: 1266
Won't changing the BAR break the first process, since it changes where the device memory is mapped?
 
Old 03-08-2022, 04:01 PM   #5
armandorl
LQ Newbie
 
Registered: Mar 2022
Posts: 3

Original Poster
Rep: Reputation: 0
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?
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Batch adding multiple users to an instances for multiple pages Fred27377 Linux - Newbie 6 06-10-2020 02:48 PM
Bash script to count number of executions instances does not work. jose_spain Linux - General 7 06-12-2019 04:12 AM
sendmail-2: Wrong number of instances of process sendmail:, expected instances equal maxymaxymaxymaxymaxy Linux - Newbie 1 06-15-2011 10:51 AM
kickstart; how-to info needed for multiple instances of RH OS's and multiple unique v Joe_Wulf Linux - Server 4 06-21-2007 11:18 PM
Allow google.com but not allow google subdomains in dansguardian paul_mat Linux - Networking 4 07-17-2006 01:40 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 09:48 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration