Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752804AbbDAVso (ORCPT ); Wed, 1 Apr 2015 17:48:44 -0400 Received: from mx1.redhat.com ([209.132.183.28]:34783 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752623AbbDAVsd (ORCPT ); Wed, 1 Apr 2015 17:48:33 -0400 Message-ID: <1427924904.5567.303.camel@redhat.com> Subject: Re: [PATCH kernel v7 04/31] vfio: powerpc/spapr: Use it_page_size From: Alex Williamson To: Alexey Kardashevskiy Cc: linuxppc-dev@lists.ozlabs.org, Benjamin Herrenschmidt , Paul Mackerras , linux-kernel@vger.kernel.org Date: Wed, 01 Apr 2015 15:48:24 -0600 In-Reply-To: <1427468115-2224-5-git-send-email-aik@ozlabs.ru> References: <1427468115-2224-1-git-send-email-aik@ozlabs.ru> <1427468115-2224-5-git-send-email-aik@ozlabs.ru> Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2206 Lines: 55 On Sat, 2015-03-28 at 01:54 +1100, Alexey Kardashevskiy wrote: > This makes use of the it_page_size from the iommu_table struct > as page size can differ. > > This replaces missing IOMMU_PAGE_SHIFT macro in commented debug code > as recently introduced IOMMU_PAGE_XXX macros do not include > IOMMU_PAGE_SHIFT. > > Signed-off-by: Alexey Kardashevskiy > Reviewed-by: David Gibson > --- > drivers/vfio/vfio_iommu_spapr_tce.c | 26 +++++++++++++------------- > 1 file changed, 13 insertions(+), 13 deletions(-) > > diff --git a/drivers/vfio/vfio_iommu_spapr_tce.c b/drivers/vfio/vfio_iommu_spapr_tce.c > index f835e63..8bbee22 100644 > --- a/drivers/vfio/vfio_iommu_spapr_tce.c > +++ b/drivers/vfio/vfio_iommu_spapr_tce.c > @@ -91,7 +91,7 @@ static int tce_iommu_enable(struct tce_container *container) > * enforcing the limit based on the max that the guest can map. > */ > down_write(¤t->mm->mmap_sem); > - npages = (tbl->it_size << IOMMU_PAGE_SHIFT_4K) >> PAGE_SHIFT; > + npages = (tbl->it_size << tbl->it_page_shift) >> PAGE_SHIFT; > locked = current->mm->locked_vm + npages; > lock_limit = rlimit(RLIMIT_MEMLOCK) >> PAGE_SHIFT; > if (locked > lock_limit && !capable(CAP_IPC_LOCK)) { > @@ -120,7 +120,7 @@ static void tce_iommu_disable(struct tce_container *container) > > down_write(¤t->mm->mmap_sem); > current->mm->locked_vm -= (container->tbl->it_size << > - IOMMU_PAGE_SHIFT_4K) >> PAGE_SHIFT; > + container->tbl->it_page_shift) >> PAGE_SHIFT; > up_write(¤t->mm->mmap_sem); > } > > @@ -222,7 +222,7 @@ static long tce_iommu_build(struct tce_container *container, > tce, ret); > break; > } > - tce += IOMMU_PAGE_SIZE_4K; > + tce += IOMMU_PAGE_SIZE(tbl); Is PAGE_SIZE ever smaller than IOMMU_PAGE_SIZE(tbl)? IOW, can the page we got from get_user_pages_fast() ever not completely fill the tce entry? (Have I asked this before? Sorry if so) -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/