From mboxrd@z Thu Jan 1 00:00:00 1970 From: Keir Fraser Subject: Re: [PATCH] amd iommu: Do not adjust paging mode for dom0 devices Date: Mon, 07 Feb 2011 10:10:12 +0000 Message-ID: References: <201102071058.29383.wei.wang2@amd.com> Mime-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <201102071058.29383.wei.wang2@amd.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Wei Wang2 Cc: "xen-devel@lists.xensource.com" List-Id: xen-devel@lists.xenproject.org On 07/02/2011 09:58, "Wei Wang2" wrote: > On Sunday 06 February 2011 17:58:18 Keir Fraser wrote: >> On 01/02/2011 17:34, "Wei Wang2" wrote: > > 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)). And that's wrong is it? How do you know that dom0 doesn't have a whole load of memory assigned to it? The correct thing to do would be to adjust the table depth according to the largest page number currently mapped in the table. Or just stick with four levels always if you can't do the optimisation job properly. -- Keir > Thanks, > -Wei > > > > > >