From: Ben-Ami Yassour Subject: Re: [PATCH] KVM: PCIPT: VT-d: fix guest unmap Date: Wed, 18 Jun 2008 15:06:51 +0300 Message-ID: <1213790811.9177.19.camel@lnx-benami> References: <1213729526-10410-1-git-send-email-benami@il.ibm.com> <1213729526-10410-2-git-send-email-benami@il.ibm.com> <1213729526-10410-3-git-send-email-benami@il.ibm.com> <48582CD0.5060109@codemonkey.ws> Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit Cc: amit.shah@qumranet.com, weidong.han@intel.com, Muli Ben-Yehuda , raharper@us.ibm.com, kvm@vger.kernel.org To: Anthony Liguori Return-path: Received: from mtagate5.uk.ibm.com ([195.212.29.138]:35470 "EHLO mtagate5.uk.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752646AbYFRMHq (ORCPT ); Wed, 18 Jun 2008 08:07:46 -0400 Received: from d06nrmr1407.portsmouth.uk.ibm.com (d06nrmr1407.portsmouth.uk.ibm.com [9.149.38.185]) by mtagate5.uk.ibm.com (8.13.8/8.13.8) with ESMTP id m5IC6rev338548 for ; Wed, 18 Jun 2008 12:06:53 GMT Received: from d06av02.portsmouth.uk.ibm.com (d06av02.portsmouth.uk.ibm.com [9.149.37.228]) by d06nrmr1407.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v9.0) with ESMTP id m5IC6rZA2445482 for ; Wed, 18 Jun 2008 13:06:53 +0100 Received: from d06av02.portsmouth.uk.ibm.com (loopback [127.0.0.1]) by d06av02.portsmouth.uk.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id m5IC6q1P025682 for ; Wed, 18 Jun 2008 13:06:53 +0100 In-Reply-To: <48582CD0.5060109@codemonkey.ws> Sender: kvm-owner@vger.kernel.org List-ID: On Tue, 2008-06-17 at 16:29 -0500, Anthony Liguori wrote: > I think the current VT-d code needs some reworking. > > We should build the table as the shadow page table gets built. We > should suppress iotlb flushes unless the table is actually being updated. > I'm not sure what you mean. The current implementation of vtd for passthrough is a direct map, which means that we map the entire guest memory (and pin it). In this case there are no iotlb flushes after the first initialization. Obviously, pinning the entire guest is not desirable since we waste a lot of memory resources, but this is the approach that we currently have. Do you find it good enough for a merge with the main KVM tree, and optimize later? When you mentioned building a table as the shadow page table, did you mean that we should map the IOMMU on demand? I'm not sure how we can do that... the guest can send a guest physical address to the device for DMA, even without generating a page-fault on the host for that address... which implies that the host must pin the entire guest memory in advance. agree? The only way I can think of avoiding that is PVDMA with VT-d, which means that there is a hyper call for each DMA request, but this is a different solution, cause it only applies to PV guests. Do you see a way to avoid mapping (and pinning) the entire guest memory for fully virtual guests (and without parsing every transaction between the guest and the device to figure out the DMA addresses)? Regards, Ben > Regards, > > Anthony Liguori >