WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

Re: [Xen-devel] question on iommu _map_page

To: Keir Fraser <keir.fraser@xxxxxxxxxxxxx>
Subject: Re: [Xen-devel] question on iommu _map_page
From: Kaushik Kumar Ram <kaushik@xxxxxxxx>
Date: Thu, 27 May 2010 15:59:20 -0500
Cc: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Thu, 27 May 2010 14:00:57 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <C824989C.210D%keir.fraser@xxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <C824989C.210D%keir.fraser@xxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
On May 27, 2010, at 3:46 PM, Keir Fraser wrote:

> It looks like the person who implemented that never needed the read-only
> case. We need a function to map pages into the iommu read-only and to call
> that from the grant code.
> 
> A patch to just call iommu_map_page() for any kind of grant mapping would be
> acceptable for now, if you want to submit a patch.

OK. Attached.

Signed-off-by: Kaushik Kumar Ram <kaushik@xxxxxxxx>

diff -r 26c2922da53c xen/common/grant_table.c
--- a/xen/common/grant_table.c  Thu May 27 09:39:47 2010 +0100
+++ b/xen/common/grant_table.c  Thu May 27 15:56:37 2010 -0500
@@ -596,9 +596,7 @@ __gnttab_map_grant_ref(
         goto undo_out;
     }
 
-    if ( (!is_hvm_domain(ld) && need_iommu(ld)) &&
-         !(old_pin & (GNTPIN_hstw_mask|GNTPIN_devw_mask)) &&
-         (act_pin & (GNTPIN_hstw_mask|GNTPIN_devw_mask)) )
+    if ( !is_hvm_domain(ld) && need_iommu(ld))
     {
         /* Shouldn't happen, because you can't use iommu in a HVM
          * domain. */
@@ -779,9 +777,7 @@ __gnttab_unmap_common(
             act->pin -= GNTPIN_hstw_inc;
     }
 
-    if ( (!is_hvm_domain(ld) && need_iommu(ld)) &&
-         (old_pin & (GNTPIN_hstw_mask|GNTPIN_devw_mask)) &&
-         !(act->pin & (GNTPIN_hstw_mask|GNTPIN_devw_mask)) )
+    if ( !is_hvm_domain(ld) && need_iommu(ld))
     {
         BUG_ON(paging_mode_translate(ld));
         if ( iommu_unmap_page(ld, op->frame) )

-Kaushik 

> On 27/05/2010 21:37, "Kaushik Kumar Ram" <kaushik@xxxxxxxx> wrote:
> 
>> Hi all,
>> 
>> I am trying to use the VT-d support with a PV driver domain which performs
>> network I/O on behalf of guest domains.
>> When I initiate any network I/O it results in I/O page faults. On taking a
>> closer look I find that iommu_map_page() is called only for writable pages
>> from __gnttab_map_grant_ref(). This results in page faults during packet
>> transmission since pages are mapped read-only in this case.
>> When I remove this restriction, I can get it working without any page faults.
>> 
>> Is this a bug? or am I missing something here? I am using the latest unstable
>> version of Xen. This part of the source code hasn't changed in a long time.
>> 
>> Thanks!
>> -Kaushik
>> _______________________________________________
>> Xen-devel mailing list
>> Xen-devel@xxxxxxxxxxxxxxxxxxx
>> http://lists.xensource.com/xen-devel
> 
> 
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@xxxxxxxxxxxxxxxxxxx
> http://lists.xensource.com/xen-devel
> 


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel