From: Sameer Niphadkar Subject: Virtual passthrough I/O for Xen Date: Sun, 22 Mar 2009 12:41:04 -0400 Message-ID: <6e28a01d0903220941l231ccccex6ec0e4754dac2356@mail.gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0289193167==" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org --===============0289193167== Content-Type: multipart/alternative; boundary=0016e64612c2e55d0c0465b7d066 --0016e64612c2e55d0c0465b7d066 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable Hi, We are working on a project for which we intend to modify Xen to support Virtual passthrough I/O. We have the following plan..it would great to get some feedback and listen to ideas where we can apply our plan. Goal: To share one physical device among multiple guest OSes without relying on a central driver. Every guest OS will have its own device driver. And a scheduler will be added to the hypervisor to schedule the device among multiple guest OSes. Motivation and related work: This driver model is more reliable than the current driver models in the VM= M and hypervisors. Xen driver domain relies on the integrity of the driver domain itself. The newest hardware such as SR-IOV can support multiple virtual functions (VF) on a single physical device. It can dedicate one VF to one guest OS. However, if the number of guest OSes is more than the number of available VFs, there is no good way to share the VFs among guest OSes. One possible solution is to dedicate one VF for a driver domain with backend server. All the other guest OSes without dedicated VF can use a frontend driver to talk to the backend driver and share the VF. But this approach is not flexible. By using our approach, we can create flexible mappings between the VFs and the guest OSes. The mapping could be 1:n, 1:1, or n:m. The VPIO paper - [ http://www.usenix.org/events/wiov08/tech/full_papers/xia/xia_html/] is mos= t close to our approach. But our approach is more general. It does not requir= e full hardware support such as VT-d or SVM. But it does require IOMMU to prevent malicious DMA. And it will be compatible with the new devices such as SR-IOV. Design: We assume that most guest OSes already have the device drivers for a device= . We modify these drivers to work with our scheduler. In essence, before the device driver tries to start a control operation, such as DMA, it has to ad= d a hypercall to =93obtain=94 the device. If the device is busy, the device d= river should wait for it. In servicing this hypercall, the scheduler (running in the hypervisor) can determine whether to allow this access and maintain a context for the guest OS. The scheduler maintain the state (context) of a device (or a VF) and switch it to other guest OS when necessary. We claim that the modification to the device driver is minimum. Another benefit is that the device driver of a guest OS may be blocked but other parts of the guest OS may keep running. While in the VPIO paper, a whole guest OS has to be blocked when the device is not available, because they didn=92t modify the device driver. The benefit of our approach when compar= ing with other driver models is that there is no central controller of the device. The scheduler is not a full-fledged device driver but only maintain the minimum context of the device. All the guest OSes are equal and independent. If one of the guest OS is compromised, it may launch DoS attac= k against other guest OSes but cannot steal information from other guest OSes= . Implementation: The basic approach is to modify the current pass-through mechanism on Xen. Currently, Xen can dedicate one device to one guest OS (which can be any domain). It also supports SR-IOV devices. But it cannot pass-through one device to multiple guest OSes at the same time. We will modify the current pass-though mechanism. First allow pass-through one device to multiple gues= t OSes, and then add a scheduler in the hypervisor to schedule the device. We will also modify a sample network device driver to cooperate with the hypervisor when accessing the device. Tasks: 1) Understand the implementation of the current Xen pass-through 2) Add a read-only hypercall to allow the guest device driver read the device state (idle or busy) easily and efficiently. 3) Add a hypercall to let the guest device driver grab the device. 4) Add a scheduler to maintain the context of the device. 5) Modify the device driver to call the abovementioned hypercalls when necessary. Comments and suggestions would be highly appreciated..thanks regards Sameer --0016e64612c2e55d0c0465b7d066 Content-Type: text/html; charset=windows-1252 Content-Transfer-Encoding: quoted-printable Hi,

We are working on a project for which we intend to modify=A0 Xen= to support Virtual passthrough I/O. We have the following plan..it would g= reat to get some feedback and listen to ideas where we can apply our plan. =

Goal:
To share one physical device among multiple guest OSes without= relying on a central driver. Every guest OS will have its own device drive= r. And a scheduler will be added to the hypervisor to schedule the device a= mong multiple guest OSes.

Motivation and related work:
This driver model is more reliable than= the current driver models in the VMM and hypervisors.=A0 Xen driver domain= relies on the integrity of the driver domain itself.=A0 The newest hardwar= e such as SR-IOV can support multiple virtual functions (VF) on a single ph= ysical device. It can dedicate one VF to one guest OS. However, if the numb= er of guest OSes is more than the number of available VFs, there is no good= way to share the VFs among guest OSes. One possible solution is to dedicat= e one VF for a driver domain with backend server. All the other guest OSes = without dedicated VF can use a frontend driver to talk to the backend drive= r and share the VF. But this approach is not flexible. By using our approac= h, we can create flexible mappings between the VFs and the guest OSes. The = mapping could be 1:n, 1:1, or n:m.=A0 The VPIO paper - [http://www.usen= ix.org/events/wiov08/tech/full_papers/xia/xia_html/]=A0 is most close t= o our approach. But our approach is more general. It does not require full = hardware support such as VT-d or SVM. But it does require IOMMU to prevent = malicious DMA. And it will be compatible with the new devices such as SR-IO= V.

Design:
We assume that most guest OSes already have the device drive= rs for a device. We modify these drivers to work with our scheduler. In ess= ence, before the device driver tries to start a control operation, such as = DMA, it has to add a hypercall to =93obtain=94 the device. If the device is= busy, the device driver should wait for it. In servicing this hypercall, t= he scheduler (running in the hypervisor) can determine whether to allow thi= s access and maintain a context for the guest OS. The scheduler maintain th= e state (context) of a device (or a VF) and switch it to other guest OS whe= n necessary.
We claim that the modification to the device driver is minimum. Another ben= efit is that the device driver of a guest OS may be blocked but other parts= of the guest OS may keep running. While in the VPIO paper, a whole guest O= S has to be blocked when the device is not available, because they didn=92t= modify the device driver.=A0 The benefit of our approach when comparing wi= th other driver models is that there is no central controller of the device= . The scheduler is not a full-fledged device driver but only maintain the m= inimum context of the device. All the guest OSes are equal and independent.= If one of the guest OS is compromised, it may launch DoS attack against ot= her guest OSes but cannot steal information from other guest OSes.

Implementation:
The basic approach is to modify the current pass-thr= ough mechanism on Xen. Currently, Xen can dedicate one device to one guest = OS (which can be any domain). It also supports SR-IOV devices. But it canno= t pass-through one device to multiple guest OSes at the same time. We will = modify the current pass-though mechanism. First allow pass-through one devi= ce to multiple guest OSes, and then add a scheduler in the hypervisor to sc= hedule the device. We will also modify a sample network device driver to co= operate with the hypervisor when accessing the device.

Tasks:
1) Understand the implementation of the current Xen pass-thro= ugh
2) Add a read-only hypercall to allow the guest device driver read t= he device state (idle or busy) easily and efficiently.
3) Add a hypercal= l to let the guest device driver grab the device.
4) Add a scheduler to maintain the context of the device.
5) Modify the = device driver to call the abovementioned hypercalls when necessary.

=
Comments and suggestions would be highly appreciated..thanks

regards
Sameer


--0016e64612c2e55d0c0465b7d066-- --===============0289193167== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --===============0289193167==--