Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756527AbbBEE5P (ORCPT ); Wed, 4 Feb 2015 23:57:15 -0500 Received: from mail-pd0-f178.google.com ([209.85.192.178]:46606 "EHLO mail-pd0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754621AbbBEE5O (ORCPT ); Wed, 4 Feb 2015 23:57:14 -0500 Message-ID: <54D2F820.5020607@ozlabs.ru> Date: Thu, 05 Feb 2015 15:57:04 +1100 From: Alexey Kardashevskiy User-Agent: Mozilla/5.0 (X11; Linux i686 on x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: Paul Mackerras CC: linuxppc-dev@lists.ozlabs.org, Benjamin Herrenschmidt , Michael Ellerman , Gavin Shan , Alex Williamson , Alexander Graf , Alexander Gordeev , linux-kernel@vger.kernel.org Subject: Re: [PATCH v3 12/24] powerpc/iommu/powernv: Release replaced TCE References: <1422523325-1389-1-git-send-email-aik@ozlabs.ru> <1422523325-1389-13-git-send-email-aik@ozlabs.ru> <20150204060822.GA8644@iris.ozlabs.ibm.com> In-Reply-To: <20150204060822.GA8644@iris.ozlabs.ibm.com> Content-Type: text/plain; charset=koi8-r Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2034 Lines: 51 On 02/04/2015 05:08 PM, Paul Mackerras wrote: > On Thu, Jan 29, 2015 at 08:21:53PM +1100, Alexey Kardashevskiy wrote: >> At the moment writing new TCE value to the IOMMU table fails with EBUSY >> if there is a valid entry already. However PAPR specification allows >> the guest to write new TCE value without clearing it first. >> >> Another problem this patch is addressing is the use of pool locks for >> external IOMMU users such as VFIO. The pool locks are to protect >> DMA page allocator rather than entries and since the host kernel does >> not control what pages are in use, there is no point in pool locks and >> exchange()+put_page(oldtce) is sufficient to avoid possible races. >> >> This adds an exchange() callback to iommu_table_ops which does the same >> thing as set() plus it returns replaced TCE(s) so the caller can release >> the pages afterwards. >> >> This implements exchange() for IODA2 only. This adds a requirement >> for a platform to have exchange() implemented so from now on IODA2 is >> the only supported PHB for VFIO-SPAPR. >> >> This replaces iommu_tce_build() and iommu_clear_tce() with >> a single iommu_tce_xchg(). > > [snip] > >> @@ -294,8 +303,9 @@ static long tce_iommu_build(struct tce_container *container, >> >> hva = (unsigned long) page_address(page) + >> (tce & IOMMU_PAGE_MASK(tbl) & ~PAGE_MASK); >> + oldtce = 0; >> >> - ret = iommu_tce_build(tbl, entry + 1, hva, direction); >> + ret = iommu_tce_xchg(tbl, entry + i, hva, &oldtce, direction); > > Is the change from entry + 1 to entry + i here an actual bug fix? > If so please mention it in the patch description. This patch added the bug: [PATCH v3 01/24] vfio: powerpc/spapr: Move page pinning from arch code to VFIO IOMMU driver Will fix in the next try. -- Alexey -- 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/