From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751503AbdGZJNf (ORCPT ); Wed, 26 Jul 2017 05:13:35 -0400 Received: from 8bytes.org ([81.169.241.247]:53270 "EHLO theia.8bytes.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750826AbdGZJNe (ORCPT ); Wed, 26 Jul 2017 05:13:34 -0400 Date: Wed, 26 Jul 2017 11:13:31 +0200 From: Joerg Roedel To: David Dillow Cc: David Woodhouse , iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] iommu/vt-d: Don't free parent pagetable of the PTE we're adding Message-ID: <20170726091331.GB15833@8bytes.org> References: <20170629024223.14866-1-dillow@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170629024223.14866-1-dillow@google.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jun 28, 2017 at 07:42:23PM -0700, David Dillow wrote: > When adding a large scatterlist entry that covers more than the L3 > superpage size (1GB) but has an alignment such that we must use L2 > superpages (2MB) , we give dma_pte_free_level() a range that causes it > to free the L3 pagetable we're about to populate. We fix this by telling > dma_pte_free_pagetable() about the pagetable level we're about to populate > to prevent freeing it. > > For example, mapping a scatterlist with entry lengths 854MB and 1194MB > at IOVA 0xffff80000000 would, when processing the 2MB-aligned second > entry, cause pfn_to_dma_pte() to create a L3 directory to hold L2 > superpages for the mapping at IOVA 0xffffc0000000. We would previously > call dma_pte_free_pagetable(domain, 0xffffc0000, 0xfffffffff), which > would free the L3 directory pfn_to_dma_pte() just created for IO PFN > 0xffffc0000. Telling dma_pte_free_pagetable() to retain the L3 > directories while using L2 superpages avoids the erroneous free. > > Signed-off-by: David Dillow > --- > drivers/iommu/intel-iommu.c | 38 ++++++++++++++++++++++++++------------ > 1 file changed, 26 insertions(+), 12 deletions(-) Applied, thanks. From mboxrd@z Thu Jan 1 00:00:00 1970 From: Joerg Roedel Subject: Re: [PATCH] iommu/vt-d: Don't free parent pagetable of the PTE we're adding Date: Wed, 26 Jul 2017 11:13:31 +0200 Message-ID: <20170726091331.GB15833@8bytes.org> References: <20170629024223.14866-1-dillow@google.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <20170629024223.14866-1-dillow-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: iommu-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org Errors-To: iommu-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org To: David Dillow Cc: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org, David Woodhouse , linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org List-Id: iommu@lists.linux-foundation.org On Wed, Jun 28, 2017 at 07:42:23PM -0700, David Dillow wrote: > When adding a large scatterlist entry that covers more than the L3 > superpage size (1GB) but has an alignment such that we must use L2 > superpages (2MB) , we give dma_pte_free_level() a range that causes it > to free the L3 pagetable we're about to populate. We fix this by telling > dma_pte_free_pagetable() about the pagetable level we're about to populate > to prevent freeing it. > > For example, mapping a scatterlist with entry lengths 854MB and 1194MB > at IOVA 0xffff80000000 would, when processing the 2MB-aligned second > entry, cause pfn_to_dma_pte() to create a L3 directory to hold L2 > superpages for the mapping at IOVA 0xffffc0000000. We would previously > call dma_pte_free_pagetable(domain, 0xffffc0000, 0xfffffffff), which > would free the L3 directory pfn_to_dma_pte() just created for IO PFN > 0xffffc0000. Telling dma_pte_free_pagetable() to retain the L3 > directories while using L2 superpages avoids the erroneous free. > > Signed-off-by: David Dillow > --- > drivers/iommu/intel-iommu.c | 38 ++++++++++++++++++++++++++------------ > 1 file changed, 26 insertions(+), 12 deletions(-) Applied, thanks.