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] [PATCH] amd iommu: Do not adjust paging mode for dom0 de

To: Keir Fraser <keir@xxxxxxx>
Subject: Re: [Xen-devel] [PATCH] amd iommu: Do not adjust paging mode for dom0 devices
From: Wei Wang2 <wei.wang2@xxxxxxx>
Date: Mon, 7 Feb 2011 10:58:28 +0100
Cc: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Mon, 07 Feb 2011 02:01:40 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <C97483AA.2AC3B%keir@xxxxxxx>
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: <C97483AA.2AC3B%keir@xxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: KMail/1.9.6 (enterprise 20070904.708012)
On Sunday 06 February 2011 17:58:18 Keir Fraser wrote:
> On 01/02/2011 17:34, "Wei Wang2" <wei.wang2@xxxxxxx> wrote:
> > Keir
> > Here is another small patch to fix consistency issue of paging mode when
> > return passthru devices back to dom0. In this case, paging mode should
> > not be adjusted, since dom0->max_pages = ~0U.
>
> The call to get_paging_mode() in amd_iommu_domain_init() looks sensible
> enough. Why is a call needed in reassign_device() at all? Checking for dom0
> in reassign_device just looks like a fragile hack.
>
>  -- Keir

Keir,
amd_iommu_domain_init() is called very early, where get_paging_mode() cannot  
use domU->max_pages to setup proper io page level for domU. Instead, paging 
mode of domU has to be initialized as 4 for safety. That is why I want to 
adjust hd->paging_mode in reassign_device() using domU->max_pages. Since most 
domU use 2-3 level page tables, always using 4 level might be a waste.

But I had a wrong assumption of dom0->max_pages, and consequently when return 
passthru device back to dom0, following lines in c/s 22825

+    if ( target->max_pages > 0 )
+        t->paging_mode = get_paging_mode(target->max_pages);

will change hd->paging_mode of dom0 from 3 (in most case) to 4 (using 
get_paging_mode(dom0->max_pages)). 

Thanks,
-Wei







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