Skip to contentSkip to conversation

sharing PCI devices ....

DISCUSSION Himanshu Raj 4 participants 5 messages Sep 7, 2005

lore
Share & tools
lore
#0 lore raw

Hi Folks,

A question about PCI devices. If we leave security problems aside, is it possible to provide access of a PCI device to 2 domains (may include dom 0), i.e. would current xen implementation suffice or a PCI device can only be used exclusively by a domain.

Thanks,
Himanshu

Signature · 5 lines
-------------------------------------------------------------------------
Himanshu Raj
PhD Student, GaTech (www.cc.gatech.edu/~rhim)
I prefer to receive attachments in an open, non-proprietary format.
-------------------------------------------------------------------------
#1 lore raw
Quoted 4 lines

A question about PCI devices. If we leave security problems aside, is it possible to provide access of a PCI device to 2 domains (may include dom 0), i.e. would current xen implementation suffice or a PCI device can only be used exclusively by a domain.

No, not without writing a backend driver to mediate device accesses. If two domains can both access the raw device, who gets the interrupts raised by the device? What if one domain gets context-switched away in the middle of what it thinks is an atomic operation, and the other domain uses the device in the meantime? What if the domains each want the device in a different 'mode' (like promiscuous mode for NICs) - how do you change the mode back and forth as each domain is scheduled?

If you have a particular device that you want two or more domains to use, you need to write a backend and a frontend device driver, and then export the virtual device to your domUs just like the virtual NIC and the virtual block device.

If you do this, consider sharing the source with everyone: someone else will probably want to do the same thing eventually and it would make their lives easier. Also, other people may spot unnoticed bugs in your driver, before they bite you on the bum.

Signature · 4 lines
"And  what if  I assign  a  hundred  programmers  to  it?"   The  master
programmer shrugged. "Then the design will never be completed," he said.
http://www.google.com/search?q=%22pgp+singing%22  <-- childish but funny
http://surreal.istic.org/ <-- It's like a DEATH CIRCUS! | keyid 885b170d

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#2 lore raw
Quoted 2 lines

Also, other people may spot unnoticed bugs in your driver, before they bite you on the bum.

Actually, on reflection I would like to emphasize that it is the bugs that will be biting you on the bum, not the other people. I hope nobody else had a horrible mental picture of Xen developers lining up to tell some poor chap his code is buggy and then bite him on the bum.

Signature · 4 lines
"And  what if  I assign  a  hundred  programmers  to  it?"   The  master
programmer shrugged. "Then the design will never be completed," he said.
http://www.google.com/search?q=%22pgp+singing%22  <-- childish but funny
http://surreal.istic.org/ <-- It's like a DEATH CIRCUS! | keyid 885b170d

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#3 lore raw
Quoted 6 lines · Daniel Hulme
Quoted 2 lines

Also, other people may spot unnoticed bugs in your driver, before they bite you on the bum.

Actually, on reflection I would like to emphasize that it is the bugs that will be biting you on the bum, not the other people. I hope nobody else had a horrible mental picture of Xen developers lining up to tell some poor chap his code is buggy and then bite him on the bum.

That thought hadn't occurred to me... until now.

Quoted 5 lines

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#4 lore raw
In reply to Himanshu Raj
Quoted 4 lines

A question about PCI devices. If we leave security problems aside, is it possible to provide access of a PCI device to 2 domains (may include dom 0), i.e. would current xen implementation suffice or a PCI device can only be used exclusively by a domain.

Not usually: devices are basically stupid and they only expect one entity to be talking to them. If you get multiple domains driving a device directly it'll probably end in tears, although it might be amusing :-)

You've really got two choices:
1) Just assign a device to one domain at a time - maybe buy multiple devices to serve multiple domains.
2) Virtualise at a higher level using a backend / frontend. e.g. the virtual block device, virtual net dev, virtual usb dev, etc...

What are you actually trying to achieve?

Cheers,
Mark